Class MergeOp
- All Implemented Interfaces:
AutoCloseable
Branches are reduced to the minimum number of heads needed to merge everything. This allows commits to be entered into the queue in any order (such as ancestors before descendants) and only the most recent commit on any line of development will be merged. All unmerged commits along a line of development must be in the submission queue in order to merge the tip of that line.
Conflicts are handled by discarding the entire line of development and marking it as conflicting, even if an earlier commit along that same line can be merged cleanly.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A problem preventing merge and change on which it occurred.static class
For each individual change in merge set aggregates issues and other details throughout the merge process. -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.collect.ImmutableList
<MergeOp.ChangeProblem> checkCommonSubmitProblems
(Change triggeringChange, ChangeSet cs, boolean allowMerged, PermissionBackend permissionBackend, CurrentUser caller) Returns a list of messages describing what prevents the current change from being submitted.static void
Check that SRs are fulfilled or throw otherwisevoid
close()
merge
(Change change, IdentifiedUser caller, boolean checkSubmitRules, SubmitInput submitInput, boolean dryrun) Merges the given change.
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
checkSubmitRequirements
Check that SRs are fulfilled or throw otherwise- Parameters:
cd
- change that is being checked- Throws:
ResourceConflictException
- the exception that is thrown if the SR is not fulfilled
-
checkCommonSubmitProblems
public static com.google.common.collect.ImmutableList<MergeOp.ChangeProblem> checkCommonSubmitProblems(Change triggeringChange, ChangeSet cs, boolean allowMerged, PermissionBackend permissionBackend, CurrentUser caller) Returns a list of messages describing what prevents the current change from being submitted.The method checks all changes in the
cs
for their current status, submitability and permissions and returns one change per change in the set that can't be submitted.- Parameters:
triggeringChange
- Change for which merge/submit action was initiatedcs
- Set of changes that the current change depends onallowMerged
- True if change being already merged is not a problem to be reportedpermissionBackend
- Interface for checking user ACLscaller
- the identity of the user that is recorded as the one performing the merge. In case of impersonationcaller.getRealUser()
contains the user triggering the merge.- Returns:
- List of problems preventing merge
-
merge
@CanIgnoreReturnValue public Change merge(Change change, IdentifiedUser caller, boolean checkSubmitRules, SubmitInput submitInput, boolean dryrun) throws RestApiException, UpdateException, IOException, org.eclipse.jgit.errors.ConfigInvalidException, PermissionBackendException Merges the given change.Depending on the server configuration, more changes may be affected, e.g. by submission of a topic or via superproject subscriptions. All affected changes are integrated using the projects integration strategy.
- Parameters:
change
- the change to be merged.caller
- the identity of the user that is recorded as the one performing the merge. In case of impersonationcaller.getRealUser()
contains the user triggering the merge.checkSubmitRules
- whether submit rules and submit requirements should be evaluated.submitInput
- parameters regarding the mergedryrun
- if true, this includes calculating all projects affected by the submission, checking for possible submission problems (ACLs, merge conflicts, etc) but not the merge itself.- Returns:
- the merged change
- Throws:
RestApiException
- if an error occurred.PermissionBackendException
- if permissions can't be checkedIOException
- an error occurred reading from NoteDb.UpdateException
org.eclipse.jgit.errors.ConfigInvalidException
-
getAllProjects
-
getMergeOpRepoManager
-