ChangeData: Rename patches to patch sets
These are different things, and ChangeData is using PatchSets rather than Patches in this case. Change-Id: I42d4611b34c9cefc487833bfe50c0b209b131d70
This commit is contained in:
parent
444a3e6aae
commit
956b9cf4fd
@ -71,7 +71,7 @@ public class DeleteDraftPatchSetIT extends AbstractDaemonTest {
|
|||||||
assertThat(c.status).isEqualTo(ChangeStatus.DRAFT);
|
assertThat(c.status).isEqualTo(ChangeStatus.DRAFT);
|
||||||
RestResponse r = deletePatchSet(changeId, ps, adminSession);
|
RestResponse r = deletePatchSet(changeId, ps, adminSession);
|
||||||
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_NO_CONTENT);
|
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_NO_CONTENT);
|
||||||
assertThat(getChange(changeId).patches()).hasSize(1);
|
assertThat(getChange(changeId).patchSets()).hasSize(1);
|
||||||
ps = getCurrentPatchSet(changeId);
|
ps = getCurrentPatchSet(changeId);
|
||||||
r = deletePatchSet(changeId, ps, adminSession);
|
r = deletePatchSet(changeId, ps, adminSession);
|
||||||
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_NO_CONTENT);
|
assertThat(r.getStatusCode()).isEqualTo(HttpStatus.SC_NO_CONTENT);
|
||||||
|
@ -142,7 +142,7 @@ public class ApprovalCopier {
|
|||||||
|
|
||||||
private static TreeMap<Integer, PatchSet> getPatchSets(ChangeData cd)
|
private static TreeMap<Integer, PatchSet> getPatchSets(ChangeData cd)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Collection<PatchSet> patchSets = cd.patches();
|
Collection<PatchSet> patchSets = cd.patchSets();
|
||||||
TreeMap<Integer, PatchSet> result = Maps.newTreeMap();
|
TreeMap<Integer, PatchSet> result = Maps.newTreeMap();
|
||||||
for (PatchSet ps : patchSets) {
|
for (PatchSet ps : patchSets) {
|
||||||
result.put(ps.getId().get(), ps);
|
result.put(ps.getId().get(), ps);
|
||||||
|
@ -863,11 +863,11 @@ public class ChangeJson {
|
|||||||
Optional<PatchSet.Id> limitToPsId) throws OrmException {
|
Optional<PatchSet.Id> limitToPsId) throws OrmException {
|
||||||
Collection<PatchSet> src;
|
Collection<PatchSet> src;
|
||||||
if (has(ALL_REVISIONS) || has(MESSAGES)) {
|
if (has(ALL_REVISIONS) || has(MESSAGES)) {
|
||||||
src = cd.patches();
|
src = cd.patchSets();
|
||||||
} else {
|
} else {
|
||||||
PatchSet ps;
|
PatchSet ps;
|
||||||
if (limitToPsId.isPresent()) {
|
if (limitToPsId.isPresent()) {
|
||||||
ps = cd.patch(limitToPsId.get());
|
ps = cd.patchSet(limitToPsId.get());
|
||||||
if (ps == null) {
|
if (ps == null) {
|
||||||
throw new OrmException("missing patch set " + limitToPsId.get());
|
throw new OrmException("missing patch set " + limitToPsId.get());
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ public class ChangeKindCacheImpl implements ChangeKindCache {
|
|||||||
repo = repoManager.openRepository(change.getProject());
|
repo = repoManager.openRepository(change.getProject());
|
||||||
|
|
||||||
ChangeData cd = changeDataFactory.create(db, change);
|
ChangeData cd = changeDataFactory.create(db, change);
|
||||||
Collection<PatchSet> patchSetCollection = cd.patches();
|
Collection<PatchSet> patchSetCollection = cd.patchSets();
|
||||||
PatchSet priorPs = patch;
|
PatchSet priorPs = patch;
|
||||||
for (PatchSet ps : patchSetCollection) {
|
for (PatchSet ps : patchSetCollection) {
|
||||||
if (ps.getId().get() < patch.getId().get() &&
|
if (ps.getId().get() < patch.getId().get() &&
|
||||||
|
@ -144,7 +144,7 @@ public class GetRelated implements RestReadView<RevisionResource> {
|
|||||||
Map<PatchSet.Id, PatchSet> r =
|
Map<PatchSet.Id, PatchSet> r =
|
||||||
Maps.newHashMapWithExpectedSize(cds.size() * 2);
|
Maps.newHashMapWithExpectedSize(cds.size() * 2);
|
||||||
for (ChangeData cd : cds) {
|
for (ChangeData cd : cds) {
|
||||||
for (PatchSet p : cd.patches()) {
|
for (PatchSet p : cd.patchSets()) {
|
||||||
r.put(p.getId(), p);
|
r.put(p.getId(), p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ public class ChangeField {
|
|||||||
public Iterable<String> get(ChangeData input, FillArgs args)
|
public Iterable<String> get(ChangeData input, FillArgs args)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
Set<String> revisions = Sets.newHashSet();
|
Set<String> revisions = Sets.newHashSet();
|
||||||
for (PatchSet ps : input.patches()) {
|
for (PatchSet ps : input.patchSets()) {
|
||||||
if (ps.getRevision() != null) {
|
if (ps.getRevision() != null) {
|
||||||
revisions.add(ps.getRevision().get());
|
revisions.add(ps.getRevision().get());
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public class ChangeData {
|
|||||||
public static void ensureAllPatchSetsLoaded(Iterable<ChangeData> changes)
|
public static void ensureAllPatchSetsLoaded(Iterable<ChangeData> changes)
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
for (ChangeData cd : changes) {
|
for (ChangeData cd : changes) {
|
||||||
cd.patches();
|
cd.patchSets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ public class ChangeData {
|
|||||||
throws OrmException {
|
throws OrmException {
|
||||||
Map<PatchSet.Id, ChangeData> missing = Maps.newHashMap();
|
Map<PatchSet.Id, ChangeData> missing = Maps.newHashMap();
|
||||||
for (ChangeData cd : changes) {
|
for (ChangeData cd : changes) {
|
||||||
if (cd.currentPatchSet == null && cd.patches == null) {
|
if (cd.currentPatchSet == null && cd.patchSets == null) {
|
||||||
missing.put(cd.change().currentPatchSetId(), cd);
|
missing.put(cd.change().currentPatchSetId(), cd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ public class ChangeData {
|
|||||||
private String commitMessage;
|
private String commitMessage;
|
||||||
private List<FooterLine> commitFooters;
|
private List<FooterLine> commitFooters;
|
||||||
private PatchSet currentPatchSet;
|
private PatchSet currentPatchSet;
|
||||||
private Collection<PatchSet> patches;
|
private Collection<PatchSet> patchSets;
|
||||||
private ListMultimap<PatchSet.Id, PatchSetApproval> allApprovals;
|
private ListMultimap<PatchSet.Id, PatchSetApproval> allApprovals;
|
||||||
private List<PatchSetApproval> currentApprovals;
|
private List<PatchSetApproval> currentApprovals;
|
||||||
private Map<Integer, List<String>> files = new HashMap<>();
|
private Map<Integer, List<String>> files = new HashMap<>();
|
||||||
@ -468,7 +468,7 @@ public class ChangeData {
|
|||||||
if (c == null) {
|
if (c == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (PatchSet p : patches()) {
|
for (PatchSet p : patchSets()) {
|
||||||
if (p.getId().equals(c.currentPatchSetId())) {
|
if (p.getId().equals(c.currentPatchSetId())) {
|
||||||
currentPatchSet = p;
|
currentPatchSet = p;
|
||||||
return p;
|
return p;
|
||||||
@ -536,23 +536,23 @@ public class ChangeData {
|
|||||||
* @return patches for the change.
|
* @return patches for the change.
|
||||||
* @throws OrmException an error occurred reading the database.
|
* @throws OrmException an error occurred reading the database.
|
||||||
*/
|
*/
|
||||||
public Collection<PatchSet> patches()
|
public Collection<PatchSet> patchSets()
|
||||||
throws OrmException {
|
throws OrmException {
|
||||||
if (patches == null) {
|
if (patchSets == null) {
|
||||||
patches = db.patchSets().byChange(legacyId).toList();
|
patchSets = db.patchSets().byChange(legacyId).toList();
|
||||||
}
|
}
|
||||||
return patches;
|
return patchSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return patch with the given ID, or null if it does not exist.
|
* @return patch set with the given ID, or null if it does not exist.
|
||||||
* @throws OrmException an error occurred reading the database.
|
* @throws OrmException an error occurred reading the database.
|
||||||
*/
|
*/
|
||||||
public PatchSet patch(PatchSet.Id psId) throws OrmException {
|
public PatchSet patchSet(PatchSet.Id psId) throws OrmException {
|
||||||
if (currentPatchSet != null && currentPatchSet.getId().equals(psId)) {
|
if (currentPatchSet != null && currentPatchSet.getId().equals(psId)) {
|
||||||
return currentPatchSet;
|
return currentPatchSet;
|
||||||
}
|
}
|
||||||
for (PatchSet ps : patches()) {
|
for (PatchSet ps : patchSets()) {
|
||||||
if (ps.getId().equals(psId)) {
|
if (ps.getId().equals(psId)) {
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class CommitPredicate extends IndexPredicate<ChangeData> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(final ChangeData object) throws OrmException {
|
public boolean match(final ChangeData object) throws OrmException {
|
||||||
for (PatchSet p : object.patches()) {
|
for (PatchSet p : object.patchSets()) {
|
||||||
if (p.getRevision() != null && p.getRevision().get() != null) {
|
if (p.getRevision() != null && p.getRevision().get() != null) {
|
||||||
final ObjectId id = ObjectId.fromString(p.getRevision().get());
|
final ObjectId id = ObjectId.fromString(p.getRevision().get());
|
||||||
if (abbrevId.prefixCompare(id) == 0) {
|
if (abbrevId.prefixCompare(id) == 0) {
|
||||||
|
@ -209,11 +209,11 @@ public class OutputStreamQuery {
|
|||||||
|
|
||||||
if (includePatchSets) {
|
if (includePatchSets) {
|
||||||
if (includeFiles) {
|
if (includeFiles) {
|
||||||
eventFactory.addPatchSets(c, d.patches(),
|
eventFactory.addPatchSets(c, d.patchSets(),
|
||||||
includeApprovals ? d.approvals().asMap() : null,
|
includeApprovals ? d.approvals().asMap() : null,
|
||||||
includeFiles, d.change(), labelTypes);
|
includeFiles, d.change(), labelTypes);
|
||||||
} else {
|
} else {
|
||||||
eventFactory.addPatchSets(c, d.patches(),
|
eventFactory.addPatchSets(c, d.patchSets(),
|
||||||
includeApprovals ? d.approvals().asMap() : null,
|
includeApprovals ? d.approvals().asMap() : null,
|
||||||
labelTypes);
|
labelTypes);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user