Fix rendering of change edits in change and diff screens
During recent refactoring in I2d961f8d and I7ef198dd rendering of change edits in change and diff screens was broken. Two REST handlers return 404 now: * GET /changes/<change-id>/revisions/<revision-id>/files * GET /changes/<change-id>/revisions/<revision-id>/files/<name>/diff Rectify it by restoring the removed code. Test Plan: * Upload change or create change edit online * Modify one existing or add new file * Save changes in editor * Reload the change * Open the modified file in diff screen Change-Id: I8ac1b811d3385ce8c21f563cfa1b30fe81467ea0
This commit is contained in:
		 David Ostrovsky
					David Ostrovsky
				
			
				
					committed by
					
						 Dave Borowitz
						Dave Borowitz
					
				
			
			
				
	
			
			
			 Dave Borowitz
						Dave Borowitz
					
				
			
						parent
						
							39f7907b72
						
					
				
				
					commit
					dc189e0df0
				
			| @@ -120,6 +120,10 @@ public class Revisions implements ChildCollection<ChangeResource, RevisionResour | |||||||
|           out.add(new RevisionResource(change, ps)); |           out.add(new RevisionResource(change, ps)); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |       // Not an existing patch set on a change, but might be an edit. | ||||||
|  |       if (out.isEmpty() && id.length() == RevId.LEN) { | ||||||
|  |         return loadEdit(change, new RevId(id)); | ||||||
|  |       } | ||||||
|       return out; |       return out; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -159,7 +159,9 @@ public class PatchScriptFactory implements Callable<PatchScript> { | |||||||
|  |  | ||||||
|     PatchSet psEntityA = psa != null |     PatchSet psEntityA = psa != null | ||||||
|         ? psUtil.get(db, control.getNotes(), psa) : null; |         ? psUtil.get(db, control.getNotes(), psa) : null; | ||||||
|     PatchSet psEntityB = psUtil.get(db, control.getNotes(), psb); |     PatchSet psEntityB = psb.get() == 0 | ||||||
|  |         ? new PatchSet(psb) | ||||||
|  |         : psUtil.get(db, control.getNotes(), psb); | ||||||
|  |  | ||||||
|     aId = psEntityA != null ? toObjectId(psEntityA) : null; |     aId = psEntityA != null ? toObjectId(psEntityA) : null; | ||||||
|     bId = toObjectId(psEntityB); |     bId = toObjectId(psEntityB); | ||||||
| @@ -218,13 +220,12 @@ public class PatchScriptFactory implements Callable<PatchScript> { | |||||||
|  |  | ||||||
|   private ObjectId toObjectId(PatchSet ps) throws NoSuchChangeException, |   private ObjectId toObjectId(PatchSet ps) throws NoSuchChangeException, | ||||||
|       AuthException, NoSuchChangeException, IOException { |       AuthException, NoSuchChangeException, IOException { | ||||||
|     if (ps == null || ps.getRevision() == null |  | ||||||
|         || ps.getRevision().get() == null) { |  | ||||||
|       throw new NoSuchChangeException(changeId); |  | ||||||
|     } |  | ||||||
|     if (ps.getId().get() == 0) { |     if (ps.getId().get() == 0) { | ||||||
|       return getEditRev(); |       return getEditRev(); | ||||||
|     } |     } | ||||||
|  |     if (ps.getRevision() == null || ps.getRevision().get() == null) { | ||||||
|  |       throw new NoSuchChangeException(changeId); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     try { |     try { | ||||||
|       return ObjectId.fromString(ps.getRevision().get()); |       return ObjectId.fromString(ps.getRevision().get()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user