Fix diff view for files in change edit

If a change edit is viewed in the change screen and the change screen
is not in edit mode, then clicking on any file in the file list
results in a not found screen. This is because the client makes
requests to the server where 'edit' is used as revision and the server
cannot resolve this revision. Other edit-related requests use '0' as
revision for change edits and those succeed.

Fix this by supporting 'edit' as revision for change edits.

Also document '0' and 'edit' as possible values for revision-id.

Change-Id: If93894b330e0c7942a94a532eca84a73a84b06f5
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-09-15 15:53:37 +02:00
parent 1e1a37670c
commit 8cc0babfda
3 changed files with 13 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ public class Revisions implements ChildCollection<ChangeResource, RevisionResour
private List<RevisionResource> find(ChangeResource change, String id)
throws OrmException, IOException, AuthException {
if (id.equals("0")) {
if (id.equals("0") || id.equals("edit")) {
return loadEdit(change, null);
} else if (id.length() < 6 && id.matches("^[1-9][0-9]{0,4}$")) {
// Legacy patch set number syntax.