MergeOp: Throw more descriptive ResourceConflictExceptions

Keep track of problems that occur during the various early validation
phases of submitting a batch of changes. This replaces usage of
CommitMergeStatus for some statuses (e.g. REVISION_GONE) that should
really fail the batch before any merge attempt is made. It also
avoids throwing IntegrationExceptions early, looping through the full
list of changes to collect more errors.

Currently the failFast() method throws ResourceConflictException,
since that is the easiest way to expose the error message to users. In
the future we will probably rearrange exception types a bit more.

Change-Id: I4846043333eaedb06975825b8aa75b3bfc97e698
This commit is contained in:
Dave Borowitz
2015-12-18 16:47:20 -05:00
parent 7c7643bb64
commit bd77ad3609
3 changed files with 111 additions and 97 deletions

View File

@@ -73,9 +73,8 @@ public class SubmitByFastForwardIT extends AbstractSubmit {
Change.Id id1 = change1.getPatchSetId().getParentKey();
submitWithConflict(change2.getChangeId(),
"The change could not be submitted because it depends on change(s) [" +
id1 + "], which could not be submitted because:\n" +
id1 + ": needs Code-Review;");
"Failed to submit 2 changes due to the following problems:\n"
+ "Change " + id1 + ": needs Code-Review");
RevCommit head = getRemoteHead();
assertThat(head.getId()).isEqualTo(oldHead.getId());