return args.settings.includeDiff;
}
/** Show patch set as unified difference. */
public String getUnifiedDiff() {
PatchList patchList;
try {
patchList = getPatchList();
if (patchList.getOldId() == null) {
// Octopus merges are not well supported for diff output by Gerrit.
// Currently these always have a null oldId in the PatchList.
return "";
}
} catch (PatchListNotAvailableException e) {
log.error("Cannot format patch", e);
return "";
}
TemporaryBuffer.Heap buf =
new TemporaryBuffer.Heap(args.settings.maximumDiffSize);
DiffFormatter fmt = new DiffFormatter(buf);
Repository git;
try {
git = args.server.openRepository(change.getProject());
} catch (IOException e) {
log.error("Cannot open repository to format patch", e);
return "";
}
try {
fmt.setRepository(git);
fmt.setDetectRenames(true);
fmt.format(patchList.getOldId(), patchList.getNewId());
return RawParseUtils.decode(buf.toByteArray());
} catch (IOException e) {
if (JGitText.get().inMemoryBufferLimitExceeded.equals(e.getMessage())) {
return "";
}