Check that patch set is current before doing a rebase
If two users open a change in the WebUI and hit the 'Rebase Change' button one after another, the rebase succeeds for the first user and a new patch set with the rebased commit is created, but for the second user the rebase fails because the change was modified. The bad thing is that also for the second user a new commit and a new patch set are created, only updating the current patch set field of the change fails in the end. By adding the check for the current patch set in the beginning we now fail early for the second user. Change-Id: I52b48c695fe751d4ef8cd99e052a78dfb806a790 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
committed by
Edwin Kempin
parent
ffe4ea0748
commit
441d1ba257
@@ -313,6 +313,9 @@ public class RebaseChange {
|
||||
OrmException, IOException, InvalidChangeOperationException,
|
||||
PathConflictException {
|
||||
Change change = chg;
|
||||
if (!chg.currentPatchSetId().equals(patchSetId)) {
|
||||
throw new InvalidChangeOperationException("patch set is not current");
|
||||
}
|
||||
final PatchSet originalPatchSet = db.patchSets().get(patchSetId);
|
||||
|
||||
final RevCommit rebasedCommit;
|
||||
|
||||
Reference in New Issue
Block a user