Remove method removeLastPatchSetId() from Change.

Instead, use the patchSet prior to the current patchSet.

This is part of the code cleanup to remove the nbrPatchSets field.

Change-Id: I7355aac57a6959fd145957c2d874a69c29e19c87
This commit is contained in:
Colby Ranger
2012-11-28 15:57:27 -08:00
parent c627bc54d0
commit f349f1ad18
2 changed files with 3 additions and 11 deletions

View File

@@ -482,15 +482,6 @@ public final class Change {
++nbrPatchSets;
}
/**
* Reverts to an older PatchSet id within this change.
* <p>
* <b>Note: This makes the change dirty. Call update() after.</b>
*/
public void removeLastPatchSetId() {
--nbrPatchSets;
}
public void updateNumberOfPatchSets(int max) {
nbrPatchSets = Math.max(nbrPatchSets, max);
}

View File

@@ -111,9 +111,10 @@ public class DeleteDraftPatchSet implements Callable<ReviewResult> {
}
}
if (change.currentPatchSetId().equals(patchSetId)) {
change.removeLastPatchSetId();
try {
change.setCurrentPatchSet(patchSetInfoFactory.get(db, change.currPatchSetId()));
PatchSet.Id id =
new PatchSet.Id(patchSetId.getParentKey(), patchSetId.get() - 1);
change.setCurrentPatchSet(patchSetInfoFactory.get(db, id));
} catch (PatchSetInfoNotAvailableException e) {
throw new NoSuchChangeException(changeId);
}