It is slow and none of the jgit/egit developers use it. Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> --- .../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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html