RETIRED, Gerrit as used by OpenStack
Go to file
Shawn O. Pearce 8db22c85c4 Run prettify on the server using whole file contents
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>
2010-01-30 16:12:29 -08:00
Documentation Run prettify on the server using whole file contents 2010-01-30 16:12:29 -08:00
gerrit-common Run prettify on the server using whole file contents 2010-01-30 16:12:29 -08:00
gerrit-gwtdebug Cleanup Maven build by pushing component dependencies down 2009-12-30 17:19:47 -08:00
gerrit-gwtui Run prettify on the server using whole file contents 2010-01-30 16:12:29 -08:00
gerrit-httpd Run prettify on the server using whole file contents 2010-01-30 16:12:29 -08:00
gerrit-launcher Fix package-before-copyright in GerritLauncher 2009-12-30 17:19:48 -08:00
gerrit-main Fixing Eclipse settings file 2010-01-20 15:17:02 -08:00
gerrit-patch-commonsnet Cleanup Maven build by pushing component dependencies down 2009-12-30 17:19:47 -08:00
gerrit-patch-jgit Start next release development 2009-12-21 13:27:30 -08:00
gerrit-pgm Queue smart HTTP requests alongside SSH requests 2010-01-15 14:34:05 -08:00
gerrit-prettify Run prettify on the server using whole file contents 2010-01-30 16:12:29 -08:00
gerrit-reviewdb Force validation of the author and committer lines during push 2010-01-29 07:36:01 -08:00
gerrit-server Run prettify on the server using whole file contents 2010-01-30 16:12:29 -08:00
gerrit-sshd Make hooks/commit-msg available over HTTP 2010-01-29 12:48:21 -08:00
gerrit-util-cli Teach all ssh commands to stop option parsing on -- 2010-01-16 14:04:45 -08:00
gerrit-util-ssl Start next release development 2009-12-21 13:27:30 -08:00
gerrit-war Be specific about the Maven plugin groupId 2009-12-30 17:19:49 -08:00
tools Run prettify on the server using whole file contents 2010-01-30 16:12:29 -08:00
.gitignore Completely remove GerritServer.properties 2009-12-19 13:38:19 -08:00
COPYING Initial project setup of Gerrit 2 2008-11-14 16:59:34 -08:00
INSTALL Remove Gerrit 1.x to 2.x import tools 2009-03-27 20:20:10 -07:00
pom.xml Run prettify on the server using whole file contents 2010-01-30 16:12:29 -08:00
SUBMITTING_PATCHES Document how to contribute to Gerrit Code Review 2009-07-02 13:45:52 -07:00