Fix merge validator exception type is ignored
The switch case in updateChangeStatus was supposed to handle the failed cases but it was never reached by changes who failed to merge, since only the submitted ones are returned by the validation function. Now, updateChangeStatus is called on every change that doesn't make it out of the validation. Also, the parameter name 'submitted' did not make sense since the method handles changes who cannot be submitted, so it is renamed to 'changes'. Also, destBranch is optionally null in updateChangeStatus since it doesn't apply to failed merges. Tests are modified since the error output is more verbose than before. Bug: Issue 3741 Change-Id: Id1de81b3136b94e210c957a58b5c801a1faa3244
This commit is contained in:
@@ -296,7 +296,9 @@ public class SubmitByMergeIfNecessaryIT extends AbstractSubmitByMerge {
|
||||
"a.txt", "1", "a-topic-here");
|
||||
approve(change3b.getChangeId());
|
||||
|
||||
submitWithConflict(change3a.getChangeId(), "Merge Conflict");
|
||||
submitWithConflict(change3a.getChangeId(), "Cannot merge " +
|
||||
change3a.getCommit().name() +
|
||||
"\nMissing dependency");
|
||||
|
||||
RevCommit tipbranch = getRemoteLog(project, "branch").get(0);
|
||||
assertThat(tipbranch.getShortMessage()).isEqualTo(
|
||||
|
||||
@@ -107,7 +107,9 @@ public class SubmitByRebaseIfNecessaryIT extends AbstractSubmit {
|
||||
testRepo.reset(initialHead);
|
||||
PushOneCommit.Result change2 =
|
||||
createChange("Change 2", "a.txt", "other content");
|
||||
submitWithConflict(change2.getChangeId(), "Merge Conflict");
|
||||
submitWithConflict(change2.getChangeId(), "Cannot rebase " +
|
||||
change2.getCommit().name() +
|
||||
": The change could not be rebased due to a conflict during merge.");
|
||||
RevCommit head = getRemoteHead();
|
||||
assertThat(head).isEqualTo(oldHead);
|
||||
assertCurrentRevision(change2.getChangeId(), 1, change2.getCommitId());
|
||||
|
||||
Reference in New Issue
Block a user