Merging Changes: Do not enter submitted state

Recently the MergeQueue was removed, such that the submit process
will directly tell users the result of their submission (merge or reject).
For that changes were submitted and directly merged after. If problems
(such as a server going down, power loss etc.) occur between setting the
submitted state and the actual merge being performed, these changes would
be stuck in the submitted state, which is annoying UI wise, but the user
could just try to resubmit once the problems are solved.

This change moves changes directly from NEW to MERGED if possible or
rejects otherwise. We still need to keep lots of code in the Submit class
to record the Submit label. Eventually this can be moved into the MergeOp
as well.

The MergeOp doesn't rely on the submitted state as well any more but
just integrates the given changes. So changes which are submitted, but
not merged on the same branch are left untouched now. So the tests which
are testing exactly these corner cases of submitted changes on the same
branch are adapted.

Currently the test `submitMultipleChanges` is rather testing that the
other changes on the same target branch are left alone. Instead we
want to test if the submit strategy can submit changes both via
fast forward as well as merging if it's necessary. After applying
this change the name of `submitMultipleChanges` is correct again.

There is no access to the submitter when running a submit strategy
as it is not in the submitted state any more, so we need another way
of transporting the information of who is trying to integrate the change
to the submit strategy, so we do that via another argument in
SubmitStrategy$Argument.

The CherryPick strategy has a slight change in behavior as well.
The committer for a cherry-picked change will be the server instead
of the submitter as this aligns better with the other submit strategies,
creating new commits on behalf of the user.

Change-Id: I9a0c111c1cb3544774b2783c4f76318e2634faf2
This commit is contained in:
Stefan Beller
2015-07-10 13:30:21 -07:00
parent 8792bd67d7
commit 7063a4b8f0
25 changed files with 361 additions and 599 deletions

View File

@@ -121,7 +121,7 @@ public class CommitMessageOutputTest extends AbstractChangeNotesTest {
assertBodyEquals("Submit patch set 1\n"
+ "\n"
+ "Patch-set: 1\n"
+ "Status: submitted\n"
+ "Status: merged\n"
+ "Submitted-with: NOT_READY\n"
+ "Submitted-with: OK: Verified: Change Owner <1@gerrit>\n"
+ "Submitted-with: NEED: Code-Review\n"
@@ -180,7 +180,7 @@ public class CommitMessageOutputTest extends AbstractChangeNotesTest {
assertBodyEquals("Submit patch set 1\n"
+ "\n"
+ "Patch-set: 1\n"
+ "Status: submitted\n"
+ "Status: merged\n"
+ "Submitted-with: RULE_ERROR Problem with patch set: 1\n",
update.getRevision());
}