diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index 677f735ce..b64617b39 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -124,6 +124,7 @@ couldNotCheckOutBecauseOfConflicts=Could not check out because of conflicts couldNotDeleteLockFileShouldNotHappen=Could not delete lock file. Should not happen couldNotDeleteTemporaryIndexFileShouldNotHappen=Could not delete temporary index file. Should not happen couldNotGetAdvertisedRef=Could not get advertised Ref for branch {0} +couldNotGetRepoStatistics=Could not get repository statistics couldNotLockHEAD=Could not lock HEAD couldNotReadIndexInOneGo=Could not read index in one go, only {0} out of {1} read couldNotReadObjectWhileParsingCommit=Could not read an object while parsing commit {0} diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java index 7fda6cc01..77b84d3a3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java @@ -129,6 +129,24 @@ public Properties call() throws GitAPIException { } } + /** + * Computes and returns the repository statistics. + * + * @return the repository statistics + * @throws GitAPIException + * thrown if the repository statistics cannot be computed + * @since 3.0 + */ + public Properties getStatistics() throws GitAPIException { + try { + GC gc = new GC((FileRepository) repo); + return toProperties(gc.getStatistics()); + } catch (IOException e) { + throw new JGitInternalException( + JGitText.get().couldNotGetRepoStatistics, e); + } + } + @SuppressWarnings("boxing") private static Properties toProperties(RepoStatistics stats) { Properties p = new Properties(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java index 7a1efe89d..d7eb8af95 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -186,6 +186,7 @@ public static JGitText get() { /***/ public String couldNotDeleteLockFileShouldNotHappen; /***/ public String couldNotDeleteTemporaryIndexFileShouldNotHappen; /***/ public String couldNotGetAdvertisedRef; + /***/ public String couldNotGetRepoStatistics; /***/ public String couldNotLockHEAD; /***/ public String couldNotReadIndexInOneGo; /***/ public String couldNotReadObjectWhileParsingCommit;