use of com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace in project gerrit by GerritCodeReview.
the class Schema_115 method toWhitespace.
private static Whitespace toWhitespace(String v) {
Preconditions.checkNotNull(v);
if (v.isEmpty()) {
return Whitespace.IGNORE_NONE;
}
Whitespace r = PatchListKey.WHITESPACE_TYPES.inverse().get(v.charAt(0));
if (r == null) {
throw new IllegalArgumentException("Cannot find Whitespace type for: " + v);
}
return r;
}
use of com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace in project gerrit by GerritCodeReview.
the class PatchListCacheImpl method getDiffSummary.
@Override
public DiffSummary getDiffSummary(Change change, PatchSet patchSet) throws PatchListNotAvailableException {
Project.NameKey project = change.getProject();
ObjectId b = ObjectId.fromString(patchSet.getRevision().get());
Whitespace ws = Whitespace.IGNORE_NONE;
return getDiffSummary(DiffSummaryKey.fromPatchListKey(PatchListKey.againstDefaultBase(b, ws)), project);
}
use of com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace in project gerrit by GerritCodeReview.
the class PatchListCacheImpl method get.
private PatchList get(Change change, PatchSet patchSet, Integer parentNum) throws PatchListNotAvailableException {
Project.NameKey project = change.getProject();
if (patchSet.getRevision() == null) {
throw new PatchListNotAvailableException("revision is null for " + patchSet.getId());
}
ObjectId b = ObjectId.fromString(patchSet.getRevision().get());
Whitespace ws = Whitespace.IGNORE_NONE;
if (parentNum != null) {
return get(PatchListKey.againstParentNum(parentNum, b, ws), project);
}
return get(PatchListKey.againstDefaultBase(b, ws), project);
}
use of com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace in project gerrit by GerritCodeReview.
the class DiffOperationsImpl method getModifiedFiles.
private ImmutableMap<String, FileDiffOutput> getModifiedFiles(DiffParameters diffParams, DiffOptions diffOptions) throws DiffNotAvailableException {
try {
Project.NameKey project = diffParams.project();
ObjectId newCommit = diffParams.newCommit();
ObjectId oldCommit = diffParams.baseCommit();
ComparisonType cmp = diffParams.comparisonType();
ImmutableList<ModifiedFile> modifiedFiles = modifiedFilesCache.get(createModifiedFilesKey(project, oldCommit, newCommit));
List<FileDiffCacheKey> fileCacheKeys = new ArrayList<>();
fileCacheKeys.add(createFileDiffCacheKey(project, oldCommit, newCommit, COMMIT_MSG, DEFAULT_DIFF_ALGORITHM, /* useTimeout= */
true, /* whitespace= */
null));
if (cmp.isAgainstAutoMerge() || isMergeAgainstParent(cmp, project, newCommit)) {
fileCacheKeys.add(createFileDiffCacheKey(project, oldCommit, newCommit, MERGE_LIST, DEFAULT_DIFF_ALGORITHM, /* useTimeout= */
true, /*whitespace = */
null));
}
if (diffParams.skipFiles() == null) {
modifiedFiles.stream().map(entity -> createFileDiffCacheKey(project, oldCommit, newCommit, entity.newPath().isPresent() ? entity.newPath().get() : entity.oldPath().get(), DEFAULT_DIFF_ALGORITHM, /* useTimeout= */
true, /* whitespace= */
null)).forEach(fileCacheKeys::add);
}
return getModifiedFilesForKeys(fileCacheKeys, diffOptions);
} catch (IOException e) {
throw new DiffNotAvailableException(e);
}
}
Aggregations