RETIRED, Gerrit as used by OpenStack
8db22c85c4
By executing prettify over the entire file contents, rather than on a single line at a time, we can be certain that multi-line comments and strings are rendered correctly all of the time, even if it starts or ends within a hidden context region. With this change we move prettify to run only on the server, within the Mozilla Rhino JavaScript engine, and send to the client only fully formatted HTML line arrays for the two files. Like before, the server only sends partial arrays, letting the client piece it all together at display time. In a future commit I plan to have the client format the file if we are showing all lines from both sides. This way the RPC response payload is smaller, and the server can offload the parsing and formatting load to some clients. While writing this change I considered using Pygments running inside of Jython, but chose to stick with prettify in Rhino. Pygments ran much slower for the same small file contents, and doesn't leave us with the option to execute formatting on the client side. As part of this change we now use the Mozilla chardet library to detect the character set of the file contents we are about to render as HTML. The chardet library is the same logic used inside of the Mozilla browser family to detect the character set when it isn't specified... so its pretty accurate for a wide range of files. In the future we should also start to honor .gitattributes to get the encoding. Bug: issue 250 Bug: issue 251 Change-Id: I155bb7abc560f01a3597b3be678a76a5aa7f9e68 Signed-off-by: Shawn O. Pearce <sop@google.com> |
||
---|---|---|
Documentation | ||
gerrit-common | ||
gerrit-gwtdebug | ||
gerrit-gwtui | ||
gerrit-httpd | ||
gerrit-launcher | ||
gerrit-main | ||
gerrit-patch-commonsnet | ||
gerrit-patch-jgit | ||
gerrit-pgm | ||
gerrit-prettify | ||
gerrit-reviewdb | ||
gerrit-server | ||
gerrit-sshd | ||
gerrit-util-cli | ||
gerrit-util-ssl | ||
gerrit-war | ||
tools | ||
.gitignore | ||
COPYING | ||
INSTALL | ||
pom.xml | ||
SUBMITTING_PATCHES |