143 Commits

Author SHA1 Message Date
Dave Borowitz
1ff45113b5 Remove ReviewDb DataSource from WebAppInitializer
Change-Id: I5c5eba110b3fe6cfb9763f38ede71228e6da07f5
2018-12-20 07:00:34 -08:00
Edwin Kempin
fd94230090 Remove ReviewDb resource config from Jetty configuration
ReviewDb no longer exists.

Change-Id: If24fbcac71b5f46995b28d1f4879e23082a5e4a9
Signed-off-by: Edwin Kempin <ekempin@google.com>
2018-12-10 10:42:14 -08:00
Matthias Sohn
72d8b133e1 Fix running Gerrit on Tomcat
- WebAppInitializer moved to another package, fix that in web.xml
- fix Guice bindings in WebAppInitializer

Bug: Issue 10033
Change-Id: I2fafdd318f789db39b9c4a10bb3261efde30066c
2018-11-15 00:55:11 +00:00
David Ostrovsky
c75278248e Dissolve gerrit-war top-level directory
Change-Id: I2eaa09545e2ac8ef8f1346ab0cb203d00f811a38
2017-10-31 11:02:37 -04:00
Shawn O. Pearce
f14a1ded65 Switch build system to use Maven 2
This way we can easily depend upon other projects which also use
Maven, without needing to embed all of their dependencies directly
within our repository.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-20 17:48:48 -08:00
Shawn O. Pearce
91b1f7187a Insert a new comment editor when a patch line is double clicked
The editor currently doesn't save state, but it does insert into
the UI and the Cancel button removes it from the UI.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-19 18:58:39 -08:00
Shawn O. Pearce
79096efea0 Open/collapse comments in patches when enter or 'o' is presed on the line
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-19 17:46:21 -08:00
Shawn O. Pearce
d54c86556f Deregister all widgets before resetting a table's HTML
This way we give the widgets a chance to fire their onUnload method
and possibly perform state saving actions during the unload event.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-19 17:39:51 -08:00
Shawn O. Pearce
63762b1739 Cleanup the CSS so its more reused between diff types
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-19 17:35:24 -08:00
Shawn O. Pearce
e17ec06736 Use raw HTML to create UnifiedDiffTable, like SideBySideTable
This makes the unified display quicker, but also makes it easier to
abstract out some code that is common to the two classes and pull
that up into a common base class.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-19 17:29:19 -08:00
Shawn O. Pearce
0ca57f610f Add real side-by-side compare for 2-way diffs
The HTML for the table is built up in a string builder then
shoved in as the innerHTML property of the <tbody>. This is
significantly faster than creating DOM nodes from code.  By
this approach the rendering is almost instant; creating DOM
nodes takes over 3 seconds for some simple files.

In theory N-way diffs can also be drawn on the client side,
but the backend for the detail RPC call doesn't create the
content correctly, and hyperlinks don't exist to get into
the sidebyside mode for an N-way diff.  We may add support
for it in the future.

Sections which are ellided out by the patch (because they
are common) don't render, and there's no way to increase
the context.  We also don't honor any sort of user context
preference yet, rendering only the context that the patch
itself came out of the database with.  By default this is
5 lines.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-19 17:14:52 -08:00
Shawn O. Pearce
04d5bf98b1 Correct the off-by-one-line error with comments on unified diffs
The comments were one line higher than they should be, due to the
line number being incremented before the comment is looked up.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-19 11:49:26 -08:00
Shawn O. Pearce
ae761e6a2b Move a lot of the state for unifiedPatchDetailAction into the base
This way we can reuse the initial patch parsing, validation, and
comment indexing for all types of detailed patch actions.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-18 13:29:51 -08:00
Shawn O. Pearce
7df91dcc05 Extract unifiedPatchDetail code to make it more reusable
Much of the code (especially related to comment handling and
diff parsing) can be reuesd for different types of output,
like the N-way merge diffs or the side-by-side display.  By
extracting this to a new top-level we can hoist some code
into a common base Action class.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-18 13:21:48 -08:00
Shawn O. Pearce
91e24cb311 Highlight horziontal tab characters by showing them in patch lines
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-18 11:17:55 -08:00
Shawn O. Pearce
795d44cdff Allow "open item" (enter or 'o' keys) to open a line level comment
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-18 11:06:10 -08:00
Shawn O. Pearce
af6bde1648 Abstract out common parts of a patch detail screen's data
This way we can reuse it for side-by-side display, or any other
sort of detail we might come up with in the future.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-18 11:06:10 -08:00
Shawn O. Pearce
ba5505907e Show inline comments on the unified patch view
Comments are expanded just like on the main change screen, though
we are lacking a menu to collapse, expand or hide them.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 19:06:23 -08:00
Shawn O. Pearce
0c4786c3d5 Switch PatchLineComment's side field to be a numeric
This way we can record it as the nth file in the patch, rather
than as just left vs. right.  This facilitates comments on an
N-way diff (where N >3) such as git produces when a merge has
a conflict resolution.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 17:59:56 -08:00
Shawn O. Pearce
7ee29dbe55 Display styled unified diffs
The unified diffs are shown in a two-column table, giving us a line
cursor position in the first column and a pre-formatted hunk text in
the second column.  Styles are applied based upon the rules used in
a standard two-way diff, color-coding the lines to make it easier to
read what is displayed quickly.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 17:45:17 -08:00
Shawn O. Pearce
8c2d4bf325 Fix minor Javadoc formatting error in ChangeDetail
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 15:05:52 -08:00
Shawn O. Pearce
24f2044d79 Fix a minor formatting nit in GitwebLink
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 14:51:18 -08:00
Shawn O. Pearce
0bf5c68e9c Change our no-cache headers to match gwtjsonrpc
gwtjsonrpc now uses a fixed expire date back in the past, so its
quite clear that the entity shouldn't be cached by a proxy or
a browser.  Its also faster, as we don't have to format the date.

We also now mark must-revalidate on our Cache-Control, so a proxy
server doesn't try to serve stale content while waiting for a reply
from Gerrit.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 13:42:21 -08:00
Shawn O. Pearce
a7a24006a5 Show the source file path in the patch set table on copy/renames
This way its a little easier to figure out the origin of any file
that has a status of R and C just by glancing at the patch table.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 13:42:19 -08:00
Shawn O. Pearce
637e12bdc6 Add ancestor revision update to PatchSetImporter
These are necessary for new PatchSet entities, where none of the parent
links are in the database.  But we can update them too when we build an
update for an existing patch set.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 13:42:17 -08:00
Shawn O. Pearce
79de1e48ca Use JGit's progress meter interface instead of our own
Its cleaner to just reuse the code that JGit already has for
outputting progress messages to stderr than to roll our own.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-17 12:23:00 -08:00
Shawn O. Pearce
84f5b84cab Automatically resize and center dialogs when the window changes
We resize and reposition dialogs automatically when the parent
window resizes, so the iframe's scrollbars will enable if the
parent window is not big enough to show the entire iframe at once,
rather than making the user scroll the parent window.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 21:30:49 -08:00
Shawn O. Pearce
7782f742c4 Fix the link menu items to use a pointer/hand cursor like normal links
The user should be able to click on these, so make it look like that is
the proper action by changing the cursor.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 21:06:19 -08:00
Shawn O. Pearce
a248e34309 Fix invalid <style> tag in host page so it works in Mac OS X hosted mode
The hosted mode Safari browser doesn't recognize a <style> tag that
isn't closed with </style>.  It stops parsing the page and just shows
nothing at all, so we have to construct the page as valid HTML.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 20:58:15 -08:00
Shawn O. Pearce
23a9c3af9f Only show side-by-side links if the patch is a pure unified diff
Binary diffs can't show a side-by-side because we cannot show
the binary content on the web page, it might be unsafe for a
browser to show or simply not viewable over the web.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 18:29:29 -08:00
Shawn O. Pearce
38270b642d Import all patch data again from Git to ensure it is accurate
We've made some schema changes about how patch data is stored and
represented in the Gerrit 2 database, so we need to import all of
the patch entities over again.  This change includes a CLI tool
that can be run to re-import one or more patch set entities from
the corresponding Git commit.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 18:25:12 -08:00
Shawn O. Pearce
583b353040 Add PatchContent to store the uncompressed content of a patch
This allows us to precompute patches from Git and write them
into the database for efficient access.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 16:14:49 -08:00
Shawn O. Pearce
403fec416a Add patch type and source file name to Patch entity
We need these in order to quickly determine what the patch
for this entity looks like, so we can produce the right
style of hyperlinks on its row.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 15:47:55 -08:00
Shawn O. Pearce
43a6d6e4a9 Introduce RevId as an abstraction around revision strings
This may make it easier to replace Git with some other tool like
Hg or SVN, but it also offers us a convenient way to abstract the
data type and improve type safety within Gerrit's code tree.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 15:36:21 -08:00
Shawn O. Pearce
c4a3825d08 Add the default project path for our Git RepositoryCache to SystemConfig
We need a base directory that all projects live below.  If the
project exists here as a Git repository then it is available
for changes to be reviewed in.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 15:01:49 -08:00
Shawn O. Pearce
ae70290231 Import RepositoryCache from Gerrit 1 mgrapp
This is the exact code used by Gerrit 1 in its mgrapp to cache
JGit Repository handles, only I've moved its package name to
conform better with Gerrit 2's conventions.

Taken from b4a05fbced23d75525b9f349a70e681887c04767.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 14:52:47 -08:00
Shawn O. Pearce
5f95e2d5db Add JGit to the build path so we can access Git repositories
This gives us server-side access to Git repositories,
without forking external processes.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-12 14:44:43 -08:00
Shawn O. Pearce
6bb6756866 Show the depends on and needed by lists on a change page
The lists are automatically expanded open if there is a
dependency which is not yet merged and we are still open.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 19:29:01 -08:00
Shawn O. Pearce
4f5706fc6b Handle NotSignedIn errors gracefully during module load
If we get back a NotSignedIn exception we should whack the cookie
that lead us to believe we might be signed in, and not log error.
This fix really only matters in the hosted debug console, where
the error is somewhat common if you reinitialize your data store.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 18:54:26 -08:00
Shawn O. Pearce
c6b0961e73 Simplify formatting of whoAmI in Gerrit
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 18:52:51 -08:00
Shawn O. Pearce
542a63f766 Use StringBuilder instead of StringBuffer when possible
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 18:30:51 -08:00
Shawn O. Pearce
4fe765388e Request that overflowing change subjects use "..." when possible
If a subject line overflows what the browser can accept for the
field we want it to clip the value and optionally insert "..."
at the end of the text, if the browser supports that CSS mode
(IE does).

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 18:30:51 -08:00
Shawn O. Pearce
1b260c47bc Misc. stylesheet formatting cleanups
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 18:30:51 -08:00
Shawn O. Pearce
ca252aa281 Don't allow user names to be wrapped in account links
Breaking someone's name in the middle looks pretty bad, even if
the line wrapping is what the browser wants.  This is because
in nearly all cases the name is shown in a table cell where we
really want one line per account.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 18:30:44 -08:00
Shawn O. Pearce
24566e4b58 Add messages to the change detail screen
The message content is an overall remark about the change.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 16:13:01 -08:00
Shawn O. Pearce
386b6862ee Fix ComplexDisclosurePanel widget containment to be proper GWT style
We need to make sure our widgets are contained in their parent,
and so on up the graph.  Just connecting things in DOM may not be
enough for GWT widgets to be completely happy.

Also fixed layout problems related to the 2nd header column moving
back and forth when the width of the content panel changed as it was
expanded and populated.  By forcing the width of the first column to
be a fixed width we can ensure the 2nd header column gets any extra
table width when the disclose panel expands to show its full content.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 16:13:01 -08:00
Shawn O. Pearce
dcf792d0c0 Mark all servlets as load-on-startup
This way the database is initialized during web application context
startup and not during the first query, reducing the latency of the
first incoming request.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 16:13:01 -08:00
Shawn O. Pearce
8f36dc9e46 Fix the primary key declaration for AccountAccess
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-08 16:13:01 -08:00
Shawn O. Pearce
59ee46c677 Cleanup formatting on Firefox 2, 3 and Safari
The sign in dialog wasn't quite tall enough, now it is.  But its
far too large for the Android web browser.

The change info block is now folded up with the description, fixing
the layout problems it was having on Firefox 3 where it forced the
description down lower on the page, and on Firefox 2 when the window
was too narrow.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-04 19:15:42 -08:00
Shawn O. Pearce
f1fe3367a0 Define a basic display of the patches in a patch set
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-12-04 18:38:09 -08:00