Expose the set of root commits in PackStatistics
Root commits are commits with zero parents. If a commmit has no parents it is the first commit in the repository. In general the root commits should be unique for any given project, as the first commit will be created at a different time, by a different user with its own message. These root commits can be used as a "fingerprint" to identify disjoint histories. Change-Id: Id891dbc1f17c816cea404569578bb7635ff85cdb
This commit is contained in:
parent
f9bd6c1239
commit
1d7d0f95e0
|
@ -1718,6 +1718,7 @@ private void findObjectsToPack(final ProgressMonitor countingMonitor,
|
||||||
final int maxBases = config.getDeltaSearchWindowSize();
|
final int maxBases = config.getDeltaSearchWindowSize();
|
||||||
Set<RevTree> baseTrees = new HashSet<RevTree>();
|
Set<RevTree> baseTrees = new HashSet<RevTree>();
|
||||||
BlockList<RevCommit> commits = new BlockList<RevCommit>();
|
BlockList<RevCommit> commits = new BlockList<RevCommit>();
|
||||||
|
Set<ObjectId> roots = new HashSet<>();
|
||||||
RevCommit c;
|
RevCommit c;
|
||||||
while ((c = walker.next()) != null) {
|
while ((c = walker.next()) != null) {
|
||||||
if (exclude(c))
|
if (exclude(c))
|
||||||
|
@ -1729,8 +1730,12 @@ private void findObjectsToPack(final ProgressMonitor countingMonitor,
|
||||||
}
|
}
|
||||||
|
|
||||||
commits.add(c);
|
commits.add(c);
|
||||||
|
if (c.getParentCount() == 0) {
|
||||||
|
roots.add(c.copy());
|
||||||
|
}
|
||||||
countingMonitor.update(1);
|
countingMonitor.update(1);
|
||||||
}
|
}
|
||||||
|
stats.rootCommits = Collections.unmodifiableSet(roots);
|
||||||
|
|
||||||
if (shallowPack) {
|
if (shallowPack) {
|
||||||
for (RevCommit cmit : commits) {
|
for (RevCommit cmit : commits) {
|
||||||
|
|
|
@ -178,6 +178,9 @@ public static class Accumulator {
|
||||||
/** The collection of reused packs in the upload. */
|
/** The collection of reused packs in the upload. */
|
||||||
public List<CachedPack> reusedPacks;
|
public List<CachedPack> reusedPacks;
|
||||||
|
|
||||||
|
/** Commits with no parents. */
|
||||||
|
public Set<ObjectId> rootCommits;
|
||||||
|
|
||||||
/** If a shallow pack, the depth in commits. */
|
/** If a shallow pack, the depth in commits. */
|
||||||
public int depth;
|
public int depth;
|
||||||
|
|
||||||
|
@ -299,6 +302,11 @@ public List<CachedPack> getReusedPacks() {
|
||||||
return statistics.reusedPacks;
|
return statistics.reusedPacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return unmodifiable collection of the root commits of the history. */
|
||||||
|
public Set<ObjectId> getRootCommits() {
|
||||||
|
return statistics.rootCommits;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return number of objects in the output pack that went through the delta
|
* @return number of objects in the output pack that went through the delta
|
||||||
* search process in order to find a potential delta base.
|
* search process in order to find a potential delta base.
|
||||||
|
|
Loading…
Reference in New Issue