Remove nbrPatchSets from Change
The nbrPatchSets counter was used to generate the next PatchSetId. Instead, find the first reference after the currentPatchSetId() that does not exist by examining the references themselves. Also in a few locations, the use of currPatchSetId() was corrected to be currentPatchSetId(). Change-Id: I06bcf52798f1dad1ea602f914784dfcbc7d97086
This commit is contained in:
committed by
Shawn Pearce
parent
c3657e0b10
commit
fcdd5c9fc9
@@ -193,6 +193,9 @@ public final class Change {
|
||||
/** Database constant for {@link Status#MERGED}. */
|
||||
public static final char STATUS_MERGED = 'M';
|
||||
|
||||
/** ID number of the first patch set in a change. */
|
||||
public static final int INITIAL_PATCH_SET_ID = 1;
|
||||
|
||||
/**
|
||||
* Current state within the basic workflow of the change.
|
||||
*
|
||||
@@ -359,10 +362,6 @@ public final class Change {
|
||||
@Column(id = 10)
|
||||
protected char status;
|
||||
|
||||
/** The total number of {@link PatchSet} children in this Change. */
|
||||
@Column(id = 11)
|
||||
protected int nbrPatchSets;
|
||||
|
||||
/** The current patch set. */
|
||||
@Column(id = 12)
|
||||
protected int currentPatchSetId;
|
||||
@@ -473,23 +472,6 @@ public final class Change {
|
||||
subject = ps.getSubject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a new PatchSet id within this change.
|
||||
* <p>
|
||||
* <b>Note: This makes the change dirty. Call update() after.</b>
|
||||
*/
|
||||
public void nextPatchSetId() {
|
||||
++nbrPatchSets;
|
||||
}
|
||||
|
||||
public void updateNumberOfPatchSets(int max) {
|
||||
nbrPatchSets = Math.max(nbrPatchSets, max);
|
||||
}
|
||||
|
||||
public PatchSet.Id currPatchSetId() {
|
||||
return new PatchSet.Id(changeId, nbrPatchSets);
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return Status.forCode(status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user