git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [EGIT PATCH] Drop StGit support
@ 2008-12-06 23:01 Robin Rosenberg
  2008-12-08 16:18 ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Rosenberg @ 2008-12-06 23:01 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg

It is slow and none of the jgit/egit developers use it.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../internal/decorators/GitResourceDecorator.java  |   20 ++----
 .../src/org/spearce/jgit/lib/Repository.java       |   62 --------------------
 2 files changed, 7 insertions(+), 75 deletions(-)

This applies on top of the close outputstream bugfix patch posted recently.

diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
index 1055fcc..97a0311 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
@@ -322,19 +322,13 @@ public void decorate(final Object element, final IDecoration decoration) {
 								Repository repo = mapped.getRepository();
 								try {
 									String branch = repo.getBranch();
-									if (repo.isStGitMode()) {
-										String patch = repo.getPatch();
-										decoration.addSuffix(" [StGit " + patch + "@" + branch
-												+ "]");
-									} else {
-										RepositoryState repositoryState = repo.getRepositoryState();
-										String statename;
-										if (repositoryState.equals(RepositoryState.SAFE))
-											statename = "";
-										else
-											statename = repositoryState.getDescription() + " ";
-										decoration.addSuffix(" [Git " + statename + "@ " + branch + "]");
-									}
+									RepositoryState repositoryState = repo.getRepositoryState();
+									String statename;
+									if (repositoryState.equals(RepositoryState.SAFE))
+										statename = "";
+									else
+										statename = repositoryState.getDescription() + " ";
+									decoration.addSuffix(" [Git " + statename + "@ " + branch + "]");
 								} catch (IOException e) {
 									e.printStackTrace();
 									decoration.addSuffix(" [Git ?]");
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 da1494f..b63ef18 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -58,7 +58,6 @@
 
 import org.spearce.jgit.errors.IncorrectObjectTypeException;
 import org.spearce.jgit.errors.RevisionSyntaxException;
-import org.spearce.jgit.stgit.StGitPatch;
 import org.spearce.jgit.util.FS;
 
 /**
@@ -988,67 +987,6 @@ public Ref peel(final Ref ref) {
 		return ret;
 	}
 
-	/**
-	 * @return true if HEAD points to a StGit patch.
-	 */
-	public boolean isStGitMode() {
-		File file = new File(getDirectory(), "HEAD");
-		BufferedReader reader = null;
-		try {
-			reader = new BufferedReader(new FileReader(file));
-			String string = reader.readLine();
-			if (!string.startsWith("ref: refs/heads/"))
-				return false;
-			String branch = string.substring("ref: refs/heads/".length());
-			File currentPatches = new File(new File(new File(getDirectory(),
-					"patches"), branch), "applied");
-			if (!currentPatches.exists())
-				return false;
-			if (currentPatches.length() == 0)
-				return false;
-			return true;
-
-		} catch (IOException e) {
-			e.printStackTrace();
-			return false;
-		} finally {
-			try {
-				if (reader != null)
-					reader.close();
-			} catch (IOException e1) {
-				// nothing to do here
-			}
-		}
-	}
-
-	/**
-	 * @return applied patches in a map indexed on current commit id
-	 * @throws IOException
-	 */
-	public Map<ObjectId,StGitPatch> getAppliedPatches() throws IOException {
-		Map<ObjectId,StGitPatch> ret = new HashMap<ObjectId,StGitPatch>();
-		if (isStGitMode()) {
-			File patchDir = new File(new File(getDirectory(),"patches"),getBranch());
-			BufferedReader apr = new BufferedReader(new FileReader(new File(patchDir,"applied")));
-			try {
-				for (String patchName=apr.readLine(); patchName!=null; patchName=apr.readLine()) {
-					File topFile = new File(new File(new File(patchDir,"patches"), patchName), "top");
-					BufferedReader tfr = new BufferedReader(new FileReader(topFile));
-					try {
-						String objectId = tfr.readLine();
-						ObjectId id = ObjectId.fromString(objectId);
-						ret.put(id, new StGitPatch(patchName, id));
-					} finally {
-						tfr.close();
-					}
-				}
-			} finally {
-				apr.close();
-			}
-		}
-		return ret;
-	}
-	
 	/** Clean up stale caches */
 	public void refreshFromDisk() {
 		refs.clearCache();
-- 
1.6.0.3.640.g6331a

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [EGIT PATCH] Drop StGit support
  2008-12-06 23:01 [EGIT PATCH] Drop StGit support Robin Rosenberg
@ 2008-12-08 16:18 ` Shawn O. Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2008-12-08 16:18 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> It is slow and none of the jgit/egit developers use it.
> 
> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>

Thanks.  I also fixed up the MANIFEST.MF to not export stgit package,
and removed the StGitPatch class as it isn't used anymore after
this was applied.  Both chagnes got squashed into this patch when
I applied it.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-08 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-06 23:01 [EGIT PATCH] Drop StGit support Robin Rosenberg
2008-12-08 16:18 ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).