diff options
author | Alex Spradlin <alexaspradlin@google.com> | 2020-02-26 15:31:37 -0800 |
---|---|---|
committer | Alex Spradlin <alexaspradlin@google.com> | 2020-03-11 15:39:38 -0700 |
commit | e498d43186264f4592d5c9b9303037734cc38b0d (patch) | |
tree | 5a617d8231e5e652a13e8cf529d563e3ff50ab50 /org.eclipse.jgit/resources/org/eclipse | |
parent | 04e16afb05912f3a163d8cda3560a5b2f1ea997f (diff) | |
download | jgit-e498d43186264f4592d5c9b9303037734cc38b0d.tar.gz jgit-e498d43186264f4592d5c9b9303037734cc38b0d.zip |
RevWalk: new topo sort to not mix lines of history
The topological sort algorithm in TopoSortGenerator for RevWalk may mix
multiple lines of history, producing results that differ from C git's
git-log whose man page states: "Show no parents before all of its
children are shown, and avoid showing commits on multiple lines of
history intermixed." Lines of history are mixed because
TopoSortGenerator merely delays producing a commit until all of its
children have been produced; it does not immediately produce a commit
after its last child has been produced.
Therefore, add a new RevSort option called TOPO_KEEP_BRANCH_TOGETHER
with a new topo sort algorithm in TopoNonIntermixGenerator. In the
Generator, when the last child of a commit has been produced, unpop
that commit so that it will be returned upon the subsequent call to
next(). To avoid producing duplicates, mark commits that have not yet
been produced as TOPO_QUEUED so that when a commit is popped, it is
produced if and only if TOPO_QUEUED is set.
To support nesting with other generators that may produce the same
commit multiple times like DepthGenerator (for example, StartGenerator
does this), do not increment parent inDegree for the same child commit
more than once.
Commit b5e764abd21bd4593287361a625ecc49bc0efd77 modified the existing
TopoSortGenerator to avoid mixing lines of history, but it was reverted
in e40c38ab08837473375c571c2f07ab680fc1985d because the new behavior
caused problems for EGit users. This motivated adding a new Generator
for the new behavior.
Signed-off-by: Alex Spradlin <alexaspradlin@google.com>
Change-Id: Icbb24eac98c00e45c175b01e1c8122554f617933
Diffstat (limited to 'org.eclipse.jgit/resources/org/eclipse')
-rw-r--r-- | org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties | 1 |
1 files changed, 1 insertions, 0 deletions
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 1218ee612d..c46cd4a36f 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -54,6 +54,7 @@ cannotChangeActionOnComment=Cannot change action on comment line in git-rebase-t cannotCheckoutFromUnbornBranch=Cannot check out from unborn branch cannotCheckoutOursSwitchBranch=Checking out ours/theirs is only possible when checking out index, not when switching branches. cannotCombineSquashWithNoff=Cannot combine --squash with --no-ff. +cannotCombineTopoSortWithTopoNonIntermixSort=Cannot combine sorts TOPO and TOPO_NON_INTERMIX. cannotCombineTreeFilterWithRevFilter=Cannot combine TreeFilter {0} with RevFilter {1}. cannotCommitOnARepoWithState=Cannot commit on a repo with state: {0} cannotCommitWriteTo=Cannot commit write to {0} |