Merge "Revert "Reject inline comments on files that do not exist in the patch set""
This commit is contained in:
@@ -62,7 +62,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -173,7 +172,7 @@ public class ChangeData {
|
||||
private Collection<PatchSet> patches;
|
||||
private ListMultimap<PatchSet.Id, PatchSetApproval> allApprovals;
|
||||
private List<PatchSetApproval> currentApprovals;
|
||||
private Map<Integer, List<String>> files = new HashMap<>();
|
||||
private List<String> currentFiles;
|
||||
private Collection<PatchLineComment> comments;
|
||||
private CurrentUser visibleTo;
|
||||
private ChangeControl changeControl;
|
||||
@@ -259,35 +258,27 @@ public class ChangeData {
|
||||
returnedBySource = s;
|
||||
}
|
||||
|
||||
public void setCurrentFilePaths(List<String> filePaths) throws OrmException {
|
||||
PatchSet ps = currentPatchSet();
|
||||
if (ps != null) {
|
||||
files.put(ps.getPatchSetId(), ImmutableList.copyOf(filePaths));
|
||||
}
|
||||
public void setCurrentFilePaths(List<String> filePaths) {
|
||||
currentFiles = ImmutableList.copyOf(filePaths);
|
||||
}
|
||||
|
||||
public List<String> currentFilePaths() throws OrmException {
|
||||
PatchSet ps = currentPatchSet();
|
||||
if (ps == null) {
|
||||
return null;
|
||||
}
|
||||
return filePaths(currentPatchSet);
|
||||
}
|
||||
|
||||
public List<String> filePaths(PatchSet ps) throws OrmException {
|
||||
if (!files.containsKey(ps.getPatchSetId())) {
|
||||
if (currentFiles == null) {
|
||||
Change c = change();
|
||||
if (c == null) {
|
||||
return null;
|
||||
}
|
||||
PatchSet ps = currentPatchSet();
|
||||
if (ps == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PatchList p;
|
||||
try {
|
||||
p = patchListCache.get(c, ps);
|
||||
} catch (PatchListNotAvailableException e) {
|
||||
List<String> emptyFileList = Collections.emptyList();
|
||||
files.put(ps.getPatchSetId(), emptyFileList);
|
||||
return emptyFileList;
|
||||
currentFiles = Collections.emptyList();
|
||||
return currentFiles;
|
||||
}
|
||||
|
||||
List<String> r = new ArrayList<>(p.getPatches().size());
|
||||
@@ -311,9 +302,9 @@ public class ChangeData {
|
||||
}
|
||||
}
|
||||
Collections.sort(r);
|
||||
files.put(ps.getPatchSetId(), Collections.unmodifiableList(r));
|
||||
currentFiles = Collections.unmodifiableList(r);
|
||||
}
|
||||
return files.get(ps.getPatchSetId());
|
||||
return currentFiles;
|
||||
}
|
||||
|
||||
public ChangedLines changedLines() throws OrmException {
|
||||
|
||||
Reference in New Issue
Block a user