Fix disabled intraline difference checkbox

If the user preference had intraline difference disabled, they
couldn't enable it again because the flag was already false and
the checkbox was disabled under the assumption that intraline was
disabled because of a server failure.

Instead only disable the checkbox when its actually off due to a
server problem, and leave it enabled if the server might be able
to do the intraline difference for this file.

Change-Id: I22dd428e7dccace51a3c07230e115e9dd674fb30
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce 2010-12-10 17:04:30 -08:00
parent 0979e9059c
commit 61c209c889

View File

@ -131,7 +131,7 @@ class PatchScriptBuilder {
private PatchScript build(final PatchListEntry content,
final CommentDetail comments, final List<Patch> history)
throws IOException {
boolean intralineDifference = diffPrefs.isIntralineDifference();
boolean intralineDifferenceIsPossible = true;
boolean intralineFailure = false;
a.path = oldName(content);
@ -142,7 +142,9 @@ class PatchScriptBuilder {
edits = new ArrayList<Edit>(content.getEdits());
if (intralineDifference && isModify(content)) {
if (!isModify(content)) {
intralineDifferenceIsPossible = false;
} else if (diffPrefs.isIntralineDifference()) {
IntraLineDiff d =
patchListCache.getIntraLineDiff(new IntraLineDiffKey(a.id, a.src,
b.id, b.src, edits, projectKey, bId, b.path));
@ -153,17 +155,17 @@ class PatchScriptBuilder {
break;
case DISABLED:
intralineDifference = false;
intralineDifferenceIsPossible = false;
break;
case ERROR:
case TIMEOUT:
intralineDifference = false;
intralineDifferenceIsPossible = false;
intralineFailure = true;
break;
}
} else {
intralineDifference = false;
intralineDifferenceIsPossible = false;
intralineFailure = true;
}
}
@ -209,7 +211,7 @@ class PatchScriptBuilder {
content.getOldName(), content.getNewName(), a.fileMode, b.fileMode,
content.getHeaderLines(), diffPrefs, a.dst, b.dst, edits,
a.displayMethod, b.displayMethod, comments, history, hugeFile,
intralineDifference, intralineFailure);
intralineDifferenceIsPossible, intralineFailure);
}
private static boolean isModify(PatchListEntry content) {