Merge branch 'stable-2.8'
* stable-2.8:
Restore pom.xml for gerrit-plugin-gwtui
Generate javadoc for gerrit-plugin-gwtui
The version in gerrit-plugin-gwtui/pom.xml is updated to 2.9-SNAPSHOT.
Change-Id: I580c1dff33609bfbff923f381c40326cb048b5f9
diff --git a/BUCK b/BUCK
index 616a0fe..3d1541c 100644
--- a/BUCK
+++ b/BUCK
@@ -3,8 +3,8 @@
gerrit_war(name = 'gerrit')
gerrit_war(name = 'chrome', ui = 'ui_chrome')
gerrit_war(name = 'firefox', ui = 'ui_firefox')
-gerrit_war(name = 'withdocs', context = DOCS)
-gerrit_war(name = 'release', context = DOCS + ['//plugins:core.zip'])
+gerrit_war(name = 'withdocs', docs = True)
+gerrit_war(name = 'release', docs = True, context = ['//plugins:core.zip'])
API_DEPS = [
':extension-api',
diff --git a/Documentation/BUCK b/Documentation/BUCK
index 71d8664..b2b7d2a 100644
--- a/Documentation/BUCK
+++ b/Documentation/BUCK
@@ -3,7 +3,6 @@
include_defs('//tools/git.defs')
DOC_DIR = 'Documentation'
-INDEX_DIR = DOC_DIR + '/.index'
MAIN = ['//gerrit-pgm:pgm', '//gerrit-gwtui:ui_module']
SRCS = glob(['*.txt'], excludes = ['licenses.txt'])
@@ -11,12 +10,10 @@
name = 'html',
cmd = 'cd $TMP;' +
'mkdir -p %s/images;' % DOC_DIR +
- 'unzip -q $SRCDIR/index.zip -d %s/;' % INDEX_DIR +
'unzip -q $SRCDIR/only_html.zip -d %s/;' % DOC_DIR +
'for s in $SRCS;do ln -s $s %s;done;' % DOC_DIR +
'mv %s/*.{jpg,png} %s/images;' % (DOC_DIR, DOC_DIR) +
'rm %s/only_html.zip;' % DOC_DIR +
- 'rm %s/index.zip;' % DOC_DIR +
'rm %s/licenses.txt;' % DOC_DIR +
'cp $SRCDIR/licenses.txt LICENSES.txt;' +
'zip -qr $OUT *',
@@ -27,11 +24,9 @@
'doc.css',
genfile('licenses.txt'),
genfile('only_html.zip'),
- genfile('index.zip'),
],
deps = [
':generate_html',
- ':index',
':licenses.txt',
],
out = 'html.zip',
@@ -79,3 +74,18 @@
],
out = 'index.zip',
)
+
+genrule(
+ name = 'index_jar',
+ cmd = 'jar cf $OUT -C $SRCDIR index.zip',
+ srcs = [genfile('index.zip')],
+ deps = [':index'],
+ out = 'index.jar',
+)
+
+prebuilt_jar(
+ name = 'index_lib',
+ binary_jar = genfile('index.jar'),
+ deps = [':index_jar'],
+ visibility = ['PUBLIC'],
+)
diff --git a/Documentation/access-control.txt b/Documentation/access-control.txt
index db806cc..3fe6a60 100644
--- a/Documentation/access-control.txt
+++ b/Documentation/access-control.txt
@@ -425,7 +425,7 @@
[[category_create]]
-Create reference
+Create Reference
~~~~~~~~~~~~~~~~
The create reference category controls whether it is possible to
@@ -1336,3 +1336,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-apropos.txt b/Documentation/cmd-apropos.txt
new file mode 100644
index 0000000..29ce9fa
--- /dev/null
+++ b/Documentation/cmd-apropos.txt
@@ -0,0 +1,66 @@
+gerrit apropos
+==============
+
+NAME
+----
+gerrit apropos - Search Gerrit documentation index
+
+SYNOPSIS
+--------
+[verse]
+'ssh' -p <port> <host> 'gerrit apropos'
+ <query>
+
+DESCRIPTION
+-----------
+Queries the documentation index and returns results with the title and URL
+from the matched documents.
+
+ACCESS
+------
+Any user who has configured an SSH key.
+
+SCRIPTING
+---------
+This command is intended to be used in scripts.
+
+Note: this feature is only available if documentation index was built.
+
+EXAMPLES
+--------
+
+=====
+$ ssh -p 29418 review.example.com gerrit apropos capabilities
+ Gerrit Code Review - /config/ REST API:
+ http://localhost:8080/Documentation/rest-api-config.html
+
+ Gerrit Code Review - /accounts/ REST API:
+ http://localhost:8080/Documentation/rest-api-accounts.html
+
+ Gerrit Code Review - Project Configuration File Format:
+ http://localhost:8080/Documentation/config-project-config.html
+
+ Gerrit Code Review - Access Controls:
+ http://localhost:8080/Documentation/access-control.html
+
+ Gerrit Code Review - Plugin Development:
+ http://localhost:8080/Documentation/dev-plugins.html
+
+ Gerrit Code Review - REST API:
+ http://localhost:8080/Documentation/rest-api.html
+
+ Gerrit Code Review - /access/ REST API:
+ http://localhost:8080/Documentation/rest-api-access.html
+=====
+
+SEE ALSO
+--------
+
+* link:access-control.html[Access Controls]
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-ban-commit.txt b/Documentation/cmd-ban-commit.txt
index fb4a2ac9..fcdad5c 100644
--- a/Documentation/cmd-ban-commit.txt
+++ b/Documentation/cmd-ban-commit.txt
@@ -58,3 +58,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-cherry-pick.txt b/Documentation/cmd-cherry-pick.txt
index 15a8524..1275d20ea 100644
--- a/Documentation/cmd-cherry-pick.txt
+++ b/Documentation/cmd-cherry-pick.txt
@@ -45,3 +45,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-create-account.txt b/Documentation/cmd-create-account.txt
index 3ecb764..f22b4df 100644
--- a/Documentation/cmd-create-account.txt
+++ b/Documentation/cmd-create-account.txt
@@ -81,3 +81,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-create-group.txt b/Documentation/cmd-create-group.txt
index 8dc6dcc..1102a6d 100644
--- a/Documentation/cmd-create-group.txt
+++ b/Documentation/cmd-create-group.txt
@@ -92,3 +92,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-create-project.txt b/Documentation/cmd-create-project.txt
index e3ad834..da7820f 100644
--- a/Documentation/cmd-create-project.txt
+++ b/Documentation/cmd-create-project.txt
@@ -201,3 +201,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-flush-caches.txt b/Documentation/cmd-flush-caches.txt
index bc6fac5..050b433 100644
--- a/Documentation/cmd-flush-caches.txt
+++ b/Documentation/cmd-flush-caches.txt
@@ -104,3 +104,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-gc.txt b/Documentation/cmd-gc.txt
index 07b899a..50710e2 100644
--- a/Documentation/cmd-gc.txt
+++ b/Documentation/cmd-gc.txt
@@ -70,3 +70,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-gsql.txt b/Documentation/cmd-gsql.txt
index 3c1fd31..4efbb2a 100644
--- a/Documentation/cmd-gsql.txt
+++ b/Documentation/cmd-gsql.txt
@@ -65,3 +65,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-hook-commit-msg.txt b/Documentation/cmd-hook-commit-msg.txt
index c0c1e6c..c3ad1ac 100644
--- a/Documentation/cmd-hook-commit-msg.txt
+++ b/Documentation/cmd-hook-commit-msg.txt
@@ -117,6 +117,7 @@
GERRIT
------
-
-
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-index.txt b/Documentation/cmd-index.txt
index 3ba66a8..a274dec 100644
--- a/Documentation/cmd-index.txt
+++ b/Documentation/cmd-index.txt
@@ -51,6 +51,9 @@
[[user_commands]]User Commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+link:cmd-apropos.html[gerrit apropos]::
+ Search Gerrit documentation index.
+
'gerrit approve'::
'Deprecated alias for `gerrit review`.'
@@ -180,3 +183,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-kill.txt b/Documentation/cmd-kill.txt
index f09053e..94371f0 100644
--- a/Documentation/cmd-kill.txt
+++ b/Documentation/cmd-kill.txt
@@ -28,3 +28,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-ls-groups.txt b/Documentation/cmd-ls-groups.txt
index 17ebba1..0713947 100644
--- a/Documentation/cmd-ls-groups.txt
+++ b/Documentation/cmd-ls-groups.txt
@@ -156,3 +156,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-ls-members.txt b/Documentation/cmd-ls-members.txt
index 9814ff2..d5f127f 100644
--- a/Documentation/cmd-ls-members.txt
+++ b/Documentation/cmd-ls-members.txt
@@ -62,3 +62,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-ls-projects.txt b/Documentation/cmd-ls-projects.txt
index 26530bd..5cd416d1 100644
--- a/Documentation/cmd-ls-projects.txt
+++ b/Documentation/cmd-ls-projects.txt
@@ -154,3 +154,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-ls-user-refs.txt b/Documentation/cmd-ls-user-refs.txt
index 25a99d1..26a083c 100644
--- a/Documentation/cmd-ls-user-refs.txt
+++ b/Documentation/cmd-ls-user-refs.txt
@@ -53,3 +53,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-plugin-enable.txt b/Documentation/cmd-plugin-enable.txt
index da651ca..ad1736d 100644
--- a/Documentation/cmd-plugin-enable.txt
+++ b/Documentation/cmd-plugin-enable.txt
@@ -42,3 +42,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-plugin-install.txt b/Documentation/cmd-plugin-install.txt
index 719c2bc..61663a6 100644
--- a/Documentation/cmd-plugin-install.txt
+++ b/Documentation/cmd-plugin-install.txt
@@ -71,3 +71,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-plugin-ls.txt b/Documentation/cmd-plugin-ls.txt
index 6cce83c..5e651b7 100644
--- a/Documentation/cmd-plugin-ls.txt
+++ b/Documentation/cmd-plugin-ls.txt
@@ -42,3 +42,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-plugin-reload.txt b/Documentation/cmd-plugin-reload.txt
index 3932e30..a4490a8 100644
--- a/Documentation/cmd-plugin-reload.txt
+++ b/Documentation/cmd-plugin-reload.txt
@@ -46,3 +46,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-plugin-remove.txt b/Documentation/cmd-plugin-remove.txt
index ab8f95b..f9c0eea 100644
--- a/Documentation/cmd-plugin-remove.txt
+++ b/Documentation/cmd-plugin-remove.txt
@@ -43,3 +43,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-query.txt b/Documentation/cmd-query.txt
index 66bd845..249b7f9 100644
--- a/Documentation/cmd-query.txt
+++ b/Documentation/cmd-query.txt
@@ -17,6 +17,7 @@
[--commit-message]
[--dependencies]
[--submit-records]
+ [--all-reviewers]
[--]
<query>
[limit:<n>]
@@ -89,6 +90,10 @@
Show information about patch sets which depend on, or are needed by,
each patch set.
+--all-reviewers::
+ Show the name and email of all reviewers which are added to a change
+ (irrespective of whether they have been voting on that change or not).
+
--submit-records::
Show submit record information about the change, which
includes whether the change meets the criteria for submission
@@ -155,3 +160,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-receive-pack.txt b/Documentation/cmd-receive-pack.txt
index 92bb65e..239d2f5 100644
--- a/Documentation/cmd-receive-pack.txt
+++ b/Documentation/cmd-receive-pack.txt
@@ -88,3 +88,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-rename-group.txt b/Documentation/cmd-rename-group.txt
index e810727..624ac9b 100644
--- a/Documentation/cmd-rename-group.txt
+++ b/Documentation/cmd-rename-group.txt
@@ -44,3 +44,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-review.txt b/Documentation/cmd-review.txt
index 70213da..3038ead 100644
--- a/Documentation/cmd-review.txt
+++ b/Documentation/cmd-review.txt
@@ -134,3 +134,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-set-account.txt b/Documentation/cmd-set-account.txt
index f9855cd..19eb468 100644
--- a/Documentation/cmd-set-account.txt
+++ b/Documentation/cmd-set-account.txt
@@ -94,3 +94,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-set-members.txt b/Documentation/cmd-set-members.txt
index 7524893..d7da2eb 100644
--- a/Documentation/cmd-set-members.txt
+++ b/Documentation/cmd-set-members.txt
@@ -80,3 +80,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-set-project-parent.txt b/Documentation/cmd-set-project-parent.txt
index 1e7e6c5..5664890 100644
--- a/Documentation/cmd-set-project-parent.txt
+++ b/Documentation/cmd-set-project-parent.txt
@@ -71,3 +71,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-set-project.txt b/Documentation/cmd-set-project.txt
index af20006..df694a0 100644
--- a/Documentation/cmd-set-project.txt
+++ b/Documentation/cmd-set-project.txt
@@ -117,3 +117,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-set-reviewers.txt b/Documentation/cmd-set-reviewers.txt
index 32fd35e..81b493d 100644
--- a/Documentation/cmd-set-reviewers.txt
+++ b/Documentation/cmd-set-reviewers.txt
@@ -87,3 +87,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-show-caches.txt b/Documentation/cmd-show-caches.txt
index d426508..8c64b05 100644
--- a/Documentation/cmd-show-caches.txt
+++ b/Documentation/cmd-show-caches.txt
@@ -83,3 +83,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-show-connections.txt b/Documentation/cmd-show-connections.txt
index ab9fadf..154e1c2 100644
--- a/Documentation/cmd-show-connections.txt
+++ b/Documentation/cmd-show-connections.txt
@@ -88,3 +88,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-show-queue.txt b/Documentation/cmd-show-queue.txt
index 4ab3097..7364d2d 100644
--- a/Documentation/cmd-show-queue.txt
+++ b/Documentation/cmd-show-queue.txt
@@ -90,3 +90,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-stream-events.txt b/Documentation/cmd-stream-events.txt
index 2a3265e..746b3ea 100644
--- a/Documentation/cmd-stream-events.txt
+++ b/Documentation/cmd-stream-events.txt
@@ -172,3 +172,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-suexec.txt b/Documentation/cmd-suexec.txt
index 78fc361..7b128fa 100644
--- a/Documentation/cmd-suexec.txt
+++ b/Documentation/cmd-suexec.txt
@@ -67,3 +67,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-test-submit-rule.txt b/Documentation/cmd-test-submit-rule.txt
index ae68b80..466182c 100644
--- a/Documentation/cmd-test-submit-rule.txt
+++ b/Documentation/cmd-test-submit-rule.txt
@@ -66,3 +66,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-test-submit-type.txt b/Documentation/cmd-test-submit-type.txt
index f6d5fba..2b8790c 100644
--- a/Documentation/cmd-test-submit-type.txt
+++ b/Documentation/cmd-test-submit-type.txt
@@ -51,3 +51,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/cmd-version.txt b/Documentation/cmd-version.txt
index aa08848..806e28a 100644
--- a/Documentation/cmd-version.txt
+++ b/Documentation/cmd-version.txt
@@ -46,3 +46,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-auto-site-initialization.txt b/Documentation/config-auto-site-initialization.txt
index 4c204fd..6111d5d 100644
--- a/Documentation/config-auto-site-initialization.txt
+++ b/Documentation/config-auto-site-initialization.txt
@@ -80,3 +80,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-cla.txt b/Documentation/config-cla.txt
index 6404d4e..fa28e7b 100644
--- a/Documentation/config-cla.txt
+++ b/Documentation/config-cla.txt
@@ -80,3 +80,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-contact.txt b/Documentation/config-contact.txt
index 4d8851f..6c59d2a 100644
--- a/Documentation/config-contact.txt
+++ b/Documentation/config-contact.txt
@@ -213,3 +213,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index 814472a..a2dbb9c 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -3030,3 +3030,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-gitweb.txt b/Documentation/config-gitweb.txt
index 7ba15b8..3e9cb96 100644
--- a/Documentation/config-gitweb.txt
+++ b/Documentation/config-gitweb.txt
@@ -245,6 +245,10 @@
After updating `'$site_path'/etc/gerrit.config`, the Gerrit server must
be restarted and clients must reload the host page to see the change.
+Note that when using a custom gitweb configuration, values must be
+specified for all of the `project`, `revision`, `branch` and `filehistory`
+settings, otherwise the configuration will not be used.
+
Access Control
++++++++++++++
@@ -278,3 +282,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-hooks.txt b/Documentation/config-hooks.txt
index e232c0c..8fb6e82 100644
--- a/Documentation/config-hooks.txt
+++ b/Documentation/config-hooks.txt
@@ -169,3 +169,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-labels.txt b/Documentation/config-labels.txt
index c08d484..ba3d482 100644
--- a/Documentation/config-labels.txt
+++ b/Documentation/config-labels.txt
@@ -315,3 +315,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-login-register.txt b/Documentation/config-login-register.txt
index 867f0d4..d3911d7 100644
--- a/Documentation/config-login-register.txt
+++ b/Documentation/config-login-register.txt
@@ -141,3 +141,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-mail.txt b/Documentation/config-mail.txt
index 3b8bffa..ca9253ee 100644
--- a/Documentation/config-mail.txt
+++ b/Documentation/config-mail.txt
@@ -211,3 +211,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-project-config.txt b/Documentation/config-project-config.txt
index 8529b67..3267c45 100644
--- a/Documentation/config-project-config.txt
+++ b/Documentation/config-project-config.txt
@@ -223,3 +223,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-reverseproxy.txt b/Documentation/config-reverseproxy.txt
index 064fe2e..563b322 100644
--- a/Documentation/config-reverseproxy.txt
+++ b/Documentation/config-reverseproxy.txt
@@ -147,3 +147,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-sso.txt b/Documentation/config-sso.txt
index e915ffb..1d8d2d6 100644
--- a/Documentation/config-sso.txt
+++ b/Documentation/config-sso.txt
@@ -179,3 +179,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-themes.txt b/Documentation/config-themes.txt
index c102381..5eb8094 100644
--- a/Documentation/config-themes.txt
+++ b/Documentation/config-themes.txt
@@ -140,3 +140,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/config-validation.txt b/Documentation/config-validation.txt
index 1b09d19..7ef646b 100644
--- a/Documentation/config-validation.txt
+++ b/Documentation/config-validation.txt
@@ -40,3 +40,6 @@
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/database-setup.txt b/Documentation/database-setup.txt
index 3800473..1f48f53 100644
--- a/Documentation/database-setup.txt
+++ b/Documentation/database-setup.txt
@@ -113,3 +113,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-buck.txt b/Documentation/dev-buck.txt
index 15c145a..750911e 100644
--- a/Documentation/dev-buck.txt
+++ b/Documentation/dev-buck.txt
@@ -374,3 +374,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-contributing.txt b/Documentation/dev-contributing.txt
index edc072d..24fc266 100644
--- a/Documentation/dev-contributing.txt
+++ b/Documentation/dev-contributing.txt
@@ -288,3 +288,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-design.txt b/Documentation/dev-design.txt
index 3cb58b1..06dd95d 100644
--- a/Documentation/dev-design.txt
+++ b/Documentation/dev-design.txt
@@ -739,3 +739,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-eclipse.txt b/Documentation/dev-eclipse.txt
index d2fc8f0..eeee5a3 100644
--- a/Documentation/dev-eclipse.txt
+++ b/Documentation/dev-eclipse.txt
@@ -102,3 +102,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-inspector.txt b/Documentation/dev-inspector.txt
new file mode 100644
index 0000000..925f74c
--- /dev/null
+++ b/Documentation/dev-inspector.txt
@@ -0,0 +1,305 @@
+Gerrit Inspector
+================
+
+NAME
+----
+Gerrit Inspector - Interactive Jython environment for Gerrit
+
+SYNOPSIS
+--------
+[verse]
+'java' -jar gerrit.war 'daemon'
+ -d <SITE_PATH>
+ [\--enable-httpd | \--disable-httpd]
+ [\--enable-sshd | \--disable-sshd]
+ [\--console-log]
+ [\--slave]
+ -s
+
+DESCRIPTION
+-----------
+Runs the Gerrit network daemon on the local system as described
+in the link:pgm-daemon.html[Daemon documentation], additionally
+starting an interactive Jython shell for inspection
+and troubleshooting of live data of the Gerrit instance.
+
+CAUTION: Gerrit Inspector works directly on instances of Java Virtual
+Machine objects and it is possible to read and write instance
+members as well as invoke Java functions. Access is granted
+also to 'private' and 'protected' members. Therefore it is possible
+to introduce changes to the internal state of the system in
+an inconsistent way. Care must be taken not to break the running system
+and/or destroy the data.
+
+INSTALLATION
+------------
+
+Gerrit Inspector requires Jython library ('jython.jar') to be installed
+in the '$site_path/lib' directory. Jython, a Python interpreter for
+the Java Virtual Machine, can be obtained from the http://www.jython.org/
+website. Only 'jython.jar' file is needed, installation of Jython libraries
+is optional. Gerrit Inspector has been tested with Jython 2.5.2 but
+might work an earlier version.
+
+STARTUP
+-------
+
+During startup Jython examines Java libraries found on the classpath.
+While libraries are inspected a large amount of messages is displayed on the console:
+
+----
+*sys-package-mgr*: processing new jar, '/home/user/.gerritcodereview/tmp/gerrit_4890671371398741854_app/sshd-core-0.5.1-r1095809.jar'
+----
+
+After this a system-wide embedded initialization script is started. This script
+is contained in the gerrit's WAR archive. This script produces output similar to
+the following on the console:
+
+----
+"Shell" is "com.google.gerrit.pgm.shell.JythonShell@61644f2d"
+"m" is "com.google.gerrit.lifecycle.LifecycleManager@6f03b248"
+"ds" is "com.google.gerrit.server.schema.DataSourceProvider@6b3592c"
+"schk" is "com.google.gerrit.server.schema.SchemaVersionCheck@5e8cb9bd"
+
+Welcome to the Gerrit Inspector
+Enter help() to see the above again, EOF to quit and stop Gerrit
+----
+
+Then an optional user startup script is processed. It should be
+located in the gerrit user home directory as '.gerritcodereview/Startup.py'.
+
+This script can access all variables defined in the system (such
+as the ones displayed by the initialization script as shown above).
+Variables and functions defined by the startup scripts are available for
+the interactive interpreter.
+
+When interactive interpreter exits (by issuing EOF on the command line),
+a whole Gerrit instance is shut down gracefully.
+
+USING THE INTERPRETER
+---------------------
+
+Gerrit Inspector launches Jython interpreter in the context of the Gerrit
+Java Virtual Machine. All core facilities of the Jython (and Python)
+language are available to the user.
+
+Additional facilities can be provided, for example a 'Lib' directory from the
+Jython distribution can be installed under '$site_path/lib/Lib' to provide
+access to many standard Python modules. Jython can also use additional Java
+classes and libraries and most of the Python modules and scripts.
+
+The Inspector has by default access to classes and object instances available
+in the Java Virtual Machine. Objects are introspected and *private* and *protected*
+members are also available.
+
+For more information on using Jython, especially with regards to its limitations
+in interfacing to the Java Virtual Machine, please refer to the
+http://www.jython.org/[Jython documentation].
+
+After sucessful initialization it is possible to examine components of
+Java packages, classes and live instances.
+
+----
+>>> import com.google.inject
+>>> dir(com.google.inject)
+['AbstractModule', 'Binder', 'Binding', 'BindingAnnotation', 'ConfigurationException', 'CreationException', 'Exposed', 'Guice', 'ImplementedBy', 'Inject', 'Injector', 'Key', 'MembersInjector', 'Module', 'OutOfScopeException', 'PrivateBinder', 'PrivateModule', 'ProvidedBy', 'Provider', 'Provides', 'ProvisionException', 'Scope', 'ScopeAnnotation', 'Scopes', 'Singleton', 'Stage', 'TypeLiteral', '__name__', 'assistedinject', 'binder', 'internal', 'matcher', 'name', 'servlet', 'spi', 'util']
+>>> type(com.google.inject)
+<type 'javapackage'>
+>>> dir(com.google.inject.Guice)
+['__class__', '__copy__', '__deepcopy__', '__delattr__', '__doc__',
+'__eq__', '__getattribute__', '__hash__', '__init__', '__ne__',
+'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
+'__str__', '__unicode__', 'class', 'clone', 'createInjector',
+'equals', 'finalize', 'getClass', 'hashCode', 'notify', 'notifyAll',
+'registerNatives', 'toString', 'wait']
+----
+
+Startup script provides some convenient variables to access some global Gerrit components,
+for example a connection to the review database is kept open:
+
+----
+>>> ds
+org.apache.commons.dbcp.BasicDataSource@61db2215
+>>> ds.driverClassName
+u'org.postgresql.Driver'
+>>> ds.dataSource
+org.apache.commons.dbcp.PoolingDataSource@23226fe1
+>>> ds.dataSource.connection
+jdbc:postgresql://localhost/reviewdb, UserName=rv, PostgreSQL Native Driver
+----
+
+It is also possible to interact with the ORM layer:
+
+----
+>>> db = schk.schema.open()
+>>> db
+com.google.gerrit.reviewdb.server.ReviewDb_Schema_GwtOrm$$28@24cbbdf3
+>>> db.getDialect()
+com.google.gwtorm.schema.sql.DialectPostgreSQL@4de07d3e
+>>> for x in db.patchSets().iterateAllEntities():
+... print x
+...
+[PatchSet 1,1]
+[PatchSet 2,1]
+[PatchSet 3,1]
+[PatchSet 4,1]
+[PatchSet 5,1]
+[PatchSet 6,1]
+[PatchSet 7,1]
+[PatchSet 8,1]
+[PatchSet 6,2]
+>>> for x in db.patchComments().iterateAllEntities():
+... print x
+com.google.gerrit.reviewdb.client.PatchLineComment@5381298a
+com.google.gerrit.reviewdb.client.PatchLineComment@44ce4dda
+com.google.gerrit.reviewdb.client.PatchLineComment@44594680
+>>> dir(com.google.gerrit.reviewdb.client.PatchLineComment)
+['Key', 'STATUS_DRAFT', 'STATUS_PUBLISHED', 'Status', '__class__',
+'__copy__', '__deepcopy__', '__delattr__', '__doc__', '__eq__',
+'__getattribute__', '__hash__', '__init__', '__ne__', '__new__',
+'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__',
+'__unicode__', 'author', 'class', 'clone', 'equals', 'finalize',
+'getAuthor', 'getClass', 'getKey', 'getLine', 'getMessage',
+'getParentUuid', 'getSide', 'getStatus', 'getWrittenOn', 'hashCode',
+'key', 'line', 'lineNbr', 'message', 'notify', 'notifyAll',
+'parentUuid', 'registerNatives', 'setMessage', 'setSide', 'setStatus',
+'side', 'status', 'toString', 'updated', 'wait', 'writtenOn']
+>>> for x in db.patchComments().iterateAllEntities():
+... print x.status, x.line, x.message
+...
+P 2 I like it!
+P 2 more
+P 1 better
+----
+
+A built-in *help()* function provides values of global variables
+defined in the interpreter:
+
+----
+>>> help()
+"schk" is "com.google.gerrit.server.schema.SchemaVersionCheck@5e8cb9bd"
+"ds" is "com.google.gerrit.server.schema.DataSourceProvider@6b3592c"
+"m" is "com.google.gerrit.lifecycle.LifecycleManager@6f03b248"
+"q" is "com.google.gerrit.reviewdb.server.ReviewDb_Schema_GwtOrm$$23@56d3384d"
+"Shell" is "com.google.gerrit.pgm.shell.JythonShell@61644f2d"
+"x" is "com.google.gerrit.reviewdb.client.PatchLineComment@518acfa7"
+"z" is "com.google.gwtorm.jdbc.Database@668dfd9b"
+"db" is "com.google.gerrit.reviewdb.server.ReviewDb_Schema_GwtOrm$$23@6a3ccb09"
+
+Welcome to the Gerrit Inspector
+Enter help() to see the above again, EOF to quit and stop Gerrit
+----
+
+Java and Python exceptions are intercepted by the Inspector:
+----
+>>> import java.lang.RuntimeException
+>>> raise java.lang.RuntimeException("Exiting")
+Traceback (most recent call last):
+ File "<stdin>", line 1, in <module>
+ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
+ at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
+ at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
+ at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
+ at org.python.core.PyReflectedConstructor.constructProxy(PyReflectedConstructor.java:210)
+
+java.lang.RuntimeException: java.lang.RuntimeException: Exiting
+>>>
+----
+
+To exit the interpreter, use EOF character (Ctrl-D on Unix systems, Ctrl-Z on Windows).
+
+It is also possible to shut down the JVM by using *System.exit()*
+
+----
+>>> import java.lang.System
+>>> java.lang.System.exit(1)
+----
+
+And Gerrit should shut down all its subsystems and exit:
+
+----
+[2012-04-17 15:31:08,458] INFO com.google.gerrit.pgm.Daemon : caught shutdown, cleaning up
+----
+
+TROUBLESHOOTING
+---------------
+
+Gerrit Inspector is logging to the Gerrit error log.
+
+A successful startup is indicated in the logfile:
+
+----
+ [2012-04-17 13:43:44,888] INFO com.google.gerrit.pgm.shell.JythonShell : Jython shell instance created.
+----
+
+If 'jython.jar' library is not available, Gerrit refuses to start when given *-s* option:
+
+----
+[2012-04-17 13:57:29,611] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
+com.google.inject.ProvisionException: Guice provision errors:
+
+1) Error injecting constructor, java.lang.UnsupportedOperationException: Cannot create Jython shell: Class org.python.util.InteractiveConsole not found
+ (You might need to install jython.jar in the lib directory)
+ at com.google.gerrit.pgm.shell.JythonShell.<init>(JythonShell.java:47)
+ while locating com.google.gerrit.pgm.shell.JythonShell
+ while locating com.google.gerrit.pgm.shell.InteractiveShell
+----
+
+Errors during processing of the startup script, 'Startup.py', are logged
+to the error log:
+
+----
+[2012-04-17 14:20:30,558] INFO com.google.gerrit.pgm.shell.JythonShell : Jython shell instance created.
+[2012-04-17 14:20:38,005] ERROR com.google.gerrit.pgm.shell.JythonShell : Exception occured while loading file Startup.py :
+java.lang.reflect.InvocationTargetException
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at com.google.gerrit.pgm.shell.JythonShell.runMethod0(JythonShell.java:112)
+ at com.google.gerrit.pgm.shell.JythonShell.execFile(JythonShell.java:194)
+ at com.google.gerrit.pgm.shell.JythonShell.reload(JythonShell.java:178)
+ at com.google.gerrit.pgm.shell.JythonShell.run(JythonShell.java:152)
+ at com.google.gerrit.pgm.Daemon.run(Daemon.java:190)
+ at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:67)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:167)
+ at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:91)
+ at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:49)
+ at Main.main(Main.java:25)
+Caused by: Traceback (most recent call last):
+ File "/home/user/.gerritcodereview/Startup.py", line 1, in <module>
+ Test
+NameError: name 'Test' is not defined
+----
+
+Those errors are non-fatal. System and user scripts can be loaded again
+by issuing the following command in the Gerrit Inspector console:
+
+----
+Shell.reload()
+----
+
+LOGGING
+-------
+Error and warning messages from the server are automatically written
+to the log file under '$site_path/logs/error_log'.
+
+Output and error messages (including Java and Python exceptions)
+resulting from interactive work are logged to the console.
+
+KNOWN ISSUES
+------------
+The Inspector does not yet recognize Google Guice bindings.
+
+IMPORTANT: Using the Inspector may void your warranty.
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index d0e361a..f3e4247 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -38,7 +38,7 @@
----
mvn archetype:generate -DarchetypeGroupId=com.google.gerrit \
-DarchetypeArtifactId=gerrit-plugin-archetype \
- -DarchetypeVersion=2.8-SNAPSHOT \
+ -DarchetypeVersion=2.9-SNAPSHOT \
-DgroupId=com.google.gerrit \
-DartifactId=testPlugin
----
@@ -191,6 +191,29 @@
}
----
+A plugin can get its canonical web URL injected at runtime:
+
+[source,java]
+----
+public class MyClass {
+
+ private final String url;
+
+ @Inject
+ public MyClass(@PluginCanonicalWebUrl String url) {
+ this.url = url;
+ }
+
+ [...]
+}
+----
+
+The URL is composed of the server's canonical web URL and the plugin's
+name, i.e. `http://review.example.com:8080/plugin-name`.
+
+The canonical web URL may be injected into any .jar plugin regardless of
+whether or not the plugin provides an HTTP servlet.
+
[[reload_method]]
Reload Method
~~~~~~~~~~~~~
@@ -1194,3 +1217,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-readme.txt b/Documentation/dev-readme.txt
index ced8648..d961f70 100644
--- a/Documentation/dev-readme.txt
+++ b/Documentation/dev-readme.txt
@@ -106,6 +106,43 @@
java -jar buck-out/gen/gerrit.war daemon -d ../test_site
----
+Running the Daemon with Gerrit Inspector
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+link:dev-inspector.html[Gerrit Inspector] is an interactive scriptable
+environment to inspect and modify internal state of the system.
+
+This environment is available on the system console after
+the system starts. Leaving the Inspector will shutdown the Gerrit
+instance.
+
+The environment allows interactive work as well as running of
+Python scripts for troubleshooting.
+
+Gerrit Inspect can be started by adding '-s' option to the
+command used to launch the daemon:
+
+----
+ java -jar buck-out/gen/gerrit.war daemon -d ../test_site -s
+----
+
+Gerrit Inspector examines Java libraries first, then loads
+its initialization scripts and then starts a command line
+prompt on the console:
+
+----
+ Welcome to the Gerrit Inspector
+ Enter help() to see the above again, EOF to quit and stop Gerrit
+ Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
+ [OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0 running for Gerrit 2.3-rc0-163-g01967ef
+ >>>
+----
+
+With the Inspector enabled Gerrit can be used normally and all
+interfaces (HTTP, SSH etc.) are available.
+
+Care must be taken not to modify internal state of the system
+when using the Inspector.
Querying the Database
~~~~~~~~~~~~~~~~~~~~~
@@ -209,3 +246,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-release-deploy-config.txt b/Documentation/dev-release-deploy-config.txt
index 9c98fff..6ea32b7 100644
--- a/Documentation/dev-release-deploy-config.txt
+++ b/Documentation/dev-release-deploy-config.txt
@@ -132,3 +132,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-release-subproject.txt b/Documentation/dev-release-subproject.txt
index 956bd29..b9a39be 100644
--- a/Documentation/dev-release-subproject.txt
+++ b/Documentation/dev-release-subproject.txt
@@ -107,3 +107,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-release.txt b/Documentation/dev-release.txt
index f9d0d0e..b9b9ff0 100644
--- a/Documentation/dev-release.txt
+++ b/Documentation/dev-release.txt
@@ -359,3 +359,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/dev-rest-api.txt b/Documentation/dev-rest-api.txt
index 0175a62..24b60f0 100644
--- a/Documentation/dev-rest-api.txt
+++ b/Documentation/dev-rest-api.txt
@@ -87,3 +87,5 @@
------
Part of link:index.html[Gerrit Code Review]
+SEARCHBOX
+---------
diff --git a/Documentation/error-branch-not-found.txt b/Documentation/error-branch-not-found.txt
index bd8d090..a8b1741 100644
--- a/Documentation/error-branch-not-found.txt
+++ b/Documentation/error-branch-not-found.txt
@@ -32,3 +32,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-change-closed.txt b/Documentation/error-change-closed.txt
index 3244fb3..e466c2e 100644
--- a/Documentation/error-change-closed.txt
+++ b/Documentation/error-change-closed.txt
@@ -39,3 +39,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-change-does-not-belong-to-project.txt b/Documentation/error-change-does-not-belong-to-project.txt
index e747881..db16261 100644
--- a/Documentation/error-change-does-not-belong-to-project.txt
+++ b/Documentation/error-change-does-not-belong-to-project.txt
@@ -14,3 +14,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-change-not-found.txt b/Documentation/error-change-not-found.txt
index b6df13b..e578ef5 100644
--- a/Documentation/error-change-not-found.txt
+++ b/Documentation/error-change-not-found.txt
@@ -13,3 +13,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-change-upload-blocked.txt b/Documentation/error-change-upload-blocked.txt
index 6bad02e..3b413bd2 100644
--- a/Documentation/error-change-upload-blocked.txt
+++ b/Documentation/error-change-upload-blocked.txt
@@ -39,3 +39,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-commit-already-exists.txt b/Documentation/error-commit-already-exists.txt
index dc32c4c1..6a2170a 100644
--- a/Documentation/error-commit-already-exists.txt
+++ b/Documentation/error-commit-already-exists.txt
@@ -12,3 +12,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-contains-banned-commit.txt b/Documentation/error-contains-banned-commit.txt
index 8a30c44..f6ac30d 100644
--- a/Documentation/error-contains-banned-commit.txt
+++ b/Documentation/error-contains-banned-commit.txt
@@ -19,3 +19,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-has-duplicates.txt b/Documentation/error-has-duplicates.txt
index b5175c0..4eac779 100644
--- a/Documentation/error-has-duplicates.txt
+++ b/Documentation/error-has-duplicates.txt
@@ -22,3 +22,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-invalid-author.txt b/Documentation/error-invalid-author.txt
index c484776..7067cde 100644
--- a/Documentation/error-invalid-author.txt
+++ b/Documentation/error-invalid-author.txt
@@ -143,3 +143,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-invalid-changeid-line.txt b/Documentation/error-invalid-changeid-line.txt
index 9235266..a1d7f15 100644
--- a/Documentation/error-invalid-changeid-line.txt
+++ b/Documentation/error-invalid-changeid-line.txt
@@ -29,3 +29,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-invalid-committer.txt b/Documentation/error-invalid-committer.txt
index 447064e..e27961f 100644
--- a/Documentation/error-invalid-committer.txt
+++ b/Documentation/error-invalid-committer.txt
@@ -108,3 +108,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-messages.txt b/Documentation/error-messages.txt
index 58e9e02..18aa12a 100644
--- a/Documentation/error-messages.txt
+++ b/Documentation/error-messages.txt
@@ -47,3 +47,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-missing-changeid.txt b/Documentation/error-missing-changeid.txt
index edbc63b..833e6ac 100644
--- a/Documentation/error-missing-changeid.txt
+++ b/Documentation/error-missing-changeid.txt
@@ -70,3 +70,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-multiple-changeid-lines.txt b/Documentation/error-multiple-changeid-lines.txt
index 9fa2b91..9b094d4 100644
--- a/Documentation/error-multiple-changeid-lines.txt
+++ b/Documentation/error-multiple-changeid-lines.txt
@@ -29,3 +29,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-no-changes-made.txt b/Documentation/error-no-changes-made.txt
index d0e1d4f..4987b16 100644
--- a/Documentation/error-no-changes-made.txt
+++ b/Documentation/error-no-changes-made.txt
@@ -19,3 +19,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-no-common-ancestry.txt b/Documentation/error-no-common-ancestry.txt
index 615da71..174e52b 100644
--- a/Documentation/error-no-common-ancestry.txt
+++ b/Documentation/error-no-common-ancestry.txt
@@ -18,3 +18,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-no-new-changes.txt b/Documentation/error-no-new-changes.txt
index 8e409ef..20357a4 100644
--- a/Documentation/error-no-new-changes.txt
+++ b/Documentation/error-no-new-changes.txt
@@ -49,3 +49,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-non-fast-forward.txt b/Documentation/error-non-fast-forward.txt
index 6604e10..f9b2caa 100644
--- a/Documentation/error-non-fast-forward.txt
+++ b/Documentation/error-non-fast-forward.txt
@@ -57,3 +57,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-not-a-gerrit-administrator.txt b/Documentation/error-not-a-gerrit-administrator.txt
index b771af6..98dd64c 100644
--- a/Documentation/error-not-a-gerrit-administrator.txt
+++ b/Documentation/error-not-a-gerrit-administrator.txt
@@ -12,3 +12,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-not-allowed-to-upload-merges.txt b/Documentation/error-not-allowed-to-upload-merges.txt
index 515eef5..fd2f10c 100644
--- a/Documentation/error-not-allowed-to-upload-merges.txt
+++ b/Documentation/error-not-allowed-to-upload-merges.txt
@@ -19,3 +19,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-not-permitted-to-create.txt b/Documentation/error-not-permitted-to-create.txt
index 9c07fd1..f41b645 100644
--- a/Documentation/error-not-permitted-to-create.txt
+++ b/Documentation/error-not-permitted-to-create.txt
@@ -14,3 +14,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-not-signed-off-by.txt b/Documentation/error-not-signed-off-by.txt
index bd1f40d..a3d6bbd 100644
--- a/Documentation/error-not-signed-off-by.txt
+++ b/Documentation/error-not-signed-off-by.txt
@@ -29,3 +29,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-not-valid-ref.txt b/Documentation/error-not-valid-ref.txt
index 128e796..5bba8e6 100644
--- a/Documentation/error-not-valid-ref.txt
+++ b/Documentation/error-not-valid-ref.txt
@@ -44,3 +44,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-permission-denied.txt b/Documentation/error-permission-denied.txt
index 2ec0a3f..a97161f 100644
--- a/Documentation/error-permission-denied.txt
+++ b/Documentation/error-permission-denied.txt
@@ -60,3 +60,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-prohibited-by-gerrit.txt b/Documentation/error-prohibited-by-gerrit.txt
index bad2b3c..2a65ea2 100644
--- a/Documentation/error-prohibited-by-gerrit.txt
+++ b/Documentation/error-prohibited-by-gerrit.txt
@@ -39,3 +39,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-project-not-found.txt b/Documentation/error-project-not-found.txt
index 3fc0141..29af5f8 100644
--- a/Documentation/error-project-not-found.txt
+++ b/Documentation/error-project-not-found.txt
@@ -32,3 +32,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-push-fails-due-to-commit-message.txt b/Documentation/error-push-fails-due-to-commit-message.txt
index 172d64f..046789e 100644
--- a/Documentation/error-push-fails-due-to-commit-message.txt
+++ b/Documentation/error-push-fails-due-to-commit-message.txt
@@ -39,3 +39,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-squash-commits-first.txt b/Documentation/error-squash-commits-first.txt
index 2181c52..9434363 100644
--- a/Documentation/error-squash-commits-first.txt
+++ b/Documentation/error-squash-commits-first.txt
@@ -106,3 +106,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-upload-denied.txt b/Documentation/error-upload-denied.txt
index 5dec8ab..6de94b4 100644
--- a/Documentation/error-upload-denied.txt
+++ b/Documentation/error-upload-denied.txt
@@ -17,3 +17,6 @@
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/i18n-readme.txt b/Documentation/i18n-readme.txt
index 2135598..46abaad 100644
--- a/Documentation/i18n-readme.txt
+++ b/Documentation/i18n-readme.txt
@@ -22,3 +22,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/images/intro-quick-central-gerrit.png b/Documentation/images/intro-quick-central-gerrit.png
index 61b9638..8717176 100644
--- a/Documentation/images/intro-quick-central-gerrit.png
+++ b/Documentation/images/intro-quick-central-gerrit.png
Binary files differ
diff --git a/Documentation/images/intro-quick-central-repo.png b/Documentation/images/intro-quick-central-repo.png
index 84ffeb0..8400b5e 100644
--- a/Documentation/images/intro-quick-central-repo.png
+++ b/Documentation/images/intro-quick-central-repo.png
Binary files differ
diff --git a/Documentation/index.txt b/Documentation/index.txt
index 9b8acc4..9435e6d 100644
--- a/Documentation/index.txt
+++ b/Documentation/index.txt
@@ -91,3 +91,6 @@
* link:http://code.google.com/p/gerrit/issues/list[Issue Tracking]
* link:http://code.google.com/p/gerrit/source/checkout[Source Code]
* link:http://code.google.com/p/gerrit/wiki/Background[A History of Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/install-j2ee.txt b/Documentation/install-j2ee.txt
index 5ba8cb1..dd9657c 100644
--- a/Documentation/install-j2ee.txt
+++ b/Documentation/install-j2ee.txt
@@ -117,3 +117,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/install-quick.txt b/Documentation/install-quick.txt
index f1bd25c..741de35 100644
--- a/Documentation/install-quick.txt
+++ b/Documentation/install-quick.txt
@@ -232,3 +232,6 @@
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/install.txt b/Documentation/install.txt
index 1d6d1bd..8e836f8 100644
--- a/Documentation/install.txt
+++ b/Documentation/install.txt
@@ -194,3 +194,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/intro-change-screen.txt b/Documentation/intro-change-screen.txt
index 2913336..d1c7adb 100644
--- a/Documentation/intro-change-screen.txt
+++ b/Documentation/intro-change-screen.txt
@@ -214,3 +214,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/intro-quick.txt b/Documentation/intro-quick.txt
index ae2e7e7..cd3374b 100644
--- a/Documentation/intro-quick.txt
+++ b/Documentation/intro-quick.txt
@@ -390,3 +390,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/js-api.txt b/Documentation/js-api.txt
index 2e97ac4..0e470e7 100644
--- a/Documentation/js-api.txt
+++ b/Documentation/js-api.txt
@@ -636,3 +636,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/json.txt b/Documentation/json.txt
index 2836e5b..73dbd92 100644
--- a/Documentation/json.txt
+++ b/Documentation/json.txt
@@ -72,6 +72,9 @@
submitRecords:: The <<submitRecord,submitRecord attribute>> contains
information about whether this change has been or can be submitted.
+allReviewers:: List of all reviewers in <<account,account attribute>>
+which are added to a change.
+
[[trackingid]]
trackingid
----------
@@ -273,3 +276,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-LocalUsernamesToLowerCase.txt b/Documentation/pgm-LocalUsernamesToLowerCase.txt
index 9189fee..f1d21f89 100644
--- a/Documentation/pgm-LocalUsernamesToLowerCase.txt
+++ b/Documentation/pgm-LocalUsernamesToLowerCase.txt
@@ -66,3 +66,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-ScanTrackingIds.txt b/Documentation/pgm-ScanTrackingIds.txt
index f9494d4..9e38032 100644
--- a/Documentation/pgm-ScanTrackingIds.txt
+++ b/Documentation/pgm-ScanTrackingIds.txt
@@ -57,3 +57,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-daemon.txt b/Documentation/pgm-daemon.txt
index ce88ab7..18bd293 100644
--- a/Documentation/pgm-daemon.txt
+++ b/Documentation/pgm-daemon.txt
@@ -16,6 +16,7 @@
[\--slave]
[\--headless]
[\--init]
+ [-s]
DESCRIPTION
-----------
@@ -68,6 +69,14 @@
Run init before starting the daemon. This will create a new site or
upgrade an existing site.
+\--s::
+ Start link:dev-inspector.html[Gerrit Inspector] on the console, a
+ built-in interactive inspection environment to assist debugging and
+ troubleshooting of Gerrit code.
++
+This options requires 'jython.jar' from the http://www.jython.org[Jython distribution]
+to be present in '$site_path/lib' directory.
+
CONTEXT
-------
This command can only be run on a server which has direct
@@ -117,3 +126,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-gsql.txt b/Documentation/pgm-gsql.txt
index 37fbb74..a805036 100644
--- a/Documentation/pgm-gsql.txt
+++ b/Documentation/pgm-gsql.txt
@@ -54,3 +54,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-index.txt b/Documentation/pgm-index.txt
index 987b4ac..a25a1ab 100644
--- a/Documentation/pgm-index.txt
+++ b/Documentation/pgm-index.txt
@@ -44,3 +44,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-init.txt b/Documentation/pgm-init.txt
index 3d6cb73..8e48b30 100644
--- a/Documentation/pgm-init.txt
+++ b/Documentation/pgm-init.txt
@@ -62,3 +62,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-prolog-shell.txt b/Documentation/pgm-prolog-shell.txt
index 3189e90..7b273f5 100644
--- a/Documentation/pgm-prolog-shell.txt
+++ b/Documentation/pgm-prolog-shell.txt
@@ -55,3 +55,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-reindex.txt b/Documentation/pgm-reindex.txt
index 2b44f6b..f55c093 100644
--- a/Documentation/pgm-reindex.txt
+++ b/Documentation/pgm-reindex.txt
@@ -39,3 +39,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/pgm-rulec.txt b/Documentation/pgm-rulec.txt
index 6d0a632..356f555 100644
--- a/Documentation/pgm-rulec.txt
+++ b/Documentation/pgm-rulec.txt
@@ -52,3 +52,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/project-setup.txt b/Documentation/project-setup.txt
index 36d3c60..9b6f6d9 100644
--- a/Documentation/project-setup.txt
+++ b/Documentation/project-setup.txt
@@ -134,3 +134,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/prolog-change-facts.txt b/Documentation/prolog-change-facts.txt
index e21da02..071984b 100644
--- a/Documentation/prolog-change-facts.txt
+++ b/Documentation/prolog-change-facts.txt
@@ -101,3 +101,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/prolog-cookbook.txt b/Documentation/prolog-cookbook.txt
index b1710a2..54f6910 100644
--- a/Documentation/prolog-cookbook.txt
+++ b/Documentation/prolog-cookbook.txt
@@ -1062,3 +1062,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/replace_macros.py b/Documentation/replace_macros.py
index 1680a47..1f23cbe 100755
--- a/Documentation/replace_macros.py
+++ b/Documentation/replace_macros.py
@@ -22,6 +22,7 @@
PAT_GET = re.compile(r'^get::([^ \t\n]*)')
PAT_TITLE = re.compile(r'^\.(.*)')
PAT_STARS = re.compile(r'^\*\*\*\*')
+PAT_SEARCHBOX = re.compile(r'^SEARCHBOX')
GERRIT_UPLINK = """
@@ -56,6 +57,29 @@
"""
+SEARCH_BOX = """
+
+++++
+<div style="position:absolute; right:20px; top:20px;">
+<input type="text" id="docSearch" size="70" />
+<button type="button" id="searchBox">Search</button>
+<script type="text/javascript">
+var f = function() {
+ window.location = '../#/Documentation/' +
+ encodeURIComponent(document.getElementById("docSearch").value);
+}
+document.getElementById("searchBox").onclick = f;
+document.getElementById("docSearch").onkeypress = function(e) {
+ if (13 == (e.keyCode ? e.keyCode : e.which)) {
+ f();
+ }
+}
+</script>
+</div>
+++++
+
+"""
+
opts = OptionParser()
opts.add_option('-o', '--out', help='output file')
opts.add_option('-s', '--src', help='source file')
@@ -73,6 +97,10 @@
# Case of "GERRIT\n------" at the footer
out_file.write(GERRIT_UPLINK)
last_line = ''
+ elif PAT_SEARCHBOX.match(line):
+ # Case of 'SEARCHBOX\n---------'
+ out_file.write(SEARCH_BOX)
+ last_line = ''
elif PAT_INCLUDE.match(line):
# Case of 'include::<filename>'
match = PAT_INCLUDE.match(line)
diff --git a/Documentation/rest-api-access.txt b/Documentation/rest-api-access.txt
index 6c786e4..b49f787 100644
--- a/Documentation/rest-api-access.txt
+++ b/Documentation/rest-api-access.txt
@@ -378,3 +378,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/rest-api-accounts.txt b/Documentation/rest-api-accounts.txt
index 02bb549..90d4e2d 100644
--- a/Documentation/rest-api-accounts.txt
+++ b/Documentation/rest-api-accounts.txt
@@ -1250,3 +1250,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index 9404d00..9ed8be0 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -3371,3 +3371,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt
index 4f25aa8..e9c1739 100644
--- a/Documentation/rest-api-config.txt
+++ b/Documentation/rest-api-config.txt
@@ -219,3 +219,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/rest-api-documentation.txt b/Documentation/rest-api-documentation.txt
new file mode 100644
index 0000000..9030fac
--- /dev/null
+++ b/Documentation/rest-api-documentation.txt
@@ -0,0 +1,154 @@
+Gerrit Code Review - /Documentation/ REST API
+=============================================
+
+This page describes the documentation search related REST endpoints.
+Please also take note of the general information on the
+link:rest-api.html[REST API].
+
+Please note that this feature is only usable with documentation built-in.
+You'll need to
+`buck build :withdocs`
+or
+`buck build :release`
+to test this feature.
+
+[[documentation-endpoints]]
+Documentation Search Endpoints
+------------------------------
+
+[[search-documentation]]
+Search Documentation
+~~~~~~~~~~~~~~~~~~~~
+[verse]
+'GET /Documentation/'
+
+With `q` parameter, search our documentation index for the terms.
+
+A list of link:#doc-result[DocResult] entities is returned describing the
+results.
+
+.Request
+----
+ GET /Documentation/?q=test HTTP/1.0
+----
+
+.Response
+----
+ HTTP/1.1 200 OK
+ Content-Disposition: attachment
+ Content-Type: application/json; charset=UTF-8
+
+ )]}'
+ [
+ {
+ "title": "Gerrit Code Review - REST API Developers\u0027 Notes",
+ "url": "Documentation/dev-rest-api.html"
+ },
+ {
+ "title": "Gerrit Code Review - REST API",
+ "url": "Documentation/rest-api.html"
+ },
+ {
+ "title": "Gerrit Code Review - JavaScript API",
+ "url": "Documentation/js-api.html"
+ },
+ {
+ "title": "Gerrit Code Review - /plugins/ REST API",
+ "url": "Documentation/rest-api-plugins.html"
+ },
+ {
+ "title": "Gerrit Code Review - /config/ REST API",
+ "url": "Documentation/rest-api-config.html"
+ },
+ {
+ "title": "Gerrit Code Review for Git",
+ "url": "Documentation/index.html"
+ },
+ {
+ "title": "Gerrit Code Review - /access/ REST API",
+ "url": "Documentation/rest-api-access.html"
+ },
+ {
+ "title": "Gerrit Code Review - Plugin Development",
+ "url": "Documentation/dev-plugins.html"
+ },
+ {
+ "title": "Gerrit Code Review - Developer Setup",
+ "url": "Documentation/dev-readme.html"
+ },
+ {
+ "title": "Gerrit Code Review - Hooks",
+ "url": "Documentation/config-hooks.html"
+ },
+ {
+ "title": "Change Screen - Introduction",
+ "url": "Documentation/intro-change-screen.html"
+ },
+ {
+ "title": "Gerrit Code Review - /groups/ REST API",
+ "url": "Documentation/rest-api-groups.html"
+ },
+ {
+ "title": "Gerrit Code Review - /accounts/ REST API",
+ "url": "Documentation/rest-api-accounts.html"
+ },
+ {
+ "title": "Gerrit Code Review - /projects/ REST API",
+ "url": "Documentation/rest-api-documentation.html"
+ },
+ {
+ "title": "Gerrit Code Review - /projects/ REST API",
+ "url": "Documentation/rest-api-projects.html"
+ },
+ {
+ "title": "Gerrit Code Review - Prolog Submit Rules Cookbook",
+ "url": "Documentation/prolog-cookbook.html"
+ },
+ {
+ "title": "Gerrit Code Review - /changes/ REST API",
+ "url": "Documentation/rest-api-changes.html"
+ },
+ {
+ "title": "Gerrit Code Review - Configuration",
+ "url": "Documentation/config-gerrit.html"
+ },
+ {
+ "title": "Gerrit Code Review - Access Controls",
+ "url": "Documentation/access-control.html"
+ },
+ {
+ "title": "Gerrit Code Review - Licenses",
+ "url": "Documentation/licenses.html"
+ }
+ ]
+----
+
+.Query documentation
+****
+get::/Documentation/?q=keyword
+****
+
+
+[[json-entities]]
+JSON Entities
+-------------
+
+[[doc-result]]
+DocResult
+~~~~~~~~~
+The `DocResult` entity contains information about a document.
+
+[options="header",width="50%",cols="1,^2,4"]
+|=========================
+|Field Name ||Description
+|`title` ||The title of the document.
+|`url` ||The URL of the document.
+|=========================
+
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/rest-api-groups.txt b/Documentation/rest-api-groups.txt
index 6289e5a..e96607c 100644
--- a/Documentation/rest-api-groups.txt
+++ b/Documentation/rest-api-groups.txt
@@ -1239,3 +1239,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/rest-api-plugins.txt b/Documentation/rest-api-plugins.txt
index 2cc80f0..f5b6809 100644
--- a/Documentation/rest-api-plugins.txt
+++ b/Documentation/rest-api-plugins.txt
@@ -45,12 +45,12 @@
"delete-project": {
"kind": "gerritcodereview#plugin",
"id": "delete-project",
- "version": "2.8-SNAPSHOT"
+ "version": "2.9-SNAPSHOT"
},
"reviewers-by-blame": {
"kind": "gerritcodereview#plugin",
"id": "reviewers-by-blame",
- "version": "2.8-SNAPSHOT",
+ "version": "2.9-SNAPSHOT",
"disabled": true
}
}
@@ -277,3 +277,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/rest-api-projects.txt b/Documentation/rest-api-projects.txt
index 35db183..1ac232a 100644
--- a/Documentation/rest-api-projects.txt
+++ b/Documentation/rest-api-projects.txt
@@ -1515,3 +1515,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/rest-api.txt b/Documentation/rest-api.txt
index 7eed6ef..bedf218 100644
--- a/Documentation/rest-api.txt
+++ b/Documentation/rest-api.txt
@@ -23,6 +23,8 @@
Plugin related REST endpoints
link:rest-api-projects.html[/projects/]::
Project related REST endpoints
+link:rest-api-documentation.html[/Documentation/]::
+ Documentation related REST endpoints
Protocol Details
----------------
@@ -169,3 +171,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/user-changeid.txt b/Documentation/user-changeid.txt
index c13faa6..ca60819 100644
--- a/Documentation/user-changeid.txt
+++ b/Documentation/user-changeid.txt
@@ -169,3 +169,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/user-dashboards.txt b/Documentation/user-dashboards.txt
index 0945153..1c5162a 100644
--- a/Documentation/user-dashboards.txt
+++ b/Documentation/user-dashboards.txt
@@ -169,3 +169,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/user-notify.txt b/Documentation/user-notify.txt
index 558dcb5..dd7d4bd 100644
--- a/Documentation/user-notify.txt
+++ b/Documentation/user-notify.txt
@@ -145,3 +145,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index 7c4ca52..058be89 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -454,3 +454,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/user-signedoffby.txt b/Documentation/user-signedoffby.txt
index 56858bf..c5ae135 100644
--- a/Documentation/user-signedoffby.txt
+++ b/Documentation/user-signedoffby.txt
@@ -175,3 +175,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/user-submodules.txt b/Documentation/user-submodules.txt
index 6aab43f..fbf45d7 100644
--- a/Documentation/user-submodules.txt
+++ b/Documentation/user-submodules.txt
@@ -187,3 +187,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/user-upload.txt b/Documentation/user-upload.txt
index cbb152c3..0569630 100644
--- a/Documentation/user-upload.txt
+++ b/Documentation/user-upload.txt
@@ -445,3 +445,6 @@
GERRIT
------
Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/VERSION b/VERSION
index 23c7033..6a132bb 100644
--- a/VERSION
+++ b/VERSION
@@ -2,4 +2,4 @@
# Used by :api_install and :api_deploy targets
# when talking to the destination repository.
#
-GERRIT_VERSION = '2.8-SNAPSHOT'
+GERRIT_VERSION = '2.9-SNAPSHOT'
diff --git a/contrib/themes/spotify/static/background-gradient.png b/contrib/themes/spotify/static/background-gradient.png
index b40f35b..3b9422e 100644
--- a/contrib/themes/spotify/static/background-gradient.png
+++ b/contrib/themes/spotify/static/background-gradient.png
Binary files differ
diff --git a/contrib/themes/spotify/static/logo.png b/contrib/themes/spotify/static/logo.png
index bfe1fce..c231031 100644
--- a/contrib/themes/spotify/static/logo.png
+++ b/contrib/themes/spotify/static/logo.png
Binary files differ
diff --git a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/annotations/PluginCanonicalWebUrl.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/annotations/PluginCanonicalWebUrl.java
new file mode 100644
index 0000000..fd14429
--- /dev/null
+++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/annotations/PluginCanonicalWebUrl.java
@@ -0,0 +1,42 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.extensions.annotations;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import com.google.inject.BindingAnnotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation applied to a String containing the plugin canonical web URL.
+ * <p>
+ * A plugin or extension may receive this string by Guice injection to discover
+ * the canonical web URL under which the plugin is available:
+ *
+ * <pre>
+ * @Inject
+ * MyType(@PluginCanonicalWebUrl String myUrl) {
+ * ...
+ * }
+ * </pre>
+ */
+@Target({ElementType.PARAMETER, ElementType.FIELD})
+@Retention(RUNTIME)
+@BindingAnnotation
+public @interface PluginCanonicalWebUrl {
+}
diff --git a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/config/DownloadScheme.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/config/DownloadScheme.java
index 20eda97..d81657a 100644
--- a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/config/DownloadScheme.java
+++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/config/DownloadScheme.java
@@ -30,9 +30,7 @@
public abstract boolean isAuthRequired();
/** @return whether this scheme supports authentication */
- public boolean isAuthSupported() {
- return isAuthRequired();
- }
+ public abstract boolean isAuthSupported();
/** @return whether the download scheme is enabled */
public abstract boolean isEnabled();
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java
index 40e5252..7b5389e 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java
@@ -71,6 +71,7 @@
import com.google.gerrit.client.dashboards.DashboardInfo;
import com.google.gerrit.client.dashboards.DashboardList;
import com.google.gerrit.client.diff.SideBySide2;
+import com.google.gerrit.client.documentation.DocScreen;
import com.google.gerrit.client.groups.GroupApi;
import com.google.gerrit.client.groups.GroupInfo;
import com.google.gerrit.client.patches.PatchScreen;
@@ -201,6 +202,9 @@
if (matchPrefix("/q/", token)) {
query(token);
+ } else if (matchPrefix("/Documentation/", token)) {
+ docSearch(token);
+
} else if (matchPrefix("/c/", token)) {
change(token);
@@ -884,4 +888,12 @@
}
}
}
+
+ private static void docSearch(final String token) {
+ GWT.runAsync(new AsyncSplit(token) {
+ public void onSuccess() {
+ Gerrit.display(token, new DocScreen(skip(token)));
+ }
+ });
+ }
}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties
index 333dcfa..0aeeac6 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties
@@ -77,14 +77,14 @@
Confirm the default path <em>.ssh/id_rsa</em>\
</li>\
<li>\
- Enter a passphrase (recommended) or leave it blank.<br>\
- Remember this passphrase, as you will need it to unlock the<br>\
+ Enter a passphrase (recommended) or leave it blank.<br />\
+ Remember this passphrase, as you will need it to unlock the<br />\
key whenever you use it.\
</li>\
<li>\
- Open <em>~/.ssh/id_rsa.pub</em> and copy & paste the contents into<br>\
- the box below, then click on "Add".<br>\
- Note that <em>id_rsa.pub</em> is your public key and can be shared,<br>\
+ Open <em>~/.ssh/id_rsa.pub</em> and copy & paste the contents into<br />\
+ the box below, then click on "Add".<br />\
+ Note that <em>id_rsa.pub</em> is your public key and can be shared,<br />\
while <em>id_rsa</em> is your private key and should be kept secret.\
</li>\
<\ol>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
index 331afee..da88034 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
@@ -102,9 +102,11 @@
protected void initColumnHeaders() {
super.initColumnHeaders();
if (Gerrit.getGitwebLink() != null) {
- table.setText(0, 3, Util.C.projectRepoBrowser());
+ table.setText(0, ProjectsTable.C_REPO_BROWSER,
+ Util.C.projectRepoBrowser());
table.getFlexCellFormatter().
- addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
+ addStyleName(0, ProjectsTable.C_REPO_BROWSER,
+ Gerrit.RESOURCES.css().dataHeader());
}
}
@@ -122,7 +124,8 @@
super.insert(row, k);
if (Gerrit.getGitwebLink() != null) {
table.getFlexCellFormatter().
- addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
+ addStyleName(row, ProjectsTable.C_REPO_BROWSER,
+ Gerrit.RESOURCES.css().dataCell());
}
}
@@ -131,11 +134,12 @@
FlowPanel fp = new FlowPanel();
fp.add(new ProjectSearchLink(k.name_key()));
fp.add(new HighlightingInlineHyperlink(k.name(), link(k), subname));
- table.setWidget(row, 1, fp);
- table.setText(row, 2, k.description());
+ table.setWidget(row, ProjectsTable.C_NAME, fp);
+ table.setText(row, ProjectsTable.C_DESCRIPTION, k.description());
GitwebLink l = Gerrit.getGitwebLink();
if (l != null) {
- table.setWidget(row, 3, new Anchor(l.getLinkName(), false, l.toProject(k
+ table.setWidget(row, ProjectsTable.C_REPO_BROWSER,
+ new Anchor(l.getLinkName(), false, l.toProject(k
.name_key())));
}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteHover.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteHover.png
index 839e8ef..9fde3fa 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteHover.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteHover.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteNormal.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteNormal.png
index ffddb6f..47a1195 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteNormal.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteNormal.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/editText.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/editText.png
index 188e1c1..2927275 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/editText.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/editText.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/undoNormal.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/undoNormal.png
index 8b0fef9..b780f75 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/undoNormal.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/undoNormal.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java
index c8eb13a..75ca6b3 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java
@@ -56,6 +56,8 @@
import java.util.TreeSet;
class ReplyBox extends Composite {
+ private static final String CODE_REVIEW = "Code-Review";
+
interface Binder extends UiBinder<HTMLPanel, ReplyBox> {}
private static final Binder uiBinder = GWT.create(Binder.class);
@@ -67,7 +69,7 @@
private final PatchSet.Id psId;
private final String revision;
private ReviewInput in = ReviewInput.create();
- private List<Runnable> lgtm;
+ private Runnable lgtm;
@UiField Styles style;
@UiField NpTextArea message;
@@ -91,7 +93,6 @@
UIObject.setVisible(labelsParent, false);
} else {
Collections.sort(names);
- lgtm = new ArrayList<Runnable>(names.size());
renderLabels(names, all, permitted);
}
}
@@ -118,11 +119,7 @@
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
- if (message.getValue().startsWith("LGTM")) {
- for (Runnable r : lgtm) {
- r.run();
- }
- }
+ lgtm.run();
}
});
}
@@ -236,8 +233,8 @@
}
}
- if (!group.isEmpty()) {
- lgtm.add(new Runnable() {
+ if (CODE_REVIEW.equalsIgnoreCase(id) && !group.isEmpty()) {
+ lgtm = new Runnable() {
@Override
public void run() {
for (int i = 0; i < group.size() - 1; i++) {
@@ -245,7 +242,7 @@
}
group.get(group.size() - 1).setValue(true, true);
}
- });
+ };
}
}
@@ -269,12 +266,14 @@
b.setStyleName(style.label_name());
labelsTable.setWidget(row, 0, b);
- lgtm.add(new Runnable() {
- @Override
- public void run() {
- b.setValue(true, true);
- }
- });
+ if (CODE_REVIEW.equalsIgnoreCase(id)) {
+ lgtm = new Runnable() {
+ @Override
+ public void run() {
+ b.setValue(true, true);
+ }
+ };
+ }
}
private static boolean isCheckBox(Set<Short> values) {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/remove_reviewer.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/remove_reviewer.png
index 9e494dd..5a3e6f0 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/remove_reviewer.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/remove_reviewer.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/star_filled.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/star_filled.png
index 39bddb1..db1e24e 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/star_filled.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/star_filled.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerNormal.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerNormal.png
index 839e8ef..9fde3fa 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerNormal.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerNormal.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerPressed.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerPressed.png
index 2e509ec..e46f0aa 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerPressed.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerPressed.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.java
new file mode 100644
index 0000000..f6b7a9d
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.java
@@ -0,0 +1,25 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.documentation;
+
+import com.google.gwt.i18n.client.Constants;
+
+public interface DocConstants extends Constants {
+ String keyReloadSearch();
+
+ String docItemHelp();
+ String docTableColumnTitle();
+ String docTableNone();
+}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.properties
new file mode 100644
index 0000000..b48c507
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.properties
@@ -0,0 +1,5 @@
+keyReloadSearch = Reload documentation list
+
+docItemHelp = documentation
+docTableColumnTitle = Title
+docTableNone = (None)
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocInfo.java
new file mode 100644
index 0000000..6235186
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocInfo.java
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.documentation;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.JavaScriptObject;
+
+public class DocInfo extends JavaScriptObject {
+
+ public final native String title() /*-{ return this.title; }-*/;
+ public final native String url() /*-{ return this.url; }-*/;
+
+ protected DocInfo() {
+ }
+
+ public final String getFullUrl() {
+ return GWT.getHostPageBaseURL() + url();
+ }
+}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.java
new file mode 100644
index 0000000..df62b92
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.java
@@ -0,0 +1,22 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.documentation;
+
+import com.google.gwt.i18n.client.Messages;
+
+public interface DocMessages extends Messages {
+ String docQueryWindowTitle(String query);
+ String docQueryPageTitle(String query);
+}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.properties
new file mode 100644
index 0000000..8810a4a
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.properties
@@ -0,0 +1,2 @@
+docQueryWindowTitle = {0}
+docQueryPageTitle = Search for {0} in documentation
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocScreen.java
new file mode 100644
index 0000000..0a87d29
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocScreen.java
@@ -0,0 +1,78 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.documentation;
+
+import com.google.gerrit.client.rpc.GerritCallback;
+import com.google.gerrit.client.rpc.RestApi;
+import com.google.gerrit.client.ui.Screen;
+import com.google.gwt.core.client.JsArray;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwtorm.client.KeyUtil;
+
+public class DocScreen extends Screen {
+ private static final String URI = "/Documentation/";
+
+ private DocTable table;
+ private final String query;
+
+ public DocScreen(String query) {
+ this.query = KeyUtil.decode(query);
+ }
+
+ @Override
+ protected void onInitUI() {
+ super.onInitUI();
+
+ table = new DocTable();
+ table.setSavePointerId(query);
+ add(table);
+
+ setWindowTitle(Util.M.docQueryWindowTitle(query));
+ setPageTitle(Util.M.docQueryPageTitle(query));
+ }
+
+ @Override
+ protected void onLoad() {
+ super.onLoad();
+ doQuery();
+ }
+
+ @Override
+ public void registerKeys() {
+ super.registerKeys();
+ table.setRegisterKeys(true);
+ }
+
+ private AsyncCallback<JsArray<DocInfo>> loadCallback() {
+ return new GerritCallback<JsArray<DocInfo>>() {
+ @Override
+ public void onSuccess(JsArray<DocInfo> result) {
+ displayResults(result);
+ display();
+ }
+ };
+ }
+
+ private void displayResults(JsArray<DocInfo> result) {
+ table.display(result);
+ table.finishDisplay();
+ }
+
+ private void doQuery() {
+ RestApi call = new RestApi(URI);
+ call.addParameterRaw("q", KeyUtil.encode(query));
+ call.get(loadCallback());
+ }
+}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocTable.java
new file mode 100644
index 0000000..f176372
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocTable.java
@@ -0,0 +1,125 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.documentation;
+
+import com.google.gerrit.client.Gerrit;
+import com.google.gerrit.client.ui.NavigationTable;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.core.client.JsArray;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
+import com.google.gwt.user.client.ui.HTMLTable.Cell;
+import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
+
+class DocTable extends NavigationTable<DocInfo> {
+ private static final int C_TITLE = 1;
+
+ private int rows = 0;
+ private int dataBeginRow = 0;
+
+ public DocTable() {
+ super(Util.C.docItemHelp());
+
+ table.setText(0, C_TITLE, Util.C.docTableColumnTitle());
+
+ FlexCellFormatter fmt = table.getFlexCellFormatter();
+ fmt.addStyleName(0, C_TITLE, Gerrit.RESOURCES.css().dataHeader());
+
+ table.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ Cell cell = table.getCellForEvent(event);
+ if (cell == null) {
+ return;
+ }
+ if (getRowItem(cell.getRowIndex()) != null) {
+ movePointerTo(cell.getRowIndex());
+ }
+ }
+ });
+ }
+
+ @Override
+ protected Object getRowItemKey(DocInfo item) {
+ return item.url();
+ }
+
+ @Override
+ protected void onOpenRow(int row) {
+ DocInfo d = getRowItem(row);
+ Window.Location.assign(d.getFullUrl());
+ }
+
+ private void insertNoneRow(int row) {
+ table.insertRow(row);
+ table.setText(row, 0, Util.C.docTableNone());
+ FlexCellFormatter fmt = table.getFlexCellFormatter();
+ fmt.setStyleName(row, 0, Gerrit.RESOURCES.css().emptySection());
+ }
+
+ private void insertDocRow(int row) {
+ table.insertRow(row);
+ applyDataRowStyle(row);
+ }
+
+ @Override
+ protected void applyDataRowStyle(int row) {
+ super.applyDataRowStyle(row);
+ CellFormatter fmt = table.getCellFormatter();
+ fmt.addStyleName(row, C_TITLE, Gerrit.RESOURCES.css().dataCell());
+ fmt.addStyleName(row, C_TITLE, Gerrit.RESOURCES.css().cSUBJECT());
+ }
+
+ private void populateDocRow(int row, DocInfo d) {
+ table.setWidget(row, C_TITLE, new DocLink(d));
+ setRowItem(row, d);
+ }
+
+ public void display(JsArray<DocInfo> docList) {
+ int sz = docList != null ? docList.length() : 0;
+ boolean hadData = rows > 0;
+
+ if (hadData) {
+ while (sz < rows) {
+ table.removeRow(dataBeginRow);
+ rows--;
+ }
+ } else {
+ table.removeRow(dataBeginRow);
+ }
+
+ if (sz == 0) {
+ insertNoneRow(dataBeginRow);
+ return;
+ }
+
+ while (rows < sz) {
+ insertDocRow(dataBeginRow + rows);
+ rows++;
+ }
+ for (int i = 0; i < sz; i++) {
+ populateDocRow(dataBeginRow + i, docList.get(i));
+ }
+ }
+
+ public static class DocLink extends Anchor {
+ public DocLink(DocInfo d) {
+ super(com.google.gerrit.client.changes.Util.cropSubject(d.title()));
+ setHref(d.getFullUrl());
+ }
+ }
+}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/Util.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/Util.java
new file mode 100644
index 0000000..273ead8
--- /dev/null
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/Util.java
@@ -0,0 +1,22 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.documentation;
+
+import com.google.gwt.core.client.GWT;
+
+public class Util {
+ public static final DocConstants C = GWT.create(DocConstants.class);
+ public static final DocMessages M = GWT.create(DocMessages.class);
+}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/downloadIcon.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/downloadIcon.png
index 22ff495..1a6520e 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/downloadIcon.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/downloadIcon.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/draftComments.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/draftComments.png
index 31c770f..276912a 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/draftComments.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/draftComments.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editText.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editText.png
index 188e1c1..2927275 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editText.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editText.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/greenCheck.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/greenCheck.png
index cd70687..207c0e7 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/greenCheck.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/greenCheck.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/queryIcon.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/queryIcon.png
index 5aace51..5ebf2cb 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/queryIcon.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/queryIcon.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/redNot.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/redNot.png
index 4e83a8f..99834fd 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/redNot.png
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/redNot.png
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectsTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectsTable.java
index 052878b..a99348d 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectsTable.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectsTable.java
@@ -25,6 +25,9 @@
import java.util.List;
public class ProjectsTable extends NavigationTable<ProjectInfo> {
+ public static final int C_NAME = 1;
+ public static final int C_DESCRIPTION = 2;
+ public static final int C_REPO_BROWSER = 3;
public ProjectsTable() {
super(Util.C.projectItemHelp());
@@ -32,12 +35,12 @@
}
protected void initColumnHeaders() {
- table.setText(0, 1, Util.C.projectName());
- table.setText(0, 2, Util.C.projectDescription());
+ table.setText(0, C_NAME, Util.C.projectName());
+ table.setText(0, C_DESCRIPTION, Util.C.projectDescription());
final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
+ fmt.addStyleName(0, C_NAME, Gerrit.RESOURCES.css().dataHeader());
+ fmt.addStyleName(0, C_DESCRIPTION, Gerrit.RESOURCES.css().dataHeader());
}
@Override
@@ -75,16 +78,16 @@
applyDataRowStyle(row);
final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().projectNameColumn());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
+ fmt.addStyleName(row, C_NAME, Gerrit.RESOURCES.css().dataCell());
+ fmt.addStyleName(row, C_NAME, Gerrit.RESOURCES.css().projectNameColumn());
+ fmt.addStyleName(row, C_DESCRIPTION, Gerrit.RESOURCES.css().dataCell());
populate(row, k);
}
protected void populate(final int row, final ProjectInfo k) {
- table.setText(row, 1, k.name());
- table.setText(row, 2, k.description());
+ table.setText(row, C_NAME, k.name());
+ table.setText(row, C_DESCRIPTION, k.description());
setRowItem(row, k);
}
diff --git a/gerrit-httpd/BUCK b/gerrit-httpd/BUCK
index 512e6e6..c20b589 100644
--- a/gerrit-httpd/BUCK
+++ b/gerrit-httpd/BUCK
@@ -1,4 +1,6 @@
-SRCS = glob(['src/main/java/**/*.java'])
+SRCS = glob(
+ ['src/main/java/**/*.java'],
+)
RESOURCES = glob(['src/main/resources/**/*'])
java_library2(
@@ -30,6 +32,7 @@
'//lib/jgit:jgit',
'//lib/jgit:jgit-servlet',
'//lib/log:api',
+ '//lib/lucene:core',
],
compile_deps = ['//lib:servlet-api-3_0'],
visibility = ['PUBLIC'],
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/CookieBase64.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/CookieBase64.java
index 3bcdcd2..fab9f1b 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/CookieBase64.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/CookieBase64.java
@@ -33,8 +33,9 @@
}
private static int fill(final char[] out, int o, final char f, final int l) {
- for (char c = f; c <= l; c++)
+ for (char c = f; c <= l; c++) {
out[o++] = c;
+ }
return o;
}
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
index 2980159..79aca6d 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
@@ -136,7 +136,7 @@
config.setReportBugUrl(null);
}
- config.setGitBasicAuth(authConfig.isGitBasichAuth());
+ config.setGitBasicAuth(authConfig.isGitBasicAuth());
final Set<Account.FieldName> fields = new HashSet<Account.FieldName>();
for (final Account.FieldName n : Account.FieldName.values()) {
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GitOverHttpModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GitOverHttpModule.java
index 6ca9949..4f4c783 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GitOverHttpModule.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GitOverHttpModule.java
@@ -34,7 +34,7 @@
Class<? extends Filter> authFilter;
if (authConfig.isTrustContainerAuth()) {
authFilter = ContainerAuthFilter.class;
- } else if (authConfig.isGitBasichAuth()) {
+ } else if (authConfig.isGitBasicAuth()) {
authFilter = ProjectBasicAuthFilter.class;
} else {
authFilter = ProjectDigestFilter.class;
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/UrlModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/UrlModule.java
index bf39bfb..3c4dfc5 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/UrlModule.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/UrlModule.java
@@ -30,6 +30,7 @@
import com.google.gerrit.httpd.rpc.change.ChangesRestApiServlet;
import com.google.gerrit.httpd.rpc.change.DeprecatedChangeQueryServlet;
import com.google.gerrit.httpd.rpc.config.ConfigRestApiServlet;
+import com.google.gerrit.httpd.rpc.doc.QueryDocumentationFilter;
import com.google.gerrit.httpd.rpc.group.GroupsRestApiServlet;
import com.google.gerrit.httpd.rpc.project.ProjectsRestApiServlet;
import com.google.gerrit.reviewdb.client.Change;
@@ -110,6 +111,8 @@
serveRegex("^/(?:a/)?groups/(.*)?$").with(GroupsRestApiServlet.class);
serveRegex("^/(?:a/)?projects/(.*)?$").with(ProjectsRestApiServlet.class);
+ filter("/Documentation/").through(QueryDocumentationFilter.class);
+
if (cfg.deprecatedQuery) {
serve("/query").with(DeprecatedChangeQueryServlet.class);
}
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/auth/become/BecomeAnyAccountLoginServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/auth/become/BecomeAnyAccountLoginServlet.java
index 28e361c..2dde16e 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/auth/become/BecomeAnyAccountLoginServlet.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/auth/become/BecomeAnyAccountLoginServlet.java
@@ -168,7 +168,7 @@
Element userlistElement = HtmlDomUtil.find(doc, "userlist");
ReviewDb db = schema.open();
try {
- ResultSet<Account> accounts = db.accounts().firstNById(5);
+ ResultSet<Account> accounts = db.accounts().firstNById(100);
for (Account a : accounts) {
String displayName;
if (a.getUserName() != null) {
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java
index 517b017..2e1cc06 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/restapi/RestApiServlet.java
@@ -607,7 +607,7 @@
throw new InstantiationException("Cannot make " + type);
}
- private static void replyJson(@Nullable HttpServletRequest req,
+ public static void replyJson(@Nullable HttpServletRequest req,
HttpServletResponse res,
Multimap<String, String> config,
Object result)
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/doc/QueryDocumentationFilter.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/doc/QueryDocumentationFilter.java
new file mode 100644
index 0000000..002b520
--- /dev/null
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/doc/QueryDocumentationFilter.java
@@ -0,0 +1,74 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.httpd.rpc.doc;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.LinkedHashMultimap;
+import com.google.common.collect.Multimap;
+import com.google.gerrit.httpd.restapi.RestApiServlet;
+import com.google.gerrit.server.documentation.QueryDocumentationExecutor;
+import com.google.gerrit.server.documentation.QueryDocumentationExecutor.DocQueryException;
+import com.google.gerrit.server.documentation.QueryDocumentationExecutor.DocResult;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Singleton
+public class QueryDocumentationFilter implements Filter {
+ private final QueryDocumentationExecutor searcher;
+
+ @Inject
+ QueryDocumentationFilter(QueryDocumentationExecutor searcher) {
+ this.searcher = searcher;
+ }
+
+ @Override
+ public void init(FilterConfig filterConfig) {
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+ @Override
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+ throws IOException, ServletException {
+ HttpServletRequest req = (HttpServletRequest) request;
+ if ("GET".equals(req.getMethod())
+ && !Strings.isNullOrEmpty(req.getParameter("q"))) {
+ HttpServletResponse rsp = (HttpServletResponse) response;
+ try {
+ List<DocResult> result = searcher.doQuery(request.getParameter("q"));
+ Multimap<String, String> config = LinkedHashMultimap.create();
+ RestApiServlet.replyJson(req, rsp, config, result);
+ } catch (DocQueryException e) {
+ rsp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ } else {
+ chain.doFilter(request, response);
+ }
+ }
+}
diff --git a/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java b/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java
index 2dd20a2..44226bc 100644
--- a/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java
+++ b/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java
@@ -302,6 +302,7 @@
}
private volatile static File myArchive;
+ private volatile static File myHome;
/**
* Locate the JAR/WAR file we were launched from.
@@ -459,42 +460,26 @@
return tmp;
}
+ /**
+ * Provide path to a working directory
+ *
+ * @return local path of the working directory or null if cannot be determined
+ */
+ public static File getHomeDirectory() {
+ if (myHome == null) {
+ myHome = locateHomeDirectory();
+ }
+ return myHome;
+ }
+
+
private static File tmproot() {
File tmp;
String gerritTemp = System.getenv("GERRIT_TMP");
if (gerritTemp != null && gerritTemp.length() > 0) {
tmp = new File(gerritTemp);
} else {
- // Try to find the user's home directory. If we can't find it
- // return null so the JVM's default temporary directory is used
- // instead. This is probably /tmp or /var/tmp.
- //
- String userHome = System.getProperty("user.home");
- if (userHome == null || "".equals(userHome)) {
- userHome = System.getenv("HOME");
- if (userHome == null || "".equals(userHome)) {
- System.err.println("warning: cannot determine home directory");
- System.err.println("warning: using system temporary directory instead");
- return null;
- }
- }
-
- // Ensure the home directory exists. If it doesn't, try to make it.
- //
- final File home = new File(userHome);
- if (!home.exists()) {
- if (home.mkdirs()) {
- System.err.println("warning: created " + home.getAbsolutePath());
- } else {
- System.err.println("warning: " + home.getAbsolutePath() + " not found");
- System.err.println("warning: using system temporary directory instead");
- return null;
- }
- }
-
- // Use $HOME/.gerritcodereview/tmp for our temporary file area.
- //
- tmp = new File(new File(home, ".gerritcodereview"), "tmp");
+ tmp = new File(getHomeDirectory(), "tmp");
}
if (!tmp.exists() && !tmp.mkdirs()) {
System.err.println("warning: cannot create " + tmp.getAbsolutePath());
@@ -527,6 +512,49 @@
}
}
+ private static File locateHomeDirectory() {
+ // Try to find the user's home directory. If we can't find it
+ // return null so the JVM's default temporary directory is used
+ // instead. This is probably /tmp or /var/tmp.
+ //
+ String userHome = System.getProperty("user.home");
+ if (userHome == null || "".equals(userHome)) {
+ userHome = System.getenv("HOME");
+ if (userHome == null || "".equals(userHome)) {
+ System.err.println("warning: cannot determine home directory");
+ System.err.println("warning: using system temporary directory instead");
+ return null;
+ }
+ }
+
+ // Ensure the home directory exists. If it doesn't, try to make it.
+ //
+ final File home = new File(userHome);
+ if (!home.exists()) {
+ if (home.mkdirs()) {
+ System.err.println("warning: created " + home.getAbsolutePath());
+ } else {
+ System.err.println("warning: " + home.getAbsolutePath() + " not found");
+ System.err.println("warning: using system temporary directory instead");
+ return null;
+ }
+ }
+
+ // Use $HOME/.gerritcodereview/tmp for our temporary file area.
+ //
+ final File gerrithome = new File(home, ".gerritcodereview");
+ if (!gerrithome.exists() && !gerrithome.mkdirs()) {
+ System.err.println("warning: cannot create " + gerrithome.getAbsolutePath());
+ System.err.println("warning: using system temporary directory instead");
+ return null;
+ }
+ try {
+ return gerrithome.getCanonicalFile();
+ } catch (IOException e) {
+ return gerrithome;
+ }
+ }
+
private GerritLauncher() {
}
}
diff --git a/gerrit-patch-jgit/BUCK b/gerrit-patch-jgit/BUCK
index 18890ac..1e0953f 100644
--- a/gerrit-patch-jgit/BUCK
+++ b/gerrit-patch-jgit/BUCK
@@ -30,3 +30,15 @@
],
visibility = ['PUBLIC'],
)
+
+java_test(
+ name = 'jgit_patch_tests',
+ srcs = glob(['src/test/java/**/*.java']),
+ deps = [
+ ':server',
+ '//lib/jgit:jgit',
+ '//lib:junit',
+ ],
+ source_under_test = [':server'],
+ visibility = ['//tools/eclipse:classpath'],
+)
diff --git a/gerrit-patch-jgit/src/test/java/org/eclipse/jgit/diff/EditDeserializerTest.java b/gerrit-patch-jgit/src/test/java/org/eclipse/jgit/diff/EditDeserializerTest.java
new file mode 100644
index 0000000..d4bb26f
--- /dev/null
+++ b/gerrit-patch-jgit/src/test/java/org/eclipse/jgit/diff/EditDeserializerTest.java
@@ -0,0 +1,25 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.eclipse.jgit.diff;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jgit.diff.EditDeserializer;
+
+public class EditDeserializerTest extends TestCase {
+ public void testDiffDeserializer() {
+ assertNotNull("edit deserializer", new EditDeserializer());
+ }
+}
diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Daemon.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Daemon.java
index 6adaf32..35d8e76 100644
--- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Daemon.java
+++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Daemon.java
@@ -35,6 +35,7 @@
import com.google.gerrit.pgm.http.jetty.JettyEnv;
import com.google.gerrit.pgm.http.jetty.JettyModule;
import com.google.gerrit.pgm.http.jetty.ProjectQoSFilter;
+import com.google.gerrit.pgm.shell.JythonShell;
import com.google.gerrit.pgm.util.ErrorLogFile;
import com.google.gerrit.pgm.util.GarbageCollectionLogFile;
import com.google.gerrit.pgm.util.LogFileCompressor;
@@ -59,6 +60,7 @@
import com.google.gerrit.server.patch.IntraLineWorkerPool;
import com.google.gerrit.server.plugins.PluginGuiceEnvironment;
import com.google.gerrit.server.plugins.PluginRestApiModule;
+import com.google.gerrit.server.schema.DataSourceProvider;
import com.google.gerrit.server.schema.SchemaVersionCheck;
import com.google.gerrit.server.ssh.NoSshKeyCache;
import com.google.gerrit.server.ssh.NoSshModule;
@@ -114,6 +116,9 @@
@Option(name = "--console-log", usage = "Log to console (not $site_path/logs)")
private boolean consoleLog;
+ @Option(name = "-s", usage = "Start interactive shell")
+ private boolean inspector;
+
@Option(name = "--run-id", usage = "Cookie to store in $site_path/logs/gerrit.run")
private String runId;
@@ -216,7 +221,15 @@
serverStarted.run();
}
- RuntimeShutdown.waitFor();
+ if (inspector) {
+ JythonShell shell = new JythonShell();
+ shell.set("m", manager);
+ shell.set("ds", dbInjector.getInstance(DataSourceProvider.class));
+ shell.set("schk", dbInjector.getInstance(SchemaVersionCheck.class));
+ shell.run();
+ } else {
+ RuntimeShutdown.waitFor();
+ }
return 0;
} catch (Throwable err) {
log.error("Unable to start daemon", err);
diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/HiddenErrorHandler.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/HiddenErrorHandler.java
index e086e6a..9fd8929 100644
--- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/HiddenErrorHandler.java
+++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/HiddenErrorHandler.java
@@ -65,8 +65,9 @@
private static byte[] message(AbstractHttpConnection conn) {
String msg = conn.getResponse().getReason();
- if (msg == null)
+ if (msg == null) {
msg = HttpStatus.getMessage(conn.getResponse().getStatus());
+ }
return msg.getBytes(Charsets.ISO_8859_1);
}
diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/shell/JythonShell.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/shell/JythonShell.java
new file mode 100644
index 0000000..4ad91d9
--- /dev/null
+++ b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/shell/JythonShell.java
@@ -0,0 +1,221 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.pgm.shell;
+
+import com.google.gerrit.launcher.GerritLauncher;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Properties;
+
+public class JythonShell {
+ private static final Logger log = LoggerFactory.getLogger(JythonShell.class);
+ private static final String STARTUP_RESOURCE = "com/google/gerrit/pgm/Startup.py";
+ private static final String STARTUP_FILE = "Startup.py";
+
+ private Class<?> console;
+ private Class<?> pyObject;
+ private Class<?> pySystemState;
+ private Object shell;
+ private ArrayList <String> injectedVariables;
+
+ public JythonShell() {
+ Properties env = new Properties();
+ // Let us inspect private class members
+ env.setProperty("python.security.respectJavaAccessibility", "false");
+
+ File home = GerritLauncher.getHomeDirectory();
+ if (home != null) {
+ env.setProperty("python.cachedir", new File(home, "jythoncache").getPath());
+ }
+
+ // For package introspection and "import com.google" to work,
+ // Jython needs to inspect actual .jar files (not just classloader)
+ StringBuilder classPath = new StringBuilder();
+ final ClassLoader cl = getClass().getClassLoader();
+ if (cl instanceof java.net.URLClassLoader) {
+ URLClassLoader ucl = (URLClassLoader) cl;
+ for (URL u : ucl.getURLs()) {
+ if ("file".equals(u.getProtocol())) {
+ if (classPath.length() > 0) {
+ classPath.append(java.io.File.pathSeparatorChar);
+ }
+ classPath.append(u.getFile());
+ }
+ }
+ }
+ env.setProperty("java.class.path", classPath.toString());
+
+ console = findClass("org.python.util.InteractiveConsole");
+ pyObject = findClass("org.python.core.PyObject");
+ pySystemState = findClass("org.python.core.PySystemState");
+
+ runMethod(pySystemState, pySystemState, "initialize",
+ new Class[] { Properties.class, Properties.class },
+ new Object[] { null, env }
+ );
+
+ try {
+ shell = console.newInstance();
+ log.info("Jython shell instance created.");
+ } catch (InstantiationException e) {
+ throw noInterpreter(e);
+ } catch (IllegalAccessException e) {
+ throw noInterpreter(e);
+ }
+ injectedVariables = new ArrayList<String>();
+ set("Shell", this);
+ }
+
+ protected Object runMethod0(Class<?> klazz, Object instance,
+ String name, Class<?>[] sig, Object[] args)
+ throws InvocationTargetException {
+ try {
+ Method m;
+ m = klazz.getMethod(name, sig);
+ return m.invoke(instance, args);
+ } catch (NoSuchMethodException e) {
+ throw cannotStart(e);
+ } catch (SecurityException e) {
+ throw cannotStart(e);
+ } catch (IllegalArgumentException e) {
+ throw cannotStart(e);
+ } catch (IllegalAccessException e) {
+ throw cannotStart(e);
+ }
+ }
+
+ protected Object runMethod(Class<?> klazz, Object instance,
+ String name, Class<?>[] sig, Object[] args) {
+ try {
+ return runMethod0(klazz, instance, name, sig, args);
+ } catch (InvocationTargetException e) {
+ throw cannotStart(e);
+ }
+ }
+
+ protected Object runInterpreter(String name, Class<?>[] sig, Object[] args) {
+ return runMethod(console, shell, name, sig, args);
+ }
+
+ protected String getDefaultBanner() {
+ return (String)runInterpreter("getDefaultBanner",
+ new Class[] { }, new Object[] { });
+ }
+
+ protected void printInjectedVariable(String id) {
+ runInterpreter("exec",
+ new Class[] { String.class },
+ new Object[] { "print '\"%s\" is \"%s\"' % (\"" + id + "\", " + id + ")" }
+ );
+ }
+
+ public void run() {
+ for (String key : injectedVariables) {
+ printInjectedVariable(key);
+ }
+ reload();
+ runInterpreter("interact",
+ new Class[] { String.class, pyObject },
+ new Object[] { getDefaultBanner() +
+ " running for Gerrit " + com.google.gerrit.common.Version.getVersion(),
+ null });
+ }
+
+ public void set(String key, Object content) {
+ runInterpreter("set",
+ new Class[] { String.class, Object.class },
+ new Object[] { key, content }
+ );
+ injectedVariables.add(key);
+ }
+
+ private static Class<?> findClass(String klazzname) {
+ try {
+ return Class.forName(klazzname);
+ } catch (ClassNotFoundException e) {
+ throw noShell("Class " + klazzname + " not found", e);
+ }
+ }
+
+ public void reload() {
+ execResource(STARTUP_RESOURCE);
+ execFile(GerritLauncher.getHomeDirectory(), STARTUP_FILE);
+ }
+
+ protected void execResource(final String p) {
+ InputStream in = JythonShell.class.getClassLoader().getResourceAsStream(p);
+ if (in != null) {
+ execStream(in, "resource " + p);
+ } else {
+ log.error("Cannot load resource " + p);
+ }
+ }
+
+ protected void execFile(final File parent, final String p) {
+ try {
+ File script = new File(parent, p);
+ if (script.canExecute()) {
+ runMethod0(console, shell, "execfile",
+ new Class[] { String.class },
+ new Object[] { script.getAbsolutePath() }
+ );
+ } else {
+ log.info("User initialization file "
+ + script.getAbsolutePath()
+ + " is not found or not executable");
+ }
+ } catch (InvocationTargetException e) {
+ log.error("Exception occured while loading file " + p + " : ", e);
+ } catch (SecurityException e) {
+ log.error("SecurityException occured while loading file " + p + " : ", e);
+ }
+ }
+
+ protected void execStream(final InputStream in, final String p) {
+ try {
+ runMethod0(console, shell, "execfile",
+ new Class[] { InputStream.class, String.class },
+ new Object[] { in, p }
+ );
+ } catch (InvocationTargetException e) {
+ log.error("Exception occured while loading " + p + " : ", e);
+ }
+ }
+
+ private static UnsupportedOperationException noShell(final String m, Throwable why) {
+ final String prefix = "Cannot create Jython shell: ";
+ final String postfix = "\n (You might need to install jython.jar in the lib directory)";
+ return new UnsupportedOperationException(prefix + m + postfix, why);
+ }
+
+ private static UnsupportedOperationException noInterpreter(Throwable why) {
+ final String msg = "Cannot create Python interpreter";
+ return noShell(msg, why);
+ }
+
+ private static UnsupportedOperationException cannotStart(Throwable why) {
+ final String msg = "Cannot start Jython shell";
+ return new UnsupportedOperationException(msg, why);
+ }
+}
diff --git a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/Startup.py b/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/Startup.py
new file mode 100644
index 0000000..92d6e56
--- /dev/null
+++ b/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/Startup.py
@@ -0,0 +1,31 @@
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# -----------------------------------------------------------------------
+# Startup script for Gerrit Inspector - a Jython introspector
+# -----------------------------------------------------------------------
+
+import sys
+
+def help():
+ for (n, v) in vars(sys.modules['__main__']).items():
+ if not n.startswith("__") and not n in ['help', 'reload'] \
+ and str(type(v)) != "<type 'javapackage'>" \
+ and not str(v).startswith("<module"):
+ print "\"%s\" is \"%s\"" % (n, v)
+ print
+ print "Welcome to the Gerrit Inspector"
+ print "Enter help() to see the above again, EOF to quit and stop Gerrit"
+
+help()
diff --git a/gerrit-plugin-archetype/pom.xml b/gerrit-plugin-archetype/pom.xml
index 1b33510..401f126 100644
--- a/gerrit-plugin-archetype/pom.xml
+++ b/gerrit-plugin-archetype/pom.xml
@@ -20,7 +20,7 @@
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-archetype</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.9-SNAPSHOT</version>
<name>Gerrit Code Review - Plugin Archetype</name>
<properties>
diff --git a/gerrit-plugin-gwt-archetype/pom.xml b/gerrit-plugin-gwt-archetype/pom.xml
index 3c4dc99..56e6c95 100644
--- a/gerrit-plugin-gwt-archetype/pom.xml
+++ b/gerrit-plugin-gwt-archetype/pom.xml
@@ -20,7 +20,7 @@
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-gwt-archetype</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.9-SNAPSHOT</version>
<name>Gerrit Code Review - Web Ui GWT Plugin Archetype</name>
<properties>
diff --git a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/java/public/gwt-hello-gadgets-igoogle-thumb.png b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/java/public/gwt-hello-gadgets-igoogle-thumb.png
index e970774..d45c63f 100644
--- a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/java/public/gwt-hello-gadgets-igoogle-thumb.png
+++ b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/java/public/gwt-hello-gadgets-igoogle-thumb.png
Binary files differ
diff --git a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/java/public/gwt-hello-gadgets-igoogle.png b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/java/public/gwt-hello-gadgets-igoogle.png
index c041149..5c9009a 100644
--- a/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/java/public/gwt-hello-gadgets-igoogle.png
+++ b/gerrit-plugin-gwt-archetype/src/main/resources/archetype-resources/src/main/java/public/gwt-hello-gadgets-igoogle.png
Binary files differ
diff --git a/gerrit-plugin-gwtui/pom.xml b/gerrit-plugin-gwtui/pom.xml
index 3c9e2ca..948f13e 100644
--- a/gerrit-plugin-gwtui/pom.xml
+++ b/gerrit-plugin-gwtui/pom.xml
@@ -21,7 +21,7 @@
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-gwtui</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.9-SNAPSHOT</version>
<name>Gerrit Code Review - Plugin GWT UI</name>
<description>
diff --git a/gerrit-plugin-js-archetype/pom.xml b/gerrit-plugin-js-archetype/pom.xml
index 681d7a9..eb32b11 100644
--- a/gerrit-plugin-js-archetype/pom.xml
+++ b/gerrit-plugin-js-archetype/pom.xml
@@ -20,7 +20,7 @@
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-js-archetype</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.9-SNAPSHOT</version>
<name>Gerrit Code Review - Web UI JavaScript Plugin Archetype</name>
<properties>
diff --git a/gerrit-server/BUCK b/gerrit-server/BUCK
index 1db7555..8119502 100644
--- a/gerrit-server/BUCK
+++ b/gerrit-server/BUCK
@@ -1,15 +1,28 @@
+CONSTANTS_SRC = [
+ 'src/main/java/com/google/gerrit/server/documentation/Constants.java',
+]
+
SRCS = glob([
- 'src/main/java/**/*.java',
- 'src/test/java/com/google/gerrit/server/project/Util.java'
-])
+ 'src/main/java/**/*.java',
+ 'src/test/java/com/google/gerrit/server/project/Util.java',
+ ],
+ excludes = CONSTANTS_SRC,
+)
RESOURCES = glob(['src/main/resources/**/*'])
+java_library2(
+ name = 'constants',
+ srcs = CONSTANTS_SRC,
+ visibility = ['PUBLIC'],
+)
+
# TODO(sop) break up gerrit-server java_library(), its too big
java_library2(
name = 'server',
srcs = SRCS,
resources = RESOURCES,
deps = [
+ ':constants',
'//gerrit-antlr:query_exception',
'//gerrit-antlr:query_parser',
'//gerrit-common:server',
@@ -48,6 +61,9 @@
'//lib/joda:joda-time',
'//lib/log:api',
'//lib/prolog:prolog-cafe',
+ '//lib/lucene:analyzers-common',
+ '//lib/lucene:core',
+ '//lib/lucene:query-parser',
],
compile_deps = [
'//lib/bouncycastle:bcprov',
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/DefaultFileExtensionRegistry.java b/gerrit-server/src/main/java/com/google/gerrit/server/DefaultFileExtensionRegistry.java
new file mode 100644
index 0000000..15062ac
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/DefaultFileExtensionRegistry.java
@@ -0,0 +1,104 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.server;
+
+import com.google.common.collect.ImmutableMap;
+
+import eu.medsea.mimeutil.MimeType;
+import eu.medsea.mimeutil.MimeUtil;
+import eu.medsea.mimeutil.detector.MimeDetector;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+
+public class DefaultFileExtensionRegistry extends MimeDetector {
+ private static final MimeType INI = newMimeType("text/x-ini", 2);
+ private static final MimeType PYTHON = newMimeType("text/x-python", 2);
+
+ private static final ImmutableMap<String, MimeType> TYPES = ImmutableMap.of(
+ ".gitmodules", INI,
+ "project.config", INI,
+ "BUCK", PYTHON,
+ "defs", newMimeType(PYTHON.toString(), 1),
+ "go", newMimeType("text/x-go", 1));
+
+ private static MimeType newMimeType(String type, final int specificity) {
+ return new MimeType(type) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public int getSpecificity() {
+ return specificity;
+ }
+ };
+ }
+
+ static {
+ for (MimeType type : TYPES.values()) {
+ MimeUtil.addKnownMimeType(type);
+ }
+ }
+
+ @Override
+ public String getDescription() {
+ return getClass().getName();
+ }
+
+ @Override
+ protected Collection<MimeType> getMimeTypesFileName(String name) {
+ int s = name.lastIndexOf('/');
+ if (s >= 0) {
+ name = name.substring(s + 1);
+ }
+
+ MimeType type = TYPES.get(name);
+ if (type != null) {
+ return Collections.singletonList(type);
+ }
+
+ int d = name.lastIndexOf('.');
+ if (0 < d) {
+ type = TYPES.get(name.substring(d + 1));
+ if (type != null) {
+ return Collections.singletonList(type);
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
+ @Override
+ protected Collection<MimeType> getMimeTypesFile(File file) {
+ return getMimeTypesFileName(file.getName());
+ }
+
+ @Override
+ protected Collection<MimeType> getMimeTypesURL(URL url) {
+ return getMimeTypesFileName(url.getPath());
+ }
+
+ @Override
+ protected Collection<MimeType> getMimeTypesInputStream(InputStream arg0) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ protected Collection<MimeType> getMimeTypesByteArray(byte[] arg0) {
+ return Collections.emptyList();
+ }
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/MimeUtilFileTypeRegistry.java b/gerrit-server/src/main/java/com/google/gerrit/server/MimeUtilFileTypeRegistry.java
index b271d6a..ff46b00 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/MimeUtilFileTypeRegistry.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/MimeUtilFileTypeRegistry.java
@@ -54,13 +54,13 @@
if (HostPlatform.isWin32()) {
register("eu.medsea.mimeutil.detector.WindowsRegistryMimeDetector");
}
+ register(DefaultFileExtensionRegistry.class.getName());
}
private void register(String name) {
mimeUtil.registerMimeDetector(name);
}
-
/**
* Get specificity of mime types with generic types forced to low values
*
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeJson.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeJson.java
index f64e424..6373e6e 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeJson.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/ChangeJson.java
@@ -551,10 +551,10 @@
Maps.newHashMapWithExpectedSize(labels.size());
if (detailed) {
- for (String name : labels.keySet()) {
+ for (Map.Entry<String, LabelInfo> entry : labels.entrySet()) {
ApprovalInfo ai = approvalInfo(accountId, 0, null);
- byLabel.put(name, ai);
- labels.get(name).addApproval(ai);
+ byLabel.put(entry.getKey(), ai);
+ entry.getValue().addApproval(ai);
}
}
for (PatchSetApproval psa : current.get(accountId)) {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java
index 367087c..30eca7b 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java
@@ -121,8 +121,8 @@
public CommentRange range;
}
- static class Output {
- Map<String, Short> labels;
+ public static class Output {
+ public Map<String, Short> labels;
}
private final Provider<ReviewDb> db;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/AuthConfig.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/AuthConfig.java
index 0b414f2..6d01e7c5 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/config/AuthConfig.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/AuthConfig.java
@@ -197,7 +197,7 @@
}
/** Whether git-over-http should use Gerrit basic authentication scheme. */
- public boolean isGitBasichAuth() {
+ public boolean isGitBasicAuth() {
return gitBasicAuth;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java
index 6a90165..1ed0baed 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java
@@ -67,6 +67,7 @@
import com.google.gerrit.server.auth.UniversalAuthBackend;
import com.google.gerrit.server.avatar.AvatarProvider;
import com.google.gerrit.server.cache.CacheRemovalListener;
+import com.google.gerrit.server.documentation.QueryDocumentationExecutor;
import com.google.gerrit.server.events.EventFactory;
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
import com.google.gerrit.server.git.ChangeCache;
@@ -135,6 +136,7 @@
protected void configure() {
bind(EmailExpander.class).toProvider(EmailExpanderProvider.class).in(
SINGLETON);
+ bind(QueryDocumentationExecutor.class).in(SINGLETON);
bind(IdGenerator.class);
bind(RulesCache.class);
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/data/ChangeAttribute.java b/gerrit-server/src/main/java/com/google/gerrit/server/data/ChangeAttribute.java
index 7339829..5f5fd33 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/data/ChangeAttribute.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/data/ChangeAttribute.java
@@ -43,4 +43,5 @@
public List<DependencyAttribute> dependsOn;
public List<DependencyAttribute> neededBy;
public List<SubmitRecordAttribute> submitRecords;
+ public List<AccountAttribute> allReviewers;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/documentation/Constants.java b/gerrit-server/src/main/java/com/google/gerrit/server/documentation/Constants.java
new file mode 100644
index 0000000..bfa2de2
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/documentation/Constants.java
@@ -0,0 +1,24 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.server.documentation;
+
+public class Constants {
+
+ public static final String DOC_FIELD = "doc";
+ public static final String TITLE_FIELD = "title";
+ public static final String URL_FIELD = "url";
+
+ private Constants() {}
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/documentation/QueryDocumentationExecutor.java b/gerrit-server/src/main/java/com/google/gerrit/server/documentation/QueryDocumentationExecutor.java
new file mode 100644
index 0000000..576ed9f
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/documentation/QueryDocumentationExecutor.java
@@ -0,0 +1,152 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.server.documentation;
+
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.queryparser.classic.ParseException;
+import org.apache.lucene.queryparser.classic.QueryParser;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class QueryDocumentationExecutor {
+ private static final Logger log =
+ LoggerFactory.getLogger(QueryDocumentationExecutor.class);
+
+ private static final String INDEX_PATH = "index.zip";
+ private static final Version LUCENE_VERSION = Version.LUCENE_44;
+
+ private IndexSearcher searcher;
+ private QueryParser parser;
+
+ public static class DocResult {
+ public String title;
+ public String url;
+ public String content;
+ }
+
+ @Inject
+ public QueryDocumentationExecutor() {
+ try {
+ Directory dir = readIndexDirectory();
+ if (dir == null) {
+ searcher = null;
+ parser = null;
+ return;
+ }
+ IndexReader reader = DirectoryReader.open(dir);
+ searcher = new IndexSearcher(reader);
+ StandardAnalyzer analyzer = new StandardAnalyzer(LUCENE_VERSION);
+ parser = new QueryParser(LUCENE_VERSION, Constants.DOC_FIELD, analyzer);
+ } catch (IOException e) {
+ log.error("Cannot initialize documentation full text index", e);
+ searcher = null;
+ parser = null;
+ }
+ }
+
+ public List<DocResult> doQuery(String q) throws DocQueryException {
+ if (parser == null || searcher == null) {
+ throw new DocQueryException("Documentation search not available");
+ }
+ try {
+ Query query = parser.parse(q);
+ // TODO(fishywang): Currently as we don't have much documentation, we just use MAX_VALUE here
+ // and skipped paging. Maybe add paging later.
+ TopDocs results = searcher.search(query, Integer.MAX_VALUE);
+ ScoreDoc[] hits = results.scoreDocs;
+ int totalHits = results.totalHits;
+
+ List<DocResult> out = Lists.newArrayListWithCapacity(totalHits);
+ for (int i = 0; i < totalHits; i++) {
+ DocResult result = new DocResult();
+ Document doc = searcher.doc(hits[i].doc);
+ result.url = doc.get(Constants.URL_FIELD);
+ result.title = doc.get(Constants.TITLE_FIELD);
+ out.add(result);
+ }
+ return out;
+ } catch (IOException e) {
+ throw new DocQueryException(e);
+ } catch (ParseException e) {
+ throw new DocQueryException(e);
+ }
+ }
+
+ protected Directory readIndexDirectory() throws IOException {
+ Directory dir = new RAMDirectory();
+ byte[] buffer = new byte[4096];
+ InputStream index =
+ QueryDocumentationExecutor.class.getClassLoader()
+ .getResourceAsStream(INDEX_PATH);
+ if (index == null) {
+ log.warn("No index available");
+ return null;
+ }
+ ZipInputStream zip = new ZipInputStream(index);
+ try {
+ ZipEntry entry;
+ while ((entry = zip.getNextEntry()) != null) {
+ IndexOutput out = dir.createOutput(entry.getName(), null);
+ int count;
+ while ((count = zip.read(buffer)) != -1) {
+ out.writeBytes(buffer, count);
+ }
+ out.close();
+ }
+ } finally {
+ zip.close();
+ }
+ // We must NOT call dir.close() here, as DirectoryReader.open() expects an opened directory.
+ return dir;
+ }
+
+ @SuppressWarnings("serial")
+ public static class DocQueryException extends Exception {
+ DocQueryException() {
+ }
+
+ DocQueryException(String msg) {
+ super(msg);
+ }
+
+ DocQueryException(String msg, Throwable e) {
+ super(msg, e);
+ }
+
+ DocQueryException(Throwable e) {
+ super(e);
+ }
+ }
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/events/EventFactory.java b/gerrit-server/src/main/java/com/google/gerrit/server/events/EventFactory.java
index 98e803f..58d16dc 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/events/EventFactory.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/events/EventFactory.java
@@ -14,6 +14,8 @@
package com.google.gerrit.server.events;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
@@ -69,6 +71,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.Set;
@Singleton
public class EventFactory {
@@ -158,6 +161,29 @@
}
/**
+ * Add allReviewers to an existing ChangeAttribute.
+ *
+ * @param a
+ * @param change
+ */
+ public void addAllReviewers(ChangeAttribute a, Change change)
+ throws OrmException {
+ List<PatchSetApproval> approvals =
+ db.get().patchSetApprovals().byChange(change.getId()).toList();
+ if (!approvals.isEmpty()) {
+ a.allReviewers = Lists.newArrayList();
+ Set<Account.Id> seen = Sets.newHashSet();
+ for (PatchSetApproval psa : approvals) {
+ Account.Id id = psa.getAccountId();
+ if (!seen.contains(id)) {
+ seen.add(id);
+ a.allReviewers.add(asAccountAttribute(id));
+ }
+ }
+ }
+ }
+
+ /**
* Add submitRecords to an existing ChangeAttribute.
*
* @param ca
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
index 06e88e4..3800d9a 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
@@ -328,7 +328,7 @@
final ChangeCache changeCache,
final ChangeInserter.Factory changeInserterFactory,
final CommitValidators.Factory commitValidatorsFactory,
- @CanonicalWebUrl @Nullable final String canonicalWebUrl,
+ @CanonicalWebUrl final String canonicalWebUrl,
@GerritPersonIdent final PersonIdent gerritIdent,
final TrackingFooters trackingFooters,
final WorkQueue workQueue,
@@ -404,9 +404,10 @@
if (allRefs == null) {
try {
allRefs = rp.getRepository().getRefDatabase().getRefs(ALL);
+ } catch (ServiceMayNotContinueException e) {
+ throw e;
} catch (IOException e) {
- ServiceMayNotContinueException ex =
- new ServiceMayNotContinueException(e.getMessage());
+ ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
ex.initCause(e);
throw ex;
}
@@ -591,22 +592,42 @@
return input.created;
}
});
- if (!Iterables.isEmpty(created) && canonicalWebUrl != null) {
- final String url = canonicalWebUrl;
+ if (!Iterables.isEmpty(created)) {
addMessage("");
addMessage("New Changes:");
for (CreateRequest c : created) {
- StringBuilder m = new StringBuilder()
- .append(" ")
- .append(url)
- .append(c.change.getChangeId());
- if (c.change.getStatus() == Change.Status.DRAFT) {
- m.append(" [DRAFT]");
- }
- addMessage(m.toString());
+ addMessage(formatChangeUrl(canonicalWebUrl, c.change));
}
addMessage("");
}
+
+ Iterable<ReplaceRequest> updated =
+ Iterables.filter(replaceByChange.values(),
+ new Predicate<ReplaceRequest>() {
+ @Override
+ public boolean apply(ReplaceRequest input) {
+ return !input.skip;
+ }
+ });
+ if (!Iterables.isEmpty(updated)) {
+ addMessage("");
+ addMessage("Updated Changes:");
+ for (ReplaceRequest u : updated) {
+ addMessage(formatChangeUrl(canonicalWebUrl, u.change));
+ }
+ addMessage("");
+ }
+ }
+
+ private static String formatChangeUrl(String url, Change change) {
+ StringBuilder m = new StringBuilder()
+ .append(" ")
+ .append(url)
+ .append(change.getChangeId());
+ if (change.getStatus() == Change.Status.DRAFT) {
+ m.append(" [DRAFT]");
+ }
+ return m.toString();
}
private void insertChangesAndPatchSets() {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommitsAdvertiseRefsHook.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommitsAdvertiseRefsHook.java
index 530a388..f34ce8b 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommitsAdvertiseRefsHook.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommitsAdvertiseRefsHook.java
@@ -68,9 +68,10 @@
if (oldRefs == null) {
try {
oldRefs = rp.getRepository().getRefDatabase().getRefs(ALL);
+ } catch (ServiceMayNotContinueException e) {
+ throw e;
} catch (IOException e) {
- ServiceMayNotContinueException ex =
- new ServiceMayNotContinueException(e.getMessage());
+ ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
ex.initCause(e);
throw ex;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/VisibleRefFilter.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/VisibleRefFilter.java
index 8c65b1a..14aae94 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/VisibleRefFilter.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/VisibleRefFilter.java
@@ -127,9 +127,10 @@
RevWalk revWalk) throws ServiceMayNotContinueException {
try {
return filter(repository.getRefDatabase().getRefs(RefDatabase.ALL));
+ } catch (ServiceMayNotContinueException e) {
+ throw e;
} catch (IOException e) {
- ServiceMayNotContinueException ex =
- new ServiceMayNotContinueException(e.getMessage());
+ ServiceMayNotContinueException ex = new ServiceMayNotContinueException();
ex.initCause(e);
throw ex;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
index e1294e0..b71d04a 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
@@ -311,8 +311,8 @@
MergeFormatter fmt = new MergeFormatter();
Map<String, MergeResult<? extends Sequence>> r = m.getMergeResults();
Map<String, ObjectId> resolved = new HashMap<String, ObjectId>();
- for (String path : r.keySet()) {
- MergeResult<? extends Sequence> p = r.get(path);
+ for (Map.Entry<String, MergeResult<? extends Sequence>> entry : r.entrySet()) {
+ MergeResult<? extends Sequence> p = entry.getValue();
TemporaryBuffer buf = new TemporaryBuffer.LocalFile(10 * 1024 * 1024);
try {
fmt.formatMerge(buf, p, "BASE", oursName, theirsName, "UTF-8");
@@ -320,7 +320,7 @@
InputStream in = buf.openInputStream();
try {
- resolved.put(path, ins.insert(Constants.OBJ_BLOB, buf.length(), in));
+ resolved.put(entry.getKey(), ins.insert(Constants.OBJ_BLOB, buf.length(), in));
} finally {
in.close();
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/plugins/JarPlugin.java b/gerrit-server/src/main/java/com/google/gerrit/server/plugins/JarPlugin.java
index 6adc677..1568997 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/plugins/JarPlugin.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/plugins/JarPlugin.java
@@ -17,6 +17,7 @@
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
+import com.google.gerrit.extensions.annotations.PluginCanonicalWebUrl;
import com.google.gerrit.extensions.annotations.PluginData;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.extensions.registration.RegistrationHandle;
@@ -59,6 +60,7 @@
private final JarFile jarFile;
private final Manifest manifest;
private final File dataDir;
+ private final String pluginCanonicalWebUrl;
private final ClassLoader classLoader;
private Class<? extends Module> sysModule;
private Class<? extends Module> sshModule;
@@ -71,6 +73,7 @@
private List<ReloadableRegistrationHandle<?>> reloadableHandles;
public JarPlugin(String name,
+ String pluginCanonicalWebUrl,
PluginUser pluginUser,
File srcJar,
FileSnapshot snapshot,
@@ -83,6 +86,7 @@
@Nullable Class<? extends Module> sshModule,
@Nullable Class<? extends Module> httpModule) {
super(name, srcJar, pluginUser, snapshot, apiType);
+ this.pluginCanonicalWebUrl = pluginCanonicalWebUrl;
this.jarFile = jarFile;
this.manifest = manifest;
this.dataDir = dataDir;
@@ -193,6 +197,9 @@
bind(String.class)
.annotatedWith(PluginName.class)
.toInstance(getName());
+ bind(String.class)
+ .annotatedWith(PluginCanonicalWebUrl.class)
+ .toInstance(pluginCanonicalWebUrl);
bind(File.class)
.annotatedWith(PluginData.class)
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginLoader.java b/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginLoader.java
index 7569744..4682d2b 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginLoader.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginLoader.java
@@ -14,6 +14,7 @@
package com.google.gerrit.server.plugins;
+import com.google.common.base.CharMatcher;
import com.google.common.base.Joiner;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
@@ -30,6 +31,7 @@
import com.google.gerrit.extensions.systemstatus.ServerInformation;
import com.google.gerrit.extensions.webui.JavaScriptPlugin;
import com.google.gerrit.server.PluginUser;
+import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.gerrit.server.config.ConfigUtil;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.SitePaths;
@@ -86,6 +88,7 @@
private final Queue<Plugin> toCleanup;
private final Provider<PluginCleanerTask> cleaner;
private final PluginScannerThread scanner;
+ private final Provider<String> urlProvider;
@Inject
public PluginLoader(SitePaths sitePaths,
@@ -93,7 +96,8 @@
ServerInformationImpl sii,
PluginUser.Factory puf,
Provider<PluginCleanerTask> pct,
- @GerritServerConfig Config cfg) {
+ @GerritServerConfig Config cfg,
+ @CanonicalWebUrl Provider<String> provider) {
pluginsDir = sitePaths.plugins_dir;
dataDir = sitePaths.data_dir;
tmpDir = sitePaths.tmp_dir;
@@ -106,6 +110,7 @@
toCleanup = Queues.newArrayDeque();
cleanupHandles = Maps.newConcurrentMap();
cleaner = pct;
+ urlProvider = provider;
long checkFrequency = ConfigUtil.getTimeUnit(cfg,
"plugins", null, "checkFrequency",
@@ -344,8 +349,9 @@
syncDisabledPlugins(jars);
Map<String, File> activePlugins = filterDisabled(jars);
- for (String name : activePlugins.keySet()) {
- File jar = activePlugins.get(name);
+ for (Map.Entry<String, File> entry : activePlugins.entrySet()) {
+ String name = entry.getKey();
+ File jar = entry.getValue();
FileSnapshot brokenTime = broken.get(name);
if (brokenTime != null && !brokenTime.isModified(jar)) {
continue;
@@ -504,7 +510,13 @@
Class<? extends Module> sysModule = load(sysName, pluginLoader);
Class<? extends Module> sshModule = load(sshName, pluginLoader);
Class<? extends Module> httpModule = load(httpName, pluginLoader);
- Plugin plugin = new JarPlugin(name, pluginUserFactory.create(name),
+
+ String url = String.format("%s/plugins/%s/",
+ CharMatcher.is('/').trimTrailingFrom(urlProvider.get()),
+ name);
+
+ Plugin plugin = new JarPlugin(name, url,
+ pluginUserFactory.create(name),
srcJar, snapshot,
jarFile, manifest,
new File(dataDir, name), type, pluginLoader,
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/QueryProcessor.java b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/QueryProcessor.java
index 5624f45..e569ff5 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/QueryProcessor.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/QueryProcessor.java
@@ -113,6 +113,7 @@
private boolean includeCommitMessage;
private boolean includeDependencies;
private boolean includeSubmitRecords;
+ private boolean includeAllReviewers;
private OutputStream outputStream = DisabledOutputStream.INSTANCE;
private PrintWriter out;
@@ -200,6 +201,10 @@
includeSubmitRecords = on;
}
+ public void setIncludeAllReviewers(boolean on) {
+ includeAllReviewers = on;
+ }
+
public void setOutput(OutputStream out, OutputFormat fmt) {
this.outputStream = out;
this.outputFormat = fmt;
@@ -304,6 +309,10 @@
eventFactory.extend(c, d.getChange());
eventFactory.addTrackingIds(c, d.trackingIds(db));
+ if (includeAllReviewers) {
+ eventFactory.addAllReviewers(c, d.getChange());
+ }
+
if (includeSubmitRecords) {
PatchSet.Id psId = d.getChange().currentPatchSetId();
PatchSet patchSet = db.get().patchSets().get(psId);
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/change/CommentsTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/change/CommentsTest.java
index 18b3c98..6fc08f3 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/change/CommentsTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/change/CommentsTest.java
@@ -186,9 +186,9 @@
assertNotNull(actual);
assertEquals(expected.size(), actual.size());
assertEquals(expected.keySet(), actual.keySet());
- for (String filename : expected.keySet()) {
- List<PatchLineComment> expectedComments = expected.get(filename);
- List<CommentInfo> actualComments = actual.get(filename);
+ for (Map.Entry<String, ArrayList<PatchLineComment>> entry : expected.entrySet()) {
+ List<PatchLineComment> expectedComments = entry.getValue();
+ List<CommentInfo> actualComments = actual.get(entry.getKey());
assertNotNull(actualComments);
assertEquals(expectedComments.size(), actualComments.size());
for (int i = 0; i < expectedComments.size(); i++) {
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/project/Util.java b/gerrit-server/src/test/java/com/google/gerrit/server/project/Util.java
index a99eba1..c6e621a 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/project/Util.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/project/Util.java
@@ -54,12 +54,12 @@
import java.util.Set;
public class Util {
- public static AccountGroup.UUID ANONYMOUS = AccountGroup.ANONYMOUS_USERS;
- public static AccountGroup.UUID REGISTERED = AccountGroup.REGISTERED_USERS;
- public static AccountGroup.UUID ADMIN = new AccountGroup.UUID("test.admin");
- public static AccountGroup.UUID DEVS = new AccountGroup.UUID("test.devs");
+ public static final AccountGroup.UUID ANONYMOUS = AccountGroup.ANONYMOUS_USERS;
+ public static final AccountGroup.UUID REGISTERED = AccountGroup.REGISTERED_USERS;
+ public static final AccountGroup.UUID ADMIN = new AccountGroup.UUID("test.admin");
+ public static final AccountGroup.UUID DEVS = new AccountGroup.UUID("test.devs");
- public static LabelType CR = category("Code-Review",
+ public static final LabelType CR = category("Code-Review",
value(2, "Looks good to me, approved"),
value(1, "Looks good to me, but someone else must approve"),
value(0, "No score"),
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/util/SubmoduleSectionParserTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/util/SubmoduleSectionParserTest.java
index 299a245..ed86031 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/util/SubmoduleSectionParserTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/util/SubmoduleSectionParserTest.java
@@ -200,8 +200,9 @@
expect(bbc.getSubsections("submodule"))
.andReturn(sectionsToReturn.keySet());
- for (final String id : sectionsToReturn.keySet()) {
- final SubmoduleSection section = sectionsToReturn.get(id);
+ for (Map.Entry<String, SubmoduleSection> entry : sectionsToReturn.entrySet()) {
+ String id = entry.getKey();
+ final SubmoduleSection section = entry.getValue();
expect(bbc.getString("submodule", id, "url")).andReturn(section.getUrl());
expect(bbc.getString("submodule", id, "path")).andReturn(
section.getPath());
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/AproposCommand.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/AproposCommand.java
new file mode 100644
index 0000000..813f132
--- /dev/null
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/AproposCommand.java
@@ -0,0 +1,46 @@
+// Copyright (C) 2013 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.sshd.commands;
+
+import com.google.gerrit.server.config.CanonicalWebUrl;
+import com.google.gerrit.server.documentation.QueryDocumentationExecutor;
+import com.google.gerrit.server.documentation.QueryDocumentationExecutor.DocResult;
+import com.google.gerrit.sshd.CommandMetaData;
+import com.google.gerrit.sshd.SshCommand;
+import com.google.inject.Inject;
+
+import org.kohsuke.args4j.Argument;
+
+import java.util.List;
+
+@CommandMetaData(name = "apropos", description = "Search in Gerrit documentation")
+final class AproposCommand extends SshCommand {
+ @Inject
+ private QueryDocumentationExecutor searcher;
+ @Inject
+ @CanonicalWebUrl String url;
+
+ @Argument(index=0, required = true, metaVar = "QUERY")
+ private String q;
+
+ @Override
+ public void run() throws Exception {
+ List<QueryDocumentationExecutor.DocResult> res = searcher.doQuery(q);
+ for (DocResult docResult : res) {
+ stdout.println(String.format("%s:\n%s%s\n", docResult.title, url,
+ docResult.url));
+ }
+ }
+}
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/DefaultCommandModule.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/DefaultCommandModule.java
index 521103b..429caf6 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/DefaultCommandModule.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/DefaultCommandModule.java
@@ -36,6 +36,7 @@
// SlaveCommandModule.
command(gerrit).toProvider(new DispatchCommandProvider(gerrit));
+ command(gerrit, AproposCommand.class);
command(gerrit, BanCommitCommand.class);
command(gerrit, FlushCaches.class);
command(gerrit, ListProjectsCommand.class);
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/Query.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/Query.java
index 185bb67..af42e1b 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/Query.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/Query.java
@@ -72,6 +72,11 @@
processor.setIncludeDependencies(on);
}
+ @Option(name = "--all-reviewers", usage = "Include all reviewers")
+ void setAllReviewers(boolean on) {
+ processor.setIncludeAllReviewers(on);
+ }
+
@Option(name = "--submit-records", usage = "Include submit and label status")
void setSubmitRecords(boolean on) {
processor.setIncludeSubmitRecords(on);
diff --git a/lib/asciidoctor/BUCK b/lib/asciidoctor/BUCK
index 0b07b69..b1d5933 100644
--- a/lib/asciidoctor/BUCK
+++ b/lib/asciidoctor/BUCK
@@ -31,6 +31,7 @@
srcs = ['java/DocIndexer.java'],
deps = [
':asciidoc_lib',
+ '//gerrit-server:constants',
'//lib:args4j',
'//lib:guava',
'//lib/lucene:analyzers-common',
diff --git a/lib/asciidoctor/java/DocIndexer.java b/lib/asciidoctor/java/DocIndexer.java
index 497cba5..96b1449 100644
--- a/lib/asciidoctor/java/DocIndexer.java
+++ b/lib/asciidoctor/java/DocIndexer.java
@@ -13,6 +13,7 @@
// limitations under the License.
import com.google.common.io.Files;
+import com.google.gerrit.server.documentation.Constants;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.util.CharArraySet;
@@ -43,9 +44,6 @@
public class DocIndexer {
private static final Version LUCENE_VERSION = Version.LUCENE_44;
- private static final String DOC_FIELD = "doc";
- private static final String URL_FIELD = "url";
- private static final String TITLE_FIELD = "title";
@Option(name = "-z", usage = "output zip file")
private String zipFile;
@@ -100,10 +98,10 @@
inputFile, inExt, outExt);
FileReader reader = new FileReader(file);
Document doc = new Document();
- doc.add(new TextField(DOC_FIELD, reader));
+ doc.add(new TextField(Constants.DOC_FIELD, reader));
doc.add(new StringField(
- URL_FIELD, prefix + outputFile, Field.Store.YES));
- doc.add(new TextField(TITLE_FIELD, title, Field.Store.YES));
+ Constants.URL_FIELD, prefix + outputFile, Field.Store.YES));
+ doc.add(new TextField(Constants.TITLE_FIELD, title, Field.Store.YES));
iwriter.addDocument(doc);
reader.close();
}
diff --git a/lib/lucene/BUCK b/lib/lucene/BUCK
index 38ece4c..5973473 100644
--- a/lib/lucene/BUCK
+++ b/lib/lucene/BUCK
@@ -41,6 +41,14 @@
)
maven_jar(
+ name = 'query-parser',
+ id = 'org.apache.lucene:lucene-queryparser:4.4.0',
+ bin_sha1 = 'e2fca26d9c64f3aad7b8a3461dbab14782107a06',
+ src_sha1 = 'f23e42ab90b5b7eb888d394282eba65362e88606',
+ license = 'Apache2.0',
+)
+
+maven_jar(
name = 'spellchecker',
id = 'org.apache.lucene:lucene-spellchecker:3.6.2',
bin_sha1 = '15db0c0cfee44e275f15ad046e46b9a05910ad24',
diff --git a/plugins/commit-message-length-validator b/plugins/commit-message-length-validator
index 45f347d..c173419 160000
--- a/plugins/commit-message-length-validator
+++ b/plugins/commit-message-length-validator
@@ -1 +1 @@
-Subproject commit 45f347d0e258ef7b871b046bfa96b9f902063b10
+Subproject commit c1734194c6a47492b1a5462206f59b585155406e
diff --git a/plugins/cookbook-plugin b/plugins/cookbook-plugin
index 5ee3f28..1b1aca1 160000
--- a/plugins/cookbook-plugin
+++ b/plugins/cookbook-plugin
@@ -1 +1 @@
-Subproject commit 5ee3f28739700e97b91231a2b694f3ba78065e86
+Subproject commit 1b1aca1dd61c033840bc465fa8646c22f5467f3a
diff --git a/plugins/download-commands b/plugins/download-commands
index 05975dd..fe2bc6b 160000
--- a/plugins/download-commands
+++ b/plugins/download-commands
@@ -1 +1 @@
-Subproject commit 05975dd6c8ca44de2e01cede16a94df49a3a825f
+Subproject commit fe2bc6be5ef964a5df247a85f82c0155dc2f8876
diff --git a/plugins/replication b/plugins/replication
index fa66d17..6cb2938 160000
--- a/plugins/replication
+++ b/plugins/replication
@@ -1 +1 @@
-Subproject commit fa66d17b1d6ed3266d0e9061a852fc530ec2ea73
+Subproject commit 6cb293834907a7c059aa05168646ebc9f6b68c5a
diff --git a/plugins/reviewnotes b/plugins/reviewnotes
index 9905f7a..c9fc694 160000
--- a/plugins/reviewnotes
+++ b/plugins/reviewnotes
@@ -1 +1 @@
-Subproject commit 9905f7af6c4e258365413a03f092898b167ea25a
+Subproject commit c9fc694ebd17d8331710c5193e729cee70fab325
diff --git a/tools/build.defs b/tools/build.defs
index b62c850..4bb48ea 100644
--- a/tools/build.defs
+++ b/tools/build.defs
@@ -14,7 +14,12 @@
# These definitions support building a runnable version of Gerrit.
-DOCS = ['//Documentation:html.zip']
+DOCS_SRC = genfile('Documentation/html.zip')
+DOCS_LIB = '//Documentation:index_lib'
+DOCS_DEP = [
+ '//Documentation:html',
+ '//Documentation:index_lib',
+]
LIBS = [
'//gerrit-war:log4j-config',
'//gerrit-war:init',
@@ -36,7 +41,8 @@
libs = [],
pgmlibs = [],
context = [],
- visibility = []
+ visibility = [],
+ docs = False
):
cmd = ['$(exe //tools:pack_war)', '-o', '$OUT', '--tmp', '$TMP']
for l in libs:
@@ -46,6 +52,10 @@
src = []
dep = []
+ if docs:
+ src.append(DOCS_SRC)
+ dep.extend(DOCS_DEP)
+ cmd.extend(['--lib', DOCS_LIB])
if context:
root = get_base_path()
if root:
@@ -56,6 +66,7 @@
r = root + r[2:]
r = r.replace(':', '/')
src.append(genfile(r))
+ if src:
cmd.append('$SRCS')
genrule(
@@ -67,7 +78,7 @@
visibility = visibility,
)
-def gerrit_war(name, ui = 'ui_optdbg', context = []):
+def gerrit_war(name, ui = 'ui_optdbg', context = [], docs = False):
war(
name = name,
libs = LIBS + ['//gerrit-war:version'],
@@ -77,4 +88,5 @@
'//gerrit-war:webapp_assets.zip',
'//gerrit-gwtui:' + ui + '.zip',
] + context,
+ docs = docs,
)
diff --git a/tools/eclipse/BUCK b/tools/eclipse/BUCK
index 9d6dd53..0469bf49 100644
--- a/tools/eclipse/BUCK
+++ b/tools/eclipse/BUCK
@@ -9,9 +9,11 @@
'//gerrit-gwtui:ui_tests',
'//gerrit-httpd:httpd_tests',
'//gerrit-main:main_lib',
+ '//gerrit-patch-jgit:jgit_patch_tests',
'//gerrit-server:server__compile',
'//lib/asciidoctor:asciidoc_lib',
'//lib/asciidoctor:doc_indexer_lib',
'//lib/prolog:compiler_lib',
+ '//Documentation:index_lib',
] + scan_plugins(),
)