From 10e0b3668dd4703ab5b1875adc34b373554582b0 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 5 Mar 2008 21:02:36 -0500 Subject: [PATCH] Extract StGitPatch from Repository to its own top-level type The concept of an StGitPatch and StGit in general is an add-on to Git. We probably shouldn't have all of the StGit logic built into our core Repository class, but instead should try to consolidate the StGit interface logic into its own package, where it can grow and do things it needs to do. According to Git Robin created StGitPatch back in 2007, so I am putting the copyright header on here and attributing it to him. Signed-off-by: Shawn O. Pearce --- .../src/org/spearce/egit/ui/GitHistoryPage.java | 2 +- org.spearce.jgit/META-INF/MANIFEST.MF | 3 +- .../src/org/spearce/jgit/lib/Repository.java | 34 +------------- .../src/org/spearce/jgit/stgit/StGitPatch.java | 52 ++++++++++++++++++++++ 4 files changed, 56 insertions(+), 35 deletions(-) create mode 100644 org.spearce.jgit/src/org/spearce/jgit/stgit/StGitPatch.java diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java index 268a6bac..420013b7 100644 --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/GitHistoryPage.java @@ -96,9 +96,9 @@ import org.spearce.jgit.lib.ObjectId; import org.spearce.jgit.lib.PersonIdent; import org.spearce.jgit.lib.Tag; import org.spearce.jgit.lib.TopologicalSorter; -import org.spearce.jgit.lib.Repository.StGitPatch; import org.spearce.jgit.lib.TopologicalSorter.Edge; import org.spearce.jgit.lib.TopologicalSorter.Lane; +import org.spearce.jgit.stgit.StGitPatch; /** * The Git history page, i.e. the history view. diff --git a/org.spearce.jgit/META-INF/MANIFEST.MF b/org.spearce.jgit/META-INF/MANIFEST.MF index 78532068..c7e8f613 100644 --- a/org.spearce.jgit/META-INF/MANIFEST.MF +++ b/org.spearce.jgit/META-INF/MANIFEST.MF @@ -6,6 +6,7 @@ Bundle-Version: 0.3.1.qualifier Bundle-Localization: plugin Bundle-Vendor: %provider_name Export-Package: org.spearce.jgit.errors, - org.spearce.jgit.lib + org.spearce.jgit.lib, + org.spearce.jgit.stgit Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java index f1a14763..79c15be3 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java @@ -33,6 +33,7 @@ import java.util.WeakHashMap; import org.spearce.jgit.errors.IncorrectObjectTypeException; import org.spearce.jgit.errors.ObjectWritingException; +import org.spearce.jgit.stgit.StGitPatch; /** * Represents a Git repository. A repository holds all objects and refs used for @@ -872,39 +873,6 @@ public class Repository { } /** - * A Stacked Git patch - */ - public static class StGitPatch { - - /** - * Construct an StGitPatch - * @param patchName - * @param id - */ - public StGitPatch(String patchName, ObjectId id) { - name = patchName; - gitId = id; - } - - /** - * @return commit id of patch - */ - public ObjectId getGitId() { - return gitId; - } - - /** - * @return name of patch - */ - public String getName() { - return name; - } - - private String name; - private ObjectId gitId; - } - - /** * @return applied patches in a map indexed on current commit id * @throws IOException */ diff --git a/org.spearce.jgit/src/org/spearce/jgit/stgit/StGitPatch.java b/org.spearce.jgit/src/org/spearce/jgit/stgit/StGitPatch.java new file mode 100644 index 00000000..5faba07f --- /dev/null +++ b/org.spearce.jgit/src/org/spearce/jgit/stgit/StGitPatch.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2007 Robin Rosenberg + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License, version 2, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + */ +package org.spearce.jgit.stgit; + +import org.spearce.jgit.lib.ObjectId; + +/** + * A Stacked Git patch + */ +public class StGitPatch { + + /** + * Construct an StGitPatch + * @param patchName + * @param id + */ + public StGitPatch(String patchName, ObjectId id) { + name = patchName; + gitId = id; + } + + /** + * @return commit id of patch + */ + public ObjectId getGitId() { + return gitId; + } + + /** + * @return name of patch + */ + public String getName() { + return name; + } + + private String name; + private ObjectId gitId; +} \ No newline at end of file -- 2.11.4.GIT