Misleading PathConflictException when Rebasing

Since Gerrit nowadays handles Path Conflicts and (depending
on the Project Settings) tries to resolve them with a content
merge, there will also be failing rebases due to content merge
conflicts.

A user getting an error message pointing towards a path
conflict could obviously be confused, since (s)he is used to
Gerrit normally handling them or since it might not even be a
path conflict that caused the error.

Change-Id: I8574a78efbf130abfe0da8fc6ae65decbf6872a1
This commit is contained in:
Gustaf Lundh
2014-12-10 17:03:02 +01:00
committed by David Pursehouse
parent 2c1928fa49
commit 54ac00d366
4 changed files with 15 additions and 32 deletions

View File

@@ -20,10 +20,10 @@ import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.change.PatchSetInserter.ValidatePolicy;
import com.google.gerrit.server.changedetail.PathConflictException;
import com.google.gerrit.server.changedetail.RebaseChange;
import com.google.gerrit.server.git.CodeReviewCommit;
import com.google.gerrit.server.git.CommitMergeStatus;
import com.google.gerrit.server.git.MergeConflictException;
import com.google.gerrit.server.git.MergeException;
import com.google.gerrit.server.git.RebaseSorter;
import com.google.gerrit.server.patch.PatchSetInfoFactory;
@@ -109,8 +109,8 @@ public class RebaseIfNecessary extends SubmitStrategy {
newMergeTip.setStatusCode(CommitMergeStatus.CLEAN_REBASE);
newCommits.put(newPatchSet.getId().getParentKey(), newMergeTip);
setRefLogIdent(args.mergeUtil.getSubmitter(n));
} catch (PathConflictException e) {
n.setStatusCode(CommitMergeStatus.PATH_CONFLICT);
} catch (MergeConflictException e) {
n.setStatusCode(CommitMergeStatus.REBASE_MERGE_CONFLICT);
} catch (NoSuchChangeException | OrmException | IOException
| InvalidChangeOperationException e) {
throw new MergeException("Cannot rebase " + n.name(), e);