Teach RevWalk how to compute the merge base of 1 or more commits
commit5df542d766f54cfe0b94022235b63f201c7f103c
authorShawn O. Pearce <spearce@spearce.org>
Thu, 24 Apr 2008 06:00:56 +0000 (24 02:00 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 11 May 2008 05:16:32 +0000 (11 01:16 -0400)
tree4b0626b993791385523725100518af034c0f95f0
parent3b27268f49e27bad2b249d422eaff1319078d322
Teach RevWalk how to compute the merge base of 1 or more commits

Computing the merge base of two commits is often necessary to look
for safe fast-forwards of a tracking branch, but is also necessary
to actually perform a 3 way merge of two branches.

This merge base algorithm is generalized to handle 1 to 26 starting
commits (otherwise known as branches), where the upper limit of 26
is actually bounded only by the number of free RevFlags available
within the RevWalk being used.

The merge base of 1 commit is always itself.  The merge base of
two or more commits along a string-of-pearls is always the oldest
ancestor in the group.

Unlike C Git's `git merge-base` program we generalize well to
compute merge bases for more than two branches.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit/src/org/spearce/jgit/pgm/MergeBase.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/revwalk/AbstractRevQueue.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/MergeBaseGenerator.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/StartGenerator.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/filter/RevFilter.java