Provide a useful body when revision parsing is ambiguous
Change-Id: I845fef6da5f0e01461f2e4be351a39170196b67b
This commit is contained in:
@@ -95,4 +95,13 @@ public class RevisionResource implements RestResource, HasETag {
|
|||||||
Optional<ChangeEdit> getEdit() {
|
Optional<ChangeEdit> getEdit() {
|
||||||
return edit;
|
return edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String s = ps.getId().toString();
|
||||||
|
if (edit.isPresent()) {
|
||||||
|
s = "edit:" + s;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
package com.google.gerrit.server.change;
|
package com.google.gerrit.server.change;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@@ -84,10 +85,16 @@ public class Revisions implements ChildCollection<ChangeResource, RevisionResour
|
|||||||
match.add(rsrc);
|
match.add(rsrc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (match.size() != 1) {
|
switch (match.size()) {
|
||||||
throw new ResourceNotFoundException(id);
|
case 0:
|
||||||
|
throw new ResourceNotFoundException(id);
|
||||||
|
case 1:
|
||||||
|
return match.get(0);
|
||||||
|
default:
|
||||||
|
throw new ResourceNotFoundException(
|
||||||
|
"Multiple patch sets for \"" + id.get() + "\": "
|
||||||
|
+ Joiner.on("; ").join(match));
|
||||||
}
|
}
|
||||||
return match.get(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean visible(ChangeResource change, PatchSet ps)
|
private boolean visible(ChangeResource change, PatchSet ps)
|
||||||
|
Reference in New Issue
Block a user