Distinguish between error and timeout in intraline diff error message

When the intraline diff fails, the error message simply says that
there was a server error.  It could be that the reason for failure
is a timeout, but it's not possible to know this from the error
message.

Add a new error message that is displayed when the intraline diff
fails due to timeout.

Also update the documentation to mention that an error message is
displayed if the intraline diff times out.

Change-Id: I93410d853aadc7ed1f6e4324d0578c4bcbe4e195
This commit is contained in:
David Pursehouse 2013-04-17 17:18:43 +09:00
parent e4568a2c8b
commit 4467d2a098
6 changed files with 26 additions and 5 deletions

View File

@ -648,8 +648,11 @@ cache.diff_intraline.timeout::
Maximum number of milliseconds to wait for intraline difference data
before giving up and disabling it for a particular file pair. This is
a work around for an infinite loop bug in the intraline difference
implementation. If computation takes longer than the timeout the
worker thread is terminated and no intraline difference is displayed.
implementation.
+
If computation takes longer than the timeout, the worker thread is
terminated, an error message is shown, and no intraline difference is
displayed for the file pair.
+
Values should use common unit suffixes to express their setting:
+

View File

@ -53,6 +53,7 @@ public class PatchScript {
protected boolean hugeFile;
protected boolean intralineDifference;
protected boolean intralineFailure;
protected boolean intralineTimeout;
public PatchScript(final Change.Key ck, final ChangeType ct, final String on,
final String nn, final FileMode om, final FileMode nm,
@ -60,7 +61,7 @@ public class PatchScript {
final SparseFileContent ca, final SparseFileContent cb,
final List<Edit> e, final DisplayMethod ma, final DisplayMethod mb,
final CommentDetail cd, final List<Patch> hist, final boolean hf,
final boolean id, final boolean idf) {
final boolean id, final boolean idf, final boolean idt) {
changeId = ck;
changeType = ct;
oldName = on;
@ -79,6 +80,7 @@ public class PatchScript {
hugeFile = hf;
intralineDifference = id;
intralineFailure = idf;
intralineTimeout = idt;
}
protected PatchScript() {
@ -152,6 +154,10 @@ public class PatchScript {
return intralineFailure;
}
public boolean hasIntralineTimeout() {
return intralineTimeout;
}
public boolean isExpandAllComments() {
return diffPrefs.isExpandAllComments();
}

View File

@ -36,6 +36,7 @@ public interface PatchConstants extends Constants {
String patchHistoryTitle();
String disabledOnLargeFiles();
String intralineFailure();
String intralineTimeout();
String illegalNumberOfColumns();
String upToChange();

View File

@ -18,6 +18,7 @@ patchHistoryTitle = Patch History
patchSet = Patch Set
disabledOnLargeFiles = Disabled on very large source files.
intralineFailure = Intraline difference not available due to server error.
intralineTimeout = Intraline difference not available due to timeout.
illegalNumberOfColumns = The number of columns cannot be zero or negative
upToChange = Up to change

View File

@ -120,6 +120,7 @@ public abstract class PatchScreen extends Screen implements
private HandlerRegistration regNavigation;
private HandlerRegistration regAction;
private boolean intralineFailure;
private boolean intralineTimeout;
/**
* How this patch should be displayed in the patch screen.
@ -468,6 +469,7 @@ public abstract class PatchScreen extends Screen implements
}
intralineFailure = isFirst && script.hasIntralineFailure();
intralineTimeout = isFirst && script.hasIntralineTimeout();
}
@Override
@ -476,6 +478,9 @@ public abstract class PatchScreen extends Screen implements
if (intralineFailure) {
intralineFailure = false;
new ErrorDialog(PatchUtil.C.intralineFailure()).show();
} else if (intralineTimeout) {
intralineTimeout = false;
new ErrorDialog(PatchUtil.C.intralineTimeout()).show();
}
if (topView != null && prefs.get().isRetainHeader()) {
setTopView(topView);

View File

@ -133,6 +133,7 @@ class PatchScriptBuilder {
throws IOException {
boolean intralineDifferenceIsPossible = true;
boolean intralineFailure = false;
boolean intralineTimeout = false;
a.path = oldName(content);
b.path = newName(content);
@ -160,10 +161,14 @@ class PatchScriptBuilder {
break;
case ERROR:
case TIMEOUT:
intralineDifferenceIsPossible = false;
intralineFailure = true;
break;
case TIMEOUT:
intralineDifferenceIsPossible = false;
intralineTimeout = true;
break;
}
} else {
intralineDifferenceIsPossible = false;
@ -212,7 +217,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,
intralineDifferenceIsPossible, intralineFailure);
intralineDifferenceIsPossible, intralineFailure, intralineTimeout);
}
private static boolean isModify(PatchListEntry content) {