patches = db.patchSets().byRevisionRange(id, id.max());
}
final Set<PatchSet.Id> matches = new HashSet<PatchSet.Id>();
for (final PatchSet ps : patches) {
final Change change = db.changes().get(ps.getId().getParentKey());
if (inProject(change)) {
matches.add(ps.getId());
}
}
switch (matches.size()) {
case 1:
return matches;
case 0:
throw error("\"" + patchIdentity + "\" no such patch set");
default:
throw error("\"" + patchIdentity + "\" matches multiple patch sets");
}
}
// By older style change,patchset?
//
if (patchIdentity.matches("^[1-9][0-9]*,[1-9][0-9]*$")) {
final PatchSet.Id patchSetId;
try {
patchSetId = PatchSet.Id.parse(patchIdentity);
} catch (IllegalArgumentException e) {
throw error("\"" + patchIdentity + "\" is not a valid patch set");
}
if (db.patchSets().get(patchSetId) == null) {
throw error("\"" + patchIdentity + "\" no such patch set");
}
if (projectControl != null) {
final Change change = db.changes().get(patchSetId.getParentKey());
if (!inProject(change)) {
throw error("change " + change.getId() + " not in project "
+ projectControl.getProject().getName());
}
}
return Collections.singleton(patchSetId);
}