Class AutoMerger
- java.lang.Object
-
- com.google.gerrit.server.patch.AutoMerger
-
public class AutoMerger extends Object
Utility class for creating an auto-merge commit of a merge commit.An auto-merge commit is the result of merging the 2 parents of a merge commit automatically. If there are conflicts the auto-merge commit contains Git conflict markers that indicate these conflicts.
Creating auto-merge commits for octopus merges (merge commits with more than 2 parents) is not supported. In this case the auto-merge is created between the first 2 parent commits.
All created auto-merge commits are stored in the repository of their merge commit as
refs/cache-automerge/
branches. These branches serve:- as a cache so that the each auto-merge gets computed only once
- as base for merge commits on which users can comment
The second point means that these commits are referenced from NoteDb. The consequence of this is that these refs should never be deleted.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
cacheAutomerge(org.eclipse.jgit.lib.Config cfg)
org.eclipse.jgit.revwalk.RevCommit
merge(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter ins, org.eclipse.jgit.revwalk.RevCommit merge, org.eclipse.jgit.merge.ThreeWayMergeStrategy mergeStrategy)
Creates an auto-merge commit of the parents of the given merge commit.
-
-
-
Method Detail
-
cacheAutomerge
public static boolean cacheAutomerge(org.eclipse.jgit.lib.Config cfg)
-
merge
public org.eclipse.jgit.revwalk.RevCommit merge(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.revwalk.RevWalk rw, org.eclipse.jgit.lib.ObjectInserter ins, org.eclipse.jgit.revwalk.RevCommit merge, org.eclipse.jgit.merge.ThreeWayMergeStrategy mergeStrategy) throws IOException
Creates an auto-merge commit of the parents of the given merge commit.In case of an exception the creation of the auto-merge commit is retried a few times. E.g. this allows the operation to succeed if a Git update fails due to a temporary issue.
- Returns:
- auto-merge commit. Headers of the returned RevCommit are parsed.
- Throws:
IOException
-
-