git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: spearce@spearce.org
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH] Drop StGit support
Date: Sun,  7 Dec 2008 00:01:23 +0100	[thread overview]
Message-ID: <1228604483-30761-1-git-send-email-robin.rosenberg@dewire.com> (raw)

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

             reply	other threads:[~2008-12-06 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-06 23:01 Robin Rosenberg [this message]
2008-12-08 16:18 ` [EGIT PATCH] Drop StGit support Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1228604483-30761-1-git-send-email-robin.rosenberg@dewire.com \
    --to=robin.rosenberg@dewire.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).