Allow large patches to function reasonably in diffs

This allows extremely large patches to function in the diff view
reasonably.  ChangeScreen doesn't like expanding a large number
of lines at once, so the maximum context is still limited, and
every JavaScript engine but Chrome is extremely slow when running
Prettify over a large patch.  CodeMirror doesn't have these same
issues, so the changes are not applied to ChangeScreen2.  Because
CodeMirror expects the whole file context to be available, this
fixes the behavior of large patches with ChangeScreen2.

Bug: Issue 1233
Bug: Issue 2166
Change-Id: Idcb6991ccba41d4139aa85014eef496f9f2c035c
This commit is contained in:
Doug Kelly
2013-10-04 18:23:09 -05:00
parent ea2272ce36
commit 0b2f09be68
4 changed files with 52 additions and 22 deletions

View File

@@ -193,18 +193,16 @@ class PatchScriptBuilder {
// IF the file is really large, we disable things to avoid choking
// the browser client.
//
diffPrefs.setContext((short) Math.min(25, context));
diffPrefs.setSyntaxHighlighting(false);
context = diffPrefs.getContext();
hugeFile = true;
} else {
// In order to expand the skipped common lines or syntax highlight the
// file properly we need to give the client the complete file contents.
// So force our context temporarily to the complete file size.
//
context = MAX_CONTEXT;
}
// In order to expand the skipped common lines or syntax highlight the
// file properly we need to give the client the complete file contents.
// So force our context temporarily to the complete file size.
//
context = MAX_CONTEXT;
packContent(diffPrefs.getIgnoreWhitespace() != Whitespace.IGNORE_NONE);
}