]> source.dussan.org Git - jgit.git/commit
Add the ability to override parents on RevCommit. 04/194204/26
authorRonald Bhuleskar <funronald@google.com>
Wed, 15 Jun 2022 21:37:21 +0000 (14:37 -0700)
committerRonald Bhuleskar <funronald@google.com>
Tue, 2 Aug 2022 17:50:16 +0000 (10:50 -0700)
commit61b4d105e4924bf15c07f5bc6f1ab0d23b50bff1
tree2d54f051bcb0c735de3a167d2896c2de74690ddb
parentb544da795bc242d76572384b46a8ae1141d040e0
Add the ability to override parents on RevCommit.

This makes RevCommit extensible to allow having different structure of
child-parent relationship. This change is a pre-requsite for having a
FilteredRevCommit that overrides parents from the RevCommit. That then
provides a cheaper way to walk over a subset of RevCommits instead of
an expensive way that applies filters while walking over selected
commits. Useful with Blame which works on a single file and that can be
made performant, if we know all the commits needed by the Blame
algorithm. So Blame algorithm can avoid walking over finding what
commits to blame on.

This change makes parents field on RevCommit private and exposes it
thrrough overrideable methods such as getParents, getParent at index,
getParentCount and setParents. All other files other than RevCommit are
updating the usages of accessing RevCommits parents.

Change-Id: I2d13b001c599cc4ebc92d1ab6e07b07acb3b7fe5
14 files changed:
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitWithOverriddenParentTest.java [new file with mode: 0644]
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkCullTest.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/AbstractRevQueue.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/BoundaryGenerator.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/DepthGenerator.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteGenerator.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoNonIntermixSortGenerator.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TopoSortGenerator.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java