diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 0476c1d069..0000000000 --- a/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/.classpath -/.project -/.settings/org.eclipse.jdt.core.prefs -/.settings/org.maven.ide.eclipse.prefs -/test_site diff --git a/COPYING b/COPYING deleted file mode 100644 index d645695673..0000000000 --- a/COPYING +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/Documentation/.gitignore b/Documentation/.gitignore deleted file mode 100644 index 8a3da24187..0000000000 --- a/Documentation/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.html -/.published diff --git a/Documentation/GEN-DOC-VERSION b/Documentation/GEN-DOC-VERSION deleted file mode 100755 index 973bfa8d27..0000000000 --- a/Documentation/GEN-DOC-VERSION +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -V=$(git describe HEAD) - -case "$V" in -'') - echo >&2 "fatal: no annotated tags, cannot determine version" - exit 1 - ;; - -*-g*) - echo >&2 "fatal: snapshot $V, cannot determine version" - exit 1 - ;; - -v*) - echo "$V" | perl -lne 'print $1 if /^v(\d+\.\d+(?:\.\d+)?)/' - ;; -esac diff --git a/Documentation/Makefile b/Documentation/Makefile deleted file mode 100644 index f167cc5325..0000000000 --- a/Documentation/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (C) 2009 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. - -ASCIIDOC ?= asciidoc -ASCIIDOC_EXTRA ?= -SVN ?= svn -PUB_ROOT ?= https://gerrit.googlecode.com/svn/documentation - -all: html - -clean: - rm -f *.html - rm -rf $(LOCAL_ROOT) - -ifeq ($(origin VERSION), undefined) - VERSION := $(shell ./GEN-DOC-VERSION 2>/dev/null) -endif - -DOC_HTML := $(patsubst %.txt,%.html,$(wildcard *.txt)) -LOCAL_ROOT := .published -COMMIT := $(shell git describe HEAD | sed s/^v//) -PUB_DIR := $(PUB_ROOT)/$(VERSION) -PRIOR = PRIOR - -ifeq ($(VERSION),) - REVISION = $(COMMIT) -else - ifeq ($(VERSION),$(COMMIT)) - REVISION := $(VERSION) - else - REVISION := $(VERSION) (from v$(COMMIT)) - endif -endif - -html: $(DOC_HTML) - -update: html -ifeq ($(VERSION),) - ./GEN-DOC-VERSION -endif - @-rm -rf $(LOCAL_ROOT) - @echo "Checking out current $(VERSION)" - @if ! $(SVN) checkout $(PUB_DIR) $(LOCAL_ROOT) 2>/dev/null ; then \ - echo "Copying $(PRIOR) to $(VERSION) ..." && \ - $(SVN) cp -m "Create $(VERSION) documentation" $(PUB_ROOT)/$(PRIOR) $(PUB_DIR) && \ - $(SVN) checkout $(PUB_DIR) $(LOCAL_ROOT) ; \ - fi - @rm -f $(LOCAL_ROOT)/*.html - @cp *.html $(LOCAL_ROOT) - @cd $(LOCAL_ROOT) && \ - r=`$(SVN) status | perl -ne 'print if s/^! *//' ` && \ - if [ -n "$$r" ]; then $(SVN) rm $$r; fi && \ - a=`$(SVN) status | perl -ne 'print if s/^\? *//' ` && \ - if [ -n "$$a" ]; then \ - $(SVN) add $$a && \ - $(SVN) propset svn:mime-type text/html $$a ; \ - fi && \ - echo "Committing $(VERSION) at v$(COMMIT)" && \ - $(SVN) commit -m "Updated $(VERSION) documentation to v$(COMMIT)" - @-rm -rf $(LOCAL_ROOT) - -$(DOC_HTML): %.html : %.txt - @echo "FORMAT $@" - @rm -f $@+ $@ - @$(ASCIIDOC) -a toc \ - -a 'revision=$(REVISION)' \ - -b xhtml11 \ - -f asciidoc.conf \ - $(ASCIIDOC_EXTRA) \ - -o $@+ $< - @mv $@+ $@ diff --git a/Documentation/access-control.txt b/Documentation/access-control.txt deleted file mode 100644 index 0984935b13..0000000000 --- a/Documentation/access-control.txt +++ /dev/null @@ -1,701 +0,0 @@ -Gerrit Code Review - Access Controls -==================================== - -Access controls in Gerrit are group based. Every user account is a -member of one or more groups, and access and privileges are granted -to those groups. Access rights cannot be granted to individual -users. - - -System Groups -------------- - -Gerrit comes with 4 system groups, with special access privileges -and membership management. The identity of these groups is set -in the `system_config` table within the database, so the groups -can be renamed after installation if desired. - -[[administrators]] -Administrators -~~~~~~~~~~~~~~ - -This is the Gerrit "root" identity. - -Users in the 'Administrators' group can perform any action under -the Admin menu, to any group or project, without further validation -of any other access controls. In most installations only those -users who have direct filesystem and database access would be -placed into this group. - -Membership in the 'Administrators' group does not imply any other -access rights. Administrators do not automatically get code review -approval or submit rights in projects. This is a feature designed -to permit administrative users to otherwise access Gerrit as any -other normal user would, without needing two different accounts. - -Anonymous Users -~~~~~~~~~~~~~~~ - -All users are automatically a member of this group. Users who are -not signed in are a member of only this group, and no others. - -Any access rights assigned to this group are inherited by all users. - -Administrators and project owners can grant access rights to this -group in order to permit anonymous users to view project changes, -without requiring sign in first. Currently it is only worthwhile -to grant `Read Access` to this group as Gerrit requires an account -identity for all other operations. - -Registered Users -~~~~~~~~~~~~~~~~ - -All signed-in users are automatically a member of this group (and -also 'Anonymous Users', see above). - -Any access rights assigned to this group are inherited by all -users as soon as they sign-in to Gerrit. If OpenID authentication -is being employed, moving from only 'Anonymous Users' into this -group is very easy. Caution should be taken when assigning any -permissions to this group. - -It is typical to assign `Code Review -1..+1` to this group, -allowing signed-in users to vote on a change, but not actually -cause it to become approved or rejected. - -Registered users are always permitted to make and publish comments -on any change in any project they have `Read Access` to. - -Project Owners -~~~~~~~~~~~~~~ - -Access rights assigned to this group are always evaluated within the -context of a project and are resolved to access rights for all users -which own the project. - -By assigning access rights to this group on a parent project Gerrit -administrators can define a set of default access rights for project -owners. Child projects inherit these access rights where they are -resolved to the users that own the child project. -Having default access rights for projects owners assigned on a parent -project may avoid the need to initially configure access rights for -newly created child projects. - - -Account Groups --------------- - -Account groups contain a list of zero or more user account members, -added individually by a group owner. Any user account listed as -a group member is given any access rights granted to the group. - -Every group has one other group designated as its owner. Users who -are members of the owner group can: - -* Add users to this group -* Remove users from this group -* Change the name of this group -* Change the description of this group -* Change the owner of this group, to another group - -It is permissible for a group to own itself, allowing the group -members to directly manage who their peers are. - -Newly created groups are automatically created as owning themselves, -with the creating user as the only member. This permits the group -creator to add additional members, and change the owner to another -group if desired. - -It is somewhat common to create two groups at the same time, -for example `Foo` and `Foo-admin`, where the latter group -`Foo-admin` owns both itself and also group `Foo`. Users who -are members of `Foo-admin` can thus control the membership of -`Foo`, without actually having the access rights granted to `Foo`. -This configuration can help prevent accidental submits when the -members of `Foo` have submit rights on a project, and the members of -`Foo-admin` typically do not need to have such rights. - - -Project Access Control Lists ----------------------------- - -A system wide access control list affecting all projects is stored in -project "`\-- All Projects \--`". This inheritance can be configured -through link:cmd-set-project-parent.html[gerrit set-project-parent]. - -Per-project access control lists are also supported. - -Users are permitted to use the maximum range granted to any of their -groups in an approval category. For example, a user is a member of -`Foo Leads`, and the following ACLs are granted on a project: - -[options="header"] -|================================================= -|Group |Reference Name |Category|Range -|Anonymous Users |refs/heads/*|Code Review|-1..+1 -|Registered Users|refs/heads/*|Code Review|-1..+2 -|Foo Leads |refs/heads/*|Code Review|-2..0 -|================================================= - -Then the effective range permitted to be used by the user is -`-2..+2`, as the user is a member of all three groups (see above -about the system groups) and the maximum range is chosen (so the -lowest value granted to any group, and the highest value granted -to any group). - -Reference-level access control is also possible. - -Permissions can be set on a single reference name to match one -branch (e.g. `refs/heads/master`), or on a reference namespace -(e.g. `refs/heads/\*`) to match any branch starting with that -prefix. So a permission with `refs/heads/\*` will match -`refs/heads/master` and `refs/heads/experimental`, etc. - -Reference names can also be described with a regular expression -by prefixing the reference name with `\^`. For example -`\^refs/heads/[a-z]\{1,8\}` matches all lower case branch names -between 1 and 8 characters long. Within a regular expression `.` -is a wildcard matching any character, but may be escaped as `\.`. -The link:http://www.brics.dk/automaton/[dk.brics.automaton library] -is used for evaluation of regular expression access control -rules. See the library documentation for details on this -particular regular expression flavor. - -References can have the current user name automatically included, -creating dynamic access controls that change to match the currently -logged in user. For example to provide a personal sandbox space -to all developers, `refs/heads/sandbox/$\{username\}/*` allowing -the user 'joe' to use 'refs/heads/sandbox/joe/foo'. - -When evaluating a reference-level access right, Gerrit will use -the full set of access rights to determine if the user -is allowed to perform a given action. For example, if a user is a -member of `Foo Leads`, they are reviewing a change destined for -the `refs/heads/qa` branch, and the following ACLs are granted -on the project: - -[options="header"] -|===================================================== -|Group |Reference Name|Category |Range -|Registered Users |refs/heads/* |Code Review| -1..+1 -|Foo Leads |refs/heads/* |Code Review| -2..+2 -|QA Leads |refs/heads/qa |Code Review| -2..+2 -|===================================================== - -Then the effective range permitted to be used by the user is -`-2..+2`, as the user's membership of `Foo Leads` effectively grant -them access to the entire reference space, thanks to the wildcard. - -Gerrit also supports exclusive reference-level access control. - -It is possible to configure Gerrit to grant an exclusive ref level -access control so that only users of a specific group can perform -an operation on a project/reference pair. This is done by prefixing -the reference specified with a `'-'`. - -For example, if a user who is a member of `Foo Leads` tries to -review a change destined for branch `refs/heads/qa` in a project, -and the following ACLs are granted: - -[options="header"] -|===================================================== -|Group |Reference Name|Category |Range -|Registered Users|refs/heads/* |Code Review| -1..+1 -|Foo Leads |refs/heads/* |Code Review| -2..+2 -|QA Leads |-refs/heads/qa|Code Review| -2..+2 -|===================================================== - -Then this user will not have `Code Review` rights on that change, -since there is an exclusive access right in place for the -`refs/heads/qa` branch. This allows locking down access for a -particular branch to a limited set of users, bypassing inherited -rights and wildcards. - -In order to grant the ability to `Code Review` to the members of -`Foo Leads`, in `refs/heads/qa` then the following access rights -would be needed: - -[options="header"] -|===================================================== -|Group |Reference Name|Category |Range -|Registered Users|refs/heads/* |Code Review| -1..+1 -|Foo Leads |refs/heads/* |Code Review| -2..+2 -|QA Leads |-refs/heads/qa|Code Review| -2..+2 -|Foo Leads |refs/heads/qa |Code Review| -2..+2 -|===================================================== - - -OpenID Authentication -~~~~~~~~~~~~~~~~~~~~~ - -If the Gerrit instance is configured to use OpenID authentication, -an account's effective group membership will be restricted to only -the `Anonymous Users` and `Registered Users` groups, unless *all* -of its OpenID identities match one or more of the patterns listed -in the `auth.trustedOpenID` list from `gerrit.config`. - -All Projects -~~~~~~~~~~~~ - -Any access right granted to a group within `\-- All Projects \--` -is automatically inherited by every other project in the same -Gerrit instance. These rights can be seen, but not modified, -in any other project's `Access` administration tab. - -Only members of the group `Administrators` may edit the access -control list for `\-- All Projects \--`. - -Ownership of this project cannot be delegated to another group. -This restriction is by design. Granting ownership to another -group gives nearly the same level of access as membership in -`Administrators` does, as group members would be able to alter -permissions for every managed project. - -Per-Project -~~~~~~~~~~~ - -The per-project ACL is evaluated before the global -`\-- All Projects \--` ACL, permitting some limited override -capability to project owners. This behavior is generally only -useful on the `Read Access` category when granting `-1 No Access` -within a specific project to deny access to a group. - - -Categories ----------- - -Gerrit comes pre-configured with several default categories that -can be granted to groups within projects, enabling functionality -for that group's members. - -[[category_OWN]] -Owner -~~~~~ - -The `Owner` category controls which groups can modify the project's -configuration. Users who are members of an owner group can: - -* Change the project description -* Create/delete a branch through the web UI (not SSH) -* Grant/revoke any access rights, including `Owner` - -Note that project owners implicitly have branch creation or deletion -through the web UI, but not through SSH. To get SSH branch access -project owners must grant an access right to a group they are a -member of, just like for any other user. - -Ownership over a particular branch subspace may be delegated by -entering a branch pattern. To delegate control over all branches -that begin with `qa/` to the QA group, add `Owner` category -for reference `refs/heads/qa/\*`. Members of the QA group can -further refine access, but only for references that begin with -`refs/heads/qa/`. - -[[category_READ]] -Read Access -~~~~~~~~~~~ - -The `Read Access` category controls visibility to the project's -changes, comments, code diffs, and Git access over SSH or HTTP. -A user must have `Read Access +1` in order to see a project, its -changes, or any of its data. - -This category has a special behavior, where the per-project ACL is -evaluated before the global all projects ACL. If the per-project -ACL has granted `Read Access -1`, and does not otherwise grant -`Read Access \+1`, then a `Read Access +1` in the all projects ACL -is ignored. This behavior is useful to hide a handful of projects -on an otherwise public server. - -For an open source, public Gerrit installation it is common to grant -`Read Access +1` to `Anonymous Users` in the `\-- All Projects -\--` ACL, enabling casual browsing of any project's changes, -as well as fetching any project's repository over SSH or HTTP. -New projects can be temporarily hidden from public view by granting -`Read Access -1` to `Anonymous Users` and granting `Read Access +1` -to the project owner's group within the per-project ACL. - -For a private Gerrit installation using a trusted HTTP authentication -source, granting `Read Access +1` to `Registered Users` may be more -typical, enabling read access only to those users who have been -able to authenticate through the HTTP access controls. This may -be suitable in a corporate deployment if the HTTP access control -is already restricted to the correct set of users. - -[[category_READ_2]] -Upload Access -~~~~~~~~~~~~~ - -The `Read Access +2` permits the user to upload a non-merge commit -to the project's `refs/for/BRANCH` namespace, creating a new change -for code review. - -Rather than place this permission in its own category, its chained -into the Read Access category as a higher level of access. A user -must be able to clone or fetch the project in order to create a new -commit on their local system, so in practice they must also have -Read Access +1 to even develop a change. Therefore upload access -implies read access by simply being a higher level of it. - -For an open source, public Gerrit installation, it is common to -grant `Read Access +1..+2` to `Registered Users` in the `\-- All -Projects \--` ACL. For more private installations, its common to -simply grant `Read Access +1..+2` to all users of a project. - -[[category_READ_3]] -Upload Merge Access -~~~~~~~~~~~~~~~~~~~ -The `Read Access +3` permits the user to upload merge commits, but is -otherwise identical to `Read Access +2`. Some projects wish to -restrict merges to being created by Gerrit. By granting, -`Read Access +1..+2`, the only merges that enter the system will be -those created by Gerrit, or those pushed directly. - -[[category_pTAG]] -Push Tag -~~~~~~~~ - -This category permits users to push an annotated tag object over -SSH into the project's repository. Typically this would be done -with a command line such as: - -==== - git push ssh://USER@HOST:PORT/PROJECT tag v1.0 -==== - -Tags must be annotated (created with `git tag -a` or `git tag -s`), -should exist in the `refs/tags/` namespace, and should be new. - -This category is intended to be used to publish tags when a project -reaches a stable release point worth remembering in history. - -The range of values is: - -* +1 Create Signed Tag -+ -A new signed tag may be created. The tagger email address must be -verified for the current user. - -* +2 Create Annotated Tag -+ -A new annotated (unsigned) tag may be created. The tagger email -address must be verified for the current user. - -To push tags created by users other than the current user (such -as tags mirrored from an upstream project), `Forge Identity +2` -must be also granted in addition to `Push Tag >= +1`. - -To push lightweight (non annotated) tags, grant `Push Branch +2 -Create Branch` for reference name `refs/tags/*`, as lightweight -tags are implemented just like branches in Git. - -To delete or overwrite an existing tag, grant `Push Branch +3 -Force Push Branch; Delete Branch` for reference name `refs/tags/*`, -as deleting a tag requires the same permission as deleting a branch. - -[[category_pHD]] -Push Branch -~~~~~~~~~~~ - -This category permits users to push directly into a branch over SSH, -bypassing any code review process that would otherwise be used. - -This category has several possible values: - -* +1 Update Branch -+ -Any existing branch can be fast-forwarded to a new commit. -Creation of new branches is rejected. Deletion of existing branches -is rejected. This is the safest mode as commits cannot be discarded. - -* +2 Create Branch -+ -Implies 'Update Branch', but also allows the creation of a new branch -if the name does not not already designate an existing branch name. -Like update branch, existing commits cannot be discarded. - -* +3 Force Push Branch; Delete Branch -+ -Implies both 'Update Branch' and 'Create Branch', but also allows an -existing branch to be deleted. Since a force push is effectively a -delete immediately followed by a create, but performed atomically on -the server and logged, this level also permits forced push updates -to branches. This level may allow existing commits to be discarded -from a project history. - -This category is primarily useful for projects that only want to -take advantage of Gerrit's access control features and do not need -its code review functionality. Projects that need to require code -reviews should not grant this category. - -[[category_FORG]] -Forge Identity -~~~~~~~~~~~~~~ - -Normally Gerrit requires the author and the committer identity -lines in a Git commit object (or tagger line in an annotated tag) to -match one of the registered email addresses of the uploading user. -This permission allows users to bypass that validation, which may -be necessary when mirroring changes from an upstream project. - -* +1 Forge Author Identity -+ -Permits the use of an unverified author line in commit objects. -This can be useful when applying patches received by email from -3rd parties, when cherry-picking changes written by others across -branches, or when amending someone else's commit to fix up a minor -problem before submitting. -+ -By default this is granted to `Registered Users` in all projects, -but a site administrator may disable it if verified authorship -is required. - -* +2 Forge Committer or Tagger Identity -+ -Implies 'Forge Author Identity', but also allows the use of an -unverified committer line in commit objects, or an unverified tagger -line in annotated tag objects. Typically this is only required -when mirroring commits from an upstream project repository. - -* +3 Forge Gerrit Code Review Server Identity -+ -Implies 'Forge Committer or Tagger Identity' as well as 'Forge -Author Identity', but additionally allows the use of the server's -own name and email on the committer line of a new commit object. -This should only be necessary when force pushing a commit history -which has been rewritten by 'git filter-branch' and that contains -merge commits previously created by this Gerrit Code Review server. - -[[category_VRIF]] -Verified -~~~~~~~~ - -The verified category can have any meaning the project desires. -It was originally invented by the Android Open Source Project to -mean 'compiles, passes basic unit tests'. - -The range of values is: - -* -1 Fails -+ -Tried to compile, but got a compile error, or tried to run tests, -but one or more tests did not pass. -+ -*Any -1 blocks submit.* - -* 0 No score -+ -Didn't try to perform the verification tasks. - -* +1 Verified -+ -Compiled (and ran tests) successfully. -+ -*Any +1 enables submit.* - -In order to submit a change, the change must have a `+1 Verified` in -this category from at least one authorized user, and no `-1 Fails` -from an authorized user. Thus, `-1 Fails` can block a submit, -while `+1 Verified` enables a submit. - -If a Gerrit installation does not wish to use this category in any -project, it can be deleted from the database: - -==== - DELETE FROM approval_categories WHERE category_id = 'VRIF'; - DELETE FROM approval_category_values WHERE category_id = 'VRIF'; -==== - -If a Gerrit installation wants to modify the description text -associated with these category values, the text can be updated -in the `name` column of the `category_id = \'VRIF'` rows in the -`approval_category_values` table. - -Additional values could also be added to this category, to allow it -to behave more like `Code Review` (below). Insert -2 and +2 value -rows into the `approval_category_values` with `category_id` set to -`VRIF` to get the same behavior. - -[NOTE] -A restart is required after making database changes. -See <>. - -[[category_CVRW]] -Code Review -~~~~~~~~~~~ - -The code review category can have any meaning the project desires. -It was originally invented by the Android Open Source Project to -mean 'I read the code and it seems reasonably correct'. - -The range of values is: - -* -2 Do not submit -+ -The code is so horribly incorrect/buggy/broken that it must not be -submitted to this project, or to this branch. -+ -*Any -2 blocks submit.* - -* -1 I would prefer that you didn't submit this -+ -The code doesn't look right, or could be done differently, but -the reviewer is willing to live with it as-is if another reviewer -accepts it, perhaps because it is better than what is currently in -the project. Often this is also used by contributors who don't like -the change, but also aren't responsible for the project long-term -and thus don't have final say on change submission. -+ -Does not block submit. - -* 0 No score -+ -Didn't try to perform the code review task, or glanced over it but -don't have an informed opinion yet. - -* +1 Looks good to me, but someone else must approve -+ -The code looks right to this reviewer, but the reviewer doesn't -have access to the `+2` value for this category. Often this is -used by contributors to a project who were able to review the change -and like what it is doing, but don't have final approval over what -gets submitted. - -* +2 Looks good to me, approved -+ -Basically the same as `+1`, but for those who have final say over -how the project will develop. -+ -*Any +2 enables submit.* - -In order to submit a change, the change must have a `+2 Looks good to -me, approved` in this category from at least one authorized user, -and no `-2 Do not submit` from an authorized user. Thus `-2` -can block a submit, while `+2` can enable it. - -If a Gerrit installation does not wish to use this category in any -project, it can be deleted from the database: - -==== - DELETE FROM approval_categories WHERE category_id = 'CRVW'; - DELETE FROM approval_category_values WHERE category_id = 'CRVW'; -==== - -If a Gerrit installation wants to modify the description text -associated with these category values, the text can be updated -in the `name` column of the `category_id = \'CRVW'` rows in the -`approval_category_values` table. - -Additional values could be inserted into `approval_category_values` -to further extend the negative and positive range, but there is -likely little value in doing so as this only expands the middle -region. This category is a `MaxWithBlock` type, which means that -the lowest negative value if present blocks a submit, while the -highest positive value is required to enable submit. - -[[function_MaxNoBlock]] -There is also a `MaxNoBlock` category which still requires the -highest positive value to submit, but the lowest negative value will -not block the change, and does not carry over between patch sets. -This level is mostly useful for automated code-reviews that may -have false-negatives that shouldn't block the change. - -[NOTE] -A restart is required after making database changes. -See <>. - -[[category_SUBM]] -Submit -~~~~~~ - -This category permits users to push the `Submit Patch Set n` button -on the web UI. - -Submitting a change causes it to be merged into the destination -branch as soon as possible, making it a permanent part of the -project's history. - -In order to submit, all approval categories (such as `Verified` and -`Code Review`, above) must enable submit, and also must not block it. -See above for details on each category. - -[[category_makeoneup]] -Your Category Here -~~~~~~~~~~~~~~~~~~ - -Gerrit administrators can also make up their own categories. - -See above for descriptions of how `Verified` and `Code Review` work, -and insert your own category with `function_name = \'MaxWithBlock'` -to get the same behavior over your own range of values, in any -category you desire. - -Ensure `category_id` is unique within your `approval_categories` -table. The default values `VRIF` and `CVRF` used for the categories -described above are simply that, defaults, and have no special -meaning to Gerrit. The other standard category_id values like -`OWN`, `READ`, `SUBM`, `pTAG` and `pHD` have special meaning and -should not be modified or reused. - -The `position` column of `approval_categories` controls which column -of the 'Approvals' table the category appears in, providing some -layout control to the administrator. - -All `MaxWithBlock` categories must have at least one positive value -in the `approval_category_values` table, or else submit will never -be enabled. - -To permit blocking submits, ensure a negative value is defined for -your new category. If you do not wish to have a blocking submit -level for your category, do not define values less than 0. - -Keep in mind that category definitions are currently global to -the entire Gerrit instance, and affect all projects hosted on it. -Any change to a category definition affects everyone. - -For example, to define a new 3-valued category that behaves exactly -like `Verified`, but has different names/labels: - -==== - INSERT INTO approval_categories - (name - ,position - ,function_name - ,category_id) - VALUES - ('Copyright Check' - ,3 - 'MaxWithBlock' - ,'copy'); - - INSERT INTO approval_category_values - (category_id,value,name) - VALUES - ('copy', -1, 'Do not have copyright'); - - INSERT INTO approval_category_values - (category_id,value,name) - VALUES - ('copy', 0, 'No score'); - - INSERT INTO approval_category_values - (category_id,value,name) - VALUES - ('copy', 1, 'Copyright clear'); -==== - -The new column will appear at the end of the table (in position 3), -and `-1 Do not have copyright` will block submit, while `+1 Copyright -clear` is required to enable submit. - -[[restart_changes]] -[NOTE] -Restart the Gerrit web application and reload all browsers after -making any database changes to approval categories. Browsers are -sent the list of known categories when they first visit the site, -and don't notice changes until the page is closed and opened again, -or is reloaded. - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf deleted file mode 100644 index 9242f09a9a..0000000000 --- a/Documentation/asciidoc.conf +++ /dev/null @@ -1,18 +0,0 @@ -[attributes] -asterisk=* -plus=+ -caret=^ -startsb=[ -endsb=] -tilde=~ - -[specialsections] -GERRIT=gerrituplink - -[gerrituplink] -
diff --git a/Documentation/cmd-cherry-pick.txt b/Documentation/cmd-cherry-pick.txt deleted file mode 100644 index 0831d9d7a9..0000000000 --- a/Documentation/cmd-cherry-pick.txt +++ /dev/null @@ -1,47 +0,0 @@ -gerrit-cherry-pick -================== - -NAME ----- -gerrit-cherry-pick - Download and cherry pick one or more changes - -SYNOPSIS --------- -[verse] -'gerrit-cherry-pick' ... - -'gerrit-cherry-pick' \--continue | \--skip | \--abort - -'gerrit-cherry-pick' \--close - -DESCRIPTION ------------ -Downloads the listed changes specified on the command line and -proceeds to cherry-pick them (rewriting commit SHA-1s as it goes) -onto the current branch. - -If a merge failure prevents this from being completely automatic, -you will be asked to resolve the conflict and restart the command -with the `\--continue` option. - -Change ids may be specified as either the change id (e.g. 1234) -or as change id slash patch set number (e.g. 1234/8). If the patch -set number is not supplied, `/1` is assumed. - -The `\--close` command line option is now deprecated, as closing -existing changes post cherry-pick is better handled simply by -ensuring link:user-changeid.html[Change-Id lines] are present in -each commit message. - -OBTAINING ---------- -To obtain the 'gerrit-cherry-pick' script use scp, curl or wget to -copy it to your local system: - - $ scp -p -P 29418 john.doe@review.example.com:bin/gerrit-cherry-pick ~/bin/ - - $ curl http://review.example.com/tools/bin/gerrit-cherry-pick - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-create-account.txt b/Documentation/cmd-create-account.txt deleted file mode 100644 index ab5663c512..0000000000 --- a/Documentation/cmd-create-account.txt +++ /dev/null @@ -1,70 +0,0 @@ -gerrit create-account -===================== - -NAME ----- -gerrit create-account - Create a new batch/role account. - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit create-account' \ -[\--group ] \ -[\--full-name ] \ -[\--email ] \ -[\--ssh-key -|] \ - - -DESCRIPTION ------------ -Creates a new internal only user account for batch/role access, such -as from an automated build system or event monitoring over -link:cmd-stream-events.html[gerrit stream-events]. - -If LDAP authentication is being used, the user account is created -without checking the LDAP directory. Consequently users can be -created in Gerrit that do not exist in the underlying LDAP directory. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -OPTIONS -------- -:: - Required; SSH username of the user account. - -\--ssh-key:: - Content of the public SSH key to load into the account's - keyring. If `-` the key is read from stdin, rather than - from the command line. - -\--group:: - Name of the group to put the user into. Multiple \--group - options may be specified to add the user to multiple groups. - -\--full-name:: - Display name of the user account. -+ -Names containing spaces should be quoted in single quotes (\'). -This most likely requires double quoting the value, for example -`\--full-name "\'A description string\'"`. - -\--email:: - Preferred email address for the user account. - -EXAMPLES --------- -Create a new user account called `watcher`: - -==== - $ cat ~/.ssh/id_watcher.pub | ssh -p 29418 review.example.com gerrit create-account --ssh-key - watcher -==== - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-create-group.txt b/Documentation/cmd-create-group.txt deleted file mode 100644 index 1e46e14e19..0000000000 --- a/Documentation/cmd-create-group.txt +++ /dev/null @@ -1,81 +0,0 @@ -gerrit create-group -=================== - -NAME ----- -gerrit create-group - Create a new account group. - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit create-group' \ -[\--owner ] \ -[\--description ] \ -[\--member ] \ -[\--group ] \ - - -DESCRIPTION ------------ -Creates a new account group. The group creating user (the user that -fired the create-group command) is not automatically added to -the created group. In case the creating user wants to be a member of -the group he/she must list itself in the --member option. This is -slightly different from Gerrit's Web UI where the creating user automatically -becomes a member of the newly created group. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -OPTIONS -------- -:: - Required; name of the new group. - -\--owner, -o:: - Name of the owning group. If not specified the group will be self-owning. - -\--description, -d:: - Description of group. -+ -Description values containing spaces should be quoted in single quotes -(\'). This most likely requires double quoting the value, for example -`\--description "\'A description string\'"`. - -\--member:: - User name to become initial member of the group. Multiple \--member - options may be specified to add more initial members. - -\--group:: - Group name to include in the group. Multiple \--group options may - be specified to include more initial groups. - -EXAMPLES --------- -Create a new account group called `gerritdev` with two initial members -`developer1` and `developer2`. The group should be owned by itself: - -==== - $ ssh -p 29418 user@review.example.com gerrit create-group --member developer1 --member developer2 gerritdev -==== - -Create a new account group called `Foo` owned by the `Foo-admin` group. -Put `developer1` as the initial member and include group description: - -==== - $ ssh -p 29418 user@review.example.com gerrit create-group --owner Foo-admin --member developer1 --description "'Foo description'" Foo -==== - -Note that it is necessary to quote the description twice. The local -shell needs double quotes around the value to ensure the single quotes -are passed through SSH as-is to the remote Gerrit server, which uses -the single quotes to delimit the value. - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-create-project.txt b/Documentation/cmd-create-project.txt deleted file mode 100644 index e00e45bb33..0000000000 --- a/Documentation/cmd-create-project.txt +++ /dev/null @@ -1,156 +0,0 @@ -gerrit create-project -===================== - -NAME ----- -gerrit create-project - Create a new hosted project - -SYNOPSIS --------- -[verse] - 'ssh' -p 'gerrit create-project' \ - --name \ - [--branch ] \ - [\--owner ...] \ - [\--parent ] \ - [\--description ] \ - [\--submit-type ] \ - [\--use-content-merge] \ - [\--use-contributor-agreements] \ - [\--use-signed-off-by] \ - [\--empty-commit] - -DESCRIPTION ------------ -Creates a new bare Git repository under `gerrit.basePath`, using -the project name supplied. The newly created repository is empty -(has no commits), but is registered in the Gerrit database so that -the initial commit may be uploaded for review, or initial content -can be pushed directly into a branch. - -If replication is enabled, this command also connects to each of -the configured remote systems over SSH and uses command line git -on the remote system to create the empty repository. - - -ACCESS ------- -Caller must be a member of any of the groups defined by -repository.*.createGroup in gerrit.config. - -If there is no such declaration, caller is required to be a member -of the privileged 'Administrators' group. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -OPTIONS -------- -\--name:: - Required; name of the project to create. If name ends with - `.git` the suffix will be automatically removed. - -\--branch:: - Name of the initial branch in the newly created project. - Defaults to 'master'. - -\--owner:: - Name of the group(s) which will initially own this repository. - The specified group(s) must already be defined within Gerrit. - Several groups can be specified on the command line. -+ -Defaults to what is specified by repository.*.ownerGroup -in gerrit.config. If no such declaration(s) exist, -repository.*.createGroup will be used. If they don't exist, -`Administrators` will be used. - -\--parent:: - Name of the parent project to inherit access rights - through. If not specified, the parent is set to the default - project `\-- All Projects \--`. - -\--description:: - Initial description of the project. If not specified, - no description is stored. -+ -Description values containing spaces should be quoted in single quotes -(\'). This most likely requires double quoting the value, for example -`\--description "\'A description string\'"`. - -\--submit-type:: - Action used by Gerrit to submit an approved change to its - destination branch. Supported options are: -+ -* FAST_FORWARD_ONLY: produces a strictly linear history. -* MERGE_IF_NECESSARY: create a merge commit when required. -* MERGE_ALWAYS: always create a merge commit. -* CHERRY_PICK: always cherry-pick the commit. - -+ -Defaults to MERGE_IF_NECESSARY. For more details see -link:project-setup.html#submit_type[Change Submit Actions]. - -\--use-content-merge:: - If enabled, Gerrit will try to perform a 3-way merge of text - file content when a file has been modified by both the - destination branch and the change being submitted. This - option only takes effect if submit type is not - FAST_FORWARD_ONLY. Disabled by default. - -\--use-contributor-agreements:: - If enabled, authors must complete a contributor agreement - on the site before pushing any commits or changes to this - project. Disabled by default. - -\--use-signed-off-by:: - If enabled, each change must contain a Signed-off-by line - from either the author or the uploader in the commit message. - Disabled by default. - -\--empty-commit: - Creates an initial empty commit for the Git repository of the - project that is newly created. - - -EXAMPLES --------- -Create a new project called `tools/gerrit`: - -==== - $ ssh -p 29418 review.example.com gerrit create-project --name tools/gerrit.git -==== - -Create a new project with a description: - -==== - $ ssh -p 29418 review.example.com gerrit create-project --name tool.git --description "'Tools used by build system'" -==== - -Note that it is necessary to quote the description twice. The local -shell needs double quotes around the value to ensure the single quotes -are passed through SSH as-is to the remote Gerrit server, which uses -the single quotes to delimit the value. - -REPLICATION ------------ -The remote repository creation is performed by a Bourne shell script: - -==== - mkdir -p '/base/project.git' && cd '/base/project.git' && git init --bare && git update-ref HEAD refs/heads/master -==== - -For this to work successfully the remote system must be able to run -arbitrary shell scripts, and must have `git` in the user's PATH -environment variable. Administrators could also run this command line -by hand to establish a new empty repository. - -SEE ALSO --------- - -* link:config-replication.html[Git Replication/Mirroring] -* link:project-setup.html[Project Setup] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-flush-caches.txt b/Documentation/cmd-flush-caches.txt deleted file mode 100644 index 573cd78936..0000000000 --- a/Documentation/cmd-flush-caches.txt +++ /dev/null @@ -1,103 +0,0 @@ -gerrit flush-caches -=================== - -NAME ----- -gerrit flush-caches - Flush some/all server caches from memory - -SYNOPSIS --------- -[verse] - 'ssh' -p 'gerrit flush-caches' \ - [\--all | \--list | \--cache ...] - -DESCRIPTION ------------ -Clear an in-memory cache, forcing Gerrit to reconsult the ground -truth when it needs the information again. - -Flushing a cache may be necessary if an administrator modifies -database records directly in the database, rather than going through -the Gerrit web interface. - -If no options are supplied, defaults to `--all`. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -OPTIONS -------- -\--all:: - Flush all known caches. This is like applying a big hammer, - it will force everything out, potentially more than was - necessary for the change made. This option automatically - skips flushing potentially dangerous caches such as - "web_sessions". To flush one of these caches, the caller - must specifically name them on the command line, e.g. pass - `\--cache=web_sessions`. - -\--list:: - Show a list of the caches. - -\--cache=:: - Flush only the cache called . May be supplied more - than once to flush multiple caches in a single command - execution. - -EXAMPLES --------- -List caches available for flushing: - -==== - $ ssh -p 29418 review.example.com gerrit flush-caches --list - accounts - accounts_byemail - diff - groups - ldap_groups - openid - projects - sshkeys - web_sessions -==== - -Flush all caches known to the server, forcing them to recompute: - -==== - $ ssh -p 29418 review.example.com gerrit flush-caches --all -==== - -or - -==== - $ ssh -p 29418 review.example.com gerrit flush-caches -==== - -Flush only the "sshkeys" cache, after manually editing an SSH key -for a user: - -==== - $ ssh -p 29418 review.example.com gerrit flush-caches --cache sshkeys -==== - -Flush "web_sessions", forcing all users to sign-in again: - -==== - $ ssh -p 29418 review.example.com gerrit flush-caches --cache web_sessions -==== - -SEE ALSO --------- - -* link:cmd-show-caches.html[gerrit show-caches] -* link:config-gerrit.html#cache[Cache Configuration] -* link:config-gerrit.html#cache_names[Standard Caches] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-gsql.txt b/Documentation/cmd-gsql.txt deleted file mode 100644 index 7fc8a9bfcd..0000000000 --- a/Documentation/cmd-gsql.txt +++ /dev/null @@ -1,62 +0,0 @@ -gerrit gsql -=========== - -NAME ----- -gerrit gsql - Administrative interface to active database - -SYNOPSIS --------- -[verse] - 'ssh' -p 'gerrit gsql' \ - [\--format \{PRETTY | JSON\}] \ - [\-c QUERY] - -DESCRIPTION ------------ -Provides interactive query support directly against the underlying -SQL database used by the host Gerrit server. All SQL statements -are supported, including SELECT, UPDATE, INSERT, DELETE and ALTER. - -OPTIONS -------- -\--format:: - Set the format records are output in. In PRETTY (the - default) records are displayed in a tabular output suitable - for reading by a human on a sufficiently wide terminal. - In JSON mode records are output as JSON objects using the - column names as the property names, one object per line. - --c:: - Execute the single query statement supplied, and then exit. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -Intended for interactive use only, unless format is JSON. - -EXAMPLES --------- -To manually correct a user's SSH user name: - -==== - $ ssh -p 29418 review.example.com gerrit gsql - Welcome to Gerrit Code Review v2.0.25 - (PostgreSQL 8.3.8) - - Type '\h' for help. Type '\r' to clear the buffer. - - gerrit> update accounts set ssh_user_name = 'alice' where account_id=1; - UPDATE 1; 1 ms - gerrit> \q - Bye - - $ ssh -p 29418 review.example.com gerrit flush-caches --cache sshkeys --cache accounts -==== - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-hook-commit-msg.txt b/Documentation/cmd-hook-commit-msg.txt deleted file mode 100644 index b21f5c0ea8..0000000000 --- a/Documentation/cmd-hook-commit-msg.txt +++ /dev/null @@ -1,90 +0,0 @@ -commit-msg Hook -=============== - -NAME ----- -commit-msg - Edit commit messages to insert a `Change-Id` tag. - -DESCRIPTION ------------ - -A Git hook automatically invoked by `git commit`, and most other -commit creation tools such as `git citool` or `git gui`. The Gerrit -Code Review supplied implementation of this hook is a short shell -script which automatically inserts a globally unique Change-Id tag -in the footer of a commit message. When present, Gerrit uses this -tag to track commits across cherry-picks and rebases. - -After the hook has been installed in the user's local Git repository -for a project, the hook will modify a commit message such as: - ----- - Improve foo widget by attaching a bar. - - We want a bar, because it improves the foo by providing more - wizbangery to the dowhatimeanery. - - Signed-off-by: A. U. Thor ----- - -by inserting a new `Change-Id: ` line in the footer: - ----- - Improve foo widget by attaching a bar. - - We want a bar, because it improves the foo by providing more - wizbangery to the dowhatimeanery. - - Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b - Signed-off-by: A. U. Thor ----- - -The hook implementation is reasonably intelligent at inserting the -Change-Id line before any Signed-off-by or Acked-by lines placed -at the end of the commit message by the author, but if no such -lines are present then it will just insert a blank line, and add -the Change-Id at the bottom of the message. - -If a Change-Id line is already present in the message footer, the -script will do nothing, leaving the existing Change-Id unmodified. -This permits amending an existing commit, or allows the user to -insert the Change-Id manually after copying it from an existing -change viewed on the web. - -OBTAINING ---------- -To obtain the 'commit-msg' script use scp, wget or curl to copy it -to your local system: - - $ scp -p -P 29418 john.doe@review.example.com:hooks/commit-msg .git/hooks/ - - $ curl http://review.example.com/tools/hooks/commit-msg - -SEE ALSO --------- - -* link:user-changeid.html[Change-Id Lines] -* link:http://www.kernel.org/pub/software/scm/git/docs/git-commit.html[git-commit(1)] -* link:http://www.kernel.org/pub/software/scm/git/docs/githooks.html[githooks(5)] - -IMPLEMENTATION --------------- - -The hook generates unique Change-Id lines by creating a virtual -commit object within the local Git repository, and obtaining the -SHA-1 hash from it. Like any other Git commit, the following -properties are included in the computation: - -* SHA-1 of the tree being committed -* SHA-1 of the parent commit -* Name, email address, timestamp of the author -* Name, email address, timestamp of the committer -* Proposed commit message (before Change-Id was inserted) - -Because the names of the tree and parent commit, as well as the -committer timestamp are included in the hash computation, the output -Change-Id is sufficiently unique. - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-index.txt b/Documentation/cmd-index.txt deleted file mode 100644 index 8a6cb6d3bc..0000000000 --- a/Documentation/cmd-index.txt +++ /dev/null @@ -1,125 +0,0 @@ -Gerrit Code Review - Command Line Tools -======================================= - -Client ------- - -Client commands and hooks can be downloaded via scp, wget or curl -from Gerrit's daemon, and then executed on the client system. - -To download a client command or hook, use scp or an http client: - - $ scp -p -P 29418 john.doe@review.example.com:bin/gerrit-cherry-pick ~/bin/ - $ scp -p -P 29418 john.doe@review.example.com:hooks/commit-msg .git/hooks/ - - $ curl http://review.example.com/tools/bin/gerrit-cherry-pick - $ curl http://review.example.com/tools/hooks/commit-msg - -For more details on how to determine the correct SSH port number, -see link:user-upload.html#test_ssh[Testing Your SSH Connection]. - -[[client_commands]]Commands -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -link:cmd-cherry-pick.html[gerrit-cherry-pick]:: - Download and cherry-pick one or more changes (commits). - -[[client_hooks]]Hooks -~~~~~~~~~~~~~~~~~~~~~ - -Client hooks can be installed into a local Git repository, improving -the developer experience when working with a Gerrit Code Review -server. - -link:cmd-hook-commit-msg.html[commit-msg]:: - Automatically generate `Change-Id: ` tags in commit messages. - - -Server ------- - -Aside from the standard Git server side actions, Gerrit supports -several other commands over its internal SSH daemon. As Gerrit does -not provide an interactive shell, the commands must be triggered -from an ssh client, for example: - - $ ssh -p 29418 review.example.com gerrit ls-projects - -For more details on how to determine the correct SSH port number, -see link:user-upload.html#test_ssh[Testing Your SSH Connection]. - -[[user_commands]]User Commands -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -git upload-pack:: - Standard Git server side command for client side `git fetch`. - -link:cmd-receive-pack.html[git receive-pack]:: - Standard Git server side command for client side `git push`. -+ -Also implements the magic associated with uploading commits for -review. See link:user-upload.html#push_create[Creating Changes]. - -link:cmd-review.html[gerrit approve]:: - Alias for 'gerrit review'. - -link:cmd-ls-projects.html[gerrit ls-projects]:: - List projects visible to the caller. - -link:cmd-query.html[gerrit query]:: - Query the change database. - -link:cmd-review.html[gerrit review]:: - Verify, approve and/or submit a patch set from the command line. - -link:cmd-stream-events.html[gerrit stream-events]:: - Monitor events occuring in real time. - -gerrit receive-pack:: - Legacy alias for `git receive-pack`. - -[[admin_commands]]Adminstrator Commands -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -link:cmd-create-account.html[gerrit create-account]:: - Create a new batch/role account. - -link:cmd-create-group.html[gerrit create-group]:: - Create a new account group. - -link:cmd-create-project.html[gerrit create-project]:: - Create a new project and associated Git repository. - -link:cmd-flush-caches.html[gerrit flush-caches]:: - Flush some/all server caches from memory. - -link:cmd-gsql.html[gerrit gsql]:: - Administrative interface to active database. - -link:cmd-set-project-parent.html[gerrit set-project-parent]:: - Change the project permissions are inherited from. - -link:cmd-show-caches.html[gerrit show-caches]:: - Display current cache statistics. - -link:cmd-show-connections.html[gerrit show-connections]:: - Display active client SSH connections. - -link:cmd-show-queue.html[gerrit show-queue]:: - Display the background work queues, including replication. - -link:cmd-replicate.html[gerrit replicate]:: - Manually trigger replication, to recover a node. - -link:cmd-kill.html[kill]:: - Kills a scheduled or running task. - -link:cmd-show-queue.html[ps]:: - Alias for 'gerrit show-queue'. - -link:cmd-suexec.html[suexec]:: - Execute a command as any registered user account. - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-kill.txt b/Documentation/cmd-kill.txt deleted file mode 100644 index a76be84e60..0000000000 --- a/Documentation/cmd-kill.txt +++ /dev/null @@ -1,29 +0,0 @@ -kill -==== - -NAME ----- -kill - Cancel or abort a background task - -SYNOPSIS --------- -[verse] -'ssh' -p 'kill' ... - -DESCRIPTION ------------ -Cancels a scheduled task from the queue. If the task has already -been started, requests for the task to cancel as soon as it reaches -its next cancellation point (which is usually blocking IO). - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -Intended for interactive use only. - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-ls-projects.txt b/Documentation/cmd-ls-projects.txt deleted file mode 100644 index 2134df8319..0000000000 --- a/Documentation/cmd-ls-projects.txt +++ /dev/null @@ -1,72 +0,0 @@ -gerrit ls-projects -================== - -NAME ----- -gerrit ls-projects - List projects visible to caller - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit ls-projects' [\--show-branch ...] - -DESCRIPTION ------------ -Displays the list of project names, one per line, that the -calling user account has been granted 'READ' access to. - -If the caller is a member of the privileged 'Administrators' -group, all projects are listed. - -ACCESS ------- -Any user who has configured an SSH key. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -OPTIONS -------- -\--show-branch:: -\-b:: - Branch for which the command will display the sha of each project. - The command may have multiple \--show-branch parameters, in this case - sha will be shown for each of the branches. - If the user does not have READ access to some branch or the branch does not - exist then stub (forty '\-' symbols) is shown. - If the user does not have access to any branch in the project then the - whole project is not shown. - -\--tree:: -\-t:: - Displays project inheritance in a tree-like format. - This option does not work together with the show-branch option. - -EXAMPLES --------- - -List visible projects: -===== - $ ssh -p 29418 review.example.com gerrit ls-projects - tools/gerrit - tools/gwtorm -===== - -Clone any project visible to the user: -==== - for p in `ssh -p 29418 review.example.com gerrit ls-projects` - do - mkdir -p `dirname "$p"` - git clone --bare "ssh://review.example.com:29418/$p.git" "$p.git" - done -==== - -SEE ALSO --------- - -* link:access-control.html[Access Controls] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-query.txt b/Documentation/cmd-query.txt deleted file mode 100644 index c8996ebd24..0000000000 --- a/Documentation/cmd-query.txt +++ /dev/null @@ -1,116 +0,0 @@ -gerrit query -============ - -NAME ----- -gerrit query - Query the change database - -SYNOPSIS --------- -[verse] - 'ssh' -p 'gerrit query' \ - [\--format {TEXT | JSON}] \ - [\--current-patch-set] \ - [\--patch-sets|--all-approvals] \ - [\--] \ - \ - [limit:] \ - [resume\_sortkey:] - -DESCRIPTION ------------ - -Queries the change database and returns results describing changes -that match the input query. More recently updated changes appear -before older changes, which is the same order presented in the -web interface. - -A query may be limited on the number of results it returns with the -'limit:' operator. If no limit is supplied an internal default -limit is used to prevent explosion of the result set. To obtain -results beyond the limit, the 'resume_sortkey:' operator can be used -to resume the query at the change that follows the last change of -the prior result set. - -Non-option arguments to this command are joined with spaces and then -parsed as a query. This simplifies calling conventions over SSH -by permitting operators to appear in different arguments without -multiple levels of quoting required. - -OPTIONS -------- -\--current-patch-set:: - Include information about the current patch set in the results. - -\--patch-sets:: - Include information about all patch sets. If combined with - the \--current-patch-set flag then the current patch set - information will be output twice, once in each field. - -\--all-approvals:: - Include information about all patch sets along with the - approval information for each patch set. If combined with - the \--current-patch-set flag then the current patch set - information will be output twice, once in each field. - -limit::: - Maximum number of results to return. This is actually a - query operator, and not a command line option. If more - than one limit: operator is provided, the smallest limit - will be used to cut the result set. - -resume\_sortkey::: - Resume results from this sort key. Callers should pass - the sortKey of the last change of the prior result set to - resume a prior query. This is actually a query operator, - and not a command line option. - -ACCESS ------- -Any user who has configured an SSH key. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -EXAMPLES --------- - -Find the 2 most recent open changes in the tools/gerrit project: ------ - $ ssh -p 29418 review.example.com gerrit query --format=JSON status:open project:tools/gerrit limit:2 - {"project":"tools/gerrit", ...} - {"project":"tools/gerrit", ..., sortKey:"000e6aee00003e26", ...} - {"type":"stats","rowCount":2,"runningTimeMilliseconds:15} ------ - -Resume the same query and obtain the final results: ------ - $ ssh -p 29418 review.example.com gerrit query --format=JSON status:open project:tools/gerrit limit:2 resume_sortkey:000e6aee00003e26 - {"project":"tools/gerrit", ...} - {"project":"tools/gerrit", ...} - {"type":"stats","rowCount":1,"runningTimeMilliseconds:15} ------ - - -SCHEMA ------- -The JSON messages consist of nested objects referencing the -link:json.html#change[change], -link:json.html#patchset[patchset], -link:json.html#[account] -involved, and other attributes as appropriate. - -Note that any field may be missing in the JSON messages, so consumers -of this JSON stream should deal with that appropriately. - -SEE ALSO --------- - -* link:user-search.html[Query Operators] -* link:json.html[JSON Data Formats] -* link:access-control.html[Access Controls] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-receive-pack.txt b/Documentation/cmd-receive-pack.txt deleted file mode 100644 index ca965508dd..0000000000 --- a/Documentation/cmd-receive-pack.txt +++ /dev/null @@ -1,105 +0,0 @@ -git-receive-pack -================ - -NAME ----- -git-receive-pack - Receive what is pushed into the repository - -SYNOPSIS --------- -[verse] -git receive-pack [\--reviewer
] [\--cc
] - -DESCRIPTION ------------ -Invoked by 'git push' and updates the project's repository with -the information fed from the 'git push' end. - -End users can supply options to this command by passing them through -to 'git push', which will relay them automatically. - -OPTIONS -------- - -:: - The remote repository that will receive the pushed objects, - and create (or update) changes. Within Gerrit Code Review - this is the name of a project. The optional leading `/` - and or trailing `.git` suffix will be removed, if supplied. - -\--re
:: -\--reviewer
:: - Automatically add
as a reviewer to any change - created or updated by the pushed commit objects. These - changes will appear in the reviewer's dashboard, and will - also be emailed to the reviewer. -+ -May be specified more than once to request multiple reviewers. -+ -This is a Gerrit Code Review specific extension. - -\--cc
:: - Carbon-copy
on the created or updated changes, - but don't request them to perform a review. Like with - \--reviewer the changes will appear in the CC'd user's - dashboard, and will be emailed to them. -+ -May be specified more than once to specify multiple CCs. -+ -This is a Gerrit Code Review specific extension. - -Above
may be the complete email address, or, if Gerrit is -configured with HTTP authentication (e.g. within a single domain), -just the local part (typically username). - -ACCESS ------- -Any user who has configured an SSH key. - -EXAMPLES --------- - -Send a review for a change on the master branch to charlie@example.com: -===== - git push --receive-pack='git receive-pack --reviewer charlie@example.com' ssh://review.example.com:29418/project HEAD:refs/for/master -===== - -Send reviews, but tagging them with the topic name 'bug42': -===== - git push --receive-pack='git receive-pack --reviewer charlie@example.com' ssh://review.example.com:29418/project HEAD:refs/for/master/bug42 -===== - -Also CC two other parties: -===== - git push --receive-pack='git receive-pack --reviewer charlie@example.com --cc alice@example.com --cc bob@example.com' ssh://review.example.com:29418/project HEAD:refs/for/master -===== - -Configure a push macro to perform the last action: -==== - git config remote.charlie.url ssh://review.example.com:29418/project - git config remote.charlie.push HEAD:refs/for/master - git config remote.charlie.receivepack 'git receive-pack --reviewer charlie@example.com --cc alice@example.com --cc bob@example.com' -==== - -afterwards `.git/config` contains the following: -==== - [remote "charlie"] - url = ssh://review.example.com:29418/project - push = HEAD:refs/for/master - receivepack = git receive-pack --reviewer charlie@example.com --cc alice@example.com --cc bob@example.com -==== - -and now sending a new change for review to charlie, CC'ing both -alice and bob is much easier: -==== - git push charlie -==== - -SEE ALSO --------- - -* link:user-upload.html[Uploading Changes] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-replicate.txt b/Documentation/cmd-replicate.txt deleted file mode 100644 index 7f88b47c0c..0000000000 --- a/Documentation/cmd-replicate.txt +++ /dev/null @@ -1,101 +0,0 @@ -gerrit replicate -================ - -NAME ----- -gerrit replicate - Manually trigger replication, to recover a node - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit replicate' \ -[\--url ] \ -\{\--all | ...} - -DESCRIPTION ------------ -Schedules replication of the specified projects to all configured -replication destinations, or only those whose URLs match the pattern -given on the command line. - -Normally Gerrit automatically schedules replication whenever it -makes a change to a managed Git repository. However, there are -other reasons why an administrator may wish to trigger replication: - -* Destination disappears, then later comes back online. -+ -If a destination went offline for a period of time, when it comes -back, it may be missing commits that it should have. Triggering a -replication run for all projects against that URL will update it. - -* After repacking locally, and using `rsync` to distribute the new - pack files to the destinations. -+ -If the local server is repacked, and then the resulting pack files -are sent to remote peers using `rsync -a \--delete-after`, there -is a chance that the rsync missed a change that was added during -the rsync data transfer, and the rsync will remove that changes's -data from the remote, even though the automatic replication pushed -it there in parallel to the rsync. -+ -Its a good idea to run replicate with `\--all` to ensure all -projects are consistent after the rsync is complete. - -* After deleting a ref by hand. -+ -If a ref must be removed (e.g. to purge a change or patch set -that shouldn't have been created, and that must be eradicated) -that delete must be done by direct git access on the local, -managed repository. Gerrit won't know about the delete, and is -unable to replicate it automatically. Triggering replication on -just the affected project can update the mirrors. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -OPTIONS -------- -\--all:: - Schedule replicating for all projects. - -\--url=:: - Replicate only to replication destinations whose URL - contains the substring . This can be useful to - replicate only to a previously down node, which has been - brought back online. - -EXAMPLES --------- -Replicate every project, to every configured remote: - -==== - $ ssh -p 29418 review.example.com gerrit replicate --all -==== - -Replicate only to `srv2` now that it is back online: - -==== - $ ssh -p 29418 review.example.com gerrit replicate --url=srv2 --all -==== - -Replicate only the `tools/gerrit` project, after deleting a ref -locally by hand: - -==== - $ git --git-dir=/home/git/tools/gerrit.git update-ref -d refs/changes/00/100/1 - $ ssh -p 29418 review.example.com gerrit replicate tools/gerrit -==== - -SEE ALSO --------- - -* link:config-replication.html[Git Replication/Mirroring] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-review.txt b/Documentation/cmd-review.txt deleted file mode 100644 index 5645f5137f..0000000000 --- a/Documentation/cmd-review.txt +++ /dev/null @@ -1,111 +0,0 @@ -gerrit review -============== - -NAME ----- -gerrit review - Verify, approve and/or submit one or more patch sets - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit approve' [\--project ] [\--message ] [\--verified ] [\--code-review ] [\--abandon] [\--restore] [\--submit] {COMMIT | CHANGEID,PATCHSET}... -'ssh' -p 'gerrit review' [\--project ] [\--message ] [\--verified ] [\--code-review ] [\--abandon] [\--restore] [\--submit] {COMMIT | CHANGEID,PATCHSET}... - -DESCRIPTION ------------ -Updates the current user's approval status of the specified patch -sets and/or submits them for merging, sending out email -notifications and updating the database. - -Patch sets should be specified as complete or abbreviated commit -SHA-1s. If the same commit is available in multiple projects the -\--project option may be used to limit where Gerrit searches for -the change to only the contents of the specified project. - -For current backward compatibility with user tools patch sets may -also be specified in the legacy 'CHANGEID,PATCHSET' format, such as -'8242,2'. Support for this legacy format is planned to be removed -in a future edition of Gerrit Code Review. Use of commit SHA-1s -is strongly encouraged. - -OPTIONS -------- - -\--project:: --p:: - Name of the project the intended changes are contained - within. This option must be supplied before the commit - SHA-1 in order to take effect. - -\--message:: --m:: - Optional cover letter to include as part of the message - sent to reviewers when the approval states are updated. - -\--help:: --h:: - Display site-specific usage information, including the - complete listing of supported approval categories and values. - -\--code-review:: -\--verified:: - Set the approval category to the value 'N'. The exact - option names supported and the range of values permitted - differs per site, check the output of \--help, or contact - your site administrator for further details. - -\--abandon:: - Abandon the specified patch set(s). - (option is mutually exclusive with --submit and --restore) - -\--restore:: - Restore the specified abandonned patch set(s). - (option is mutually exclusive with --abandon) - -\--submit:: --s:: - Submit the specified patch set(s) for merging. - (option is mutually exclusive with --abandon) - -ACCESS ------- -Any user who has configured an SSH key. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -EXAMPLES --------- - -Approve the change with commit c0ff33 as "Verified +1" -===== - $ ssh -p 29418 review.example.com gerrit review --verified=+1 c0ff33 -===== - -Append the message "Build Successful". Notice two levels of quoting is -required, one for the local shell, and another for the argument parser -inside the Gerrit server: -===== - $ ssh -p 29418 review.example.com gerrit review -m '"Build Successful"' -===== - -Mark the unmerged commits both "Verified +1" and "Code Review +2" and -submit them for merging: -==== - $ ssh -p 29418 review.example.com gerrit review \ - --verified=+1 \ - --code-review=+2 \ - --submit \ - --project=this/project \ - $(git rev-list origin/master..HEAD) -==== - -SEE ALSO --------- - -* link:access-control.html[Access Controls] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-set-project-parent.txt b/Documentation/cmd-set-project-parent.txt deleted file mode 100644 index 699d76ff12..0000000000 --- a/Documentation/cmd-set-project-parent.txt +++ /dev/null @@ -1,51 +0,0 @@ -gerrit set-project-parent -========================= - -NAME ----- -gerrit set-project-parent - Change the project permissions are inherited from. - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit set-project-parent' \ -[\--parent ] \ - ... - -DESCRIPTION ------------ -Changes the project that permissions are inherited through. -Every project inherits permissions from another project, by -default this is `\-- All Projects \--`. This command sets -the project to inherit through another one. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -OPTIONS -------- -\--parent:: - Name of the parent to inherit through. If not specified, - the parent is set back to the default `\-- All Projects \--`. - -EXAMPLES --------- -Configure `kernel/omap` to inherit permissions from `kernel/common`: - -==== - $ ssh -p 29418 review.example.com gerrit set-project-parent --parent kernel/common kernel/omap -==== - -SEE ALSO --------- - -* link:access-control.html[Access Controls] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-show-caches.txt b/Documentation/cmd-show-caches.txt deleted file mode 100644 index 599885914a..0000000000 --- a/Documentation/cmd-show-caches.txt +++ /dev/null @@ -1,62 +0,0 @@ -gerrit show-caches -=================== - -NAME ----- -gerrit show-caches - Display current cache statistics - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit show-caches' - -DESCRIPTION ------------ -Display statistics about the size and hit ratio of in-memory caches. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -Intended for interactive use only. - -EXAMPLES --------- - -==== - $ ssh -p 29418 review.example.com gerrit show-caches - Name Max |Object Count | AvgGet |Hit Ratio | - Age | Disk Mem Cnt| |Disk Mem Agg | - -------------------------+--------------------+----------+--------------+ - accounts 90d | 295| | 99%| - accounts_byemail 90d | 109| | 97%| - D diff 90d | 2695 128 2707| 0.4ms | 11% 86% 98%| - groups 90d | 94| | 80%| - openid 5m | 30| 0.4ms | 9%| - projects 90d | 188| | 99%| - sshkeys 90d | 9| | 94%| - D web_sessions 12h | 30 30| | 0% 99% 99%| - - JGit Buffer Cache: - open files : 23 - loaded : 6.82 mb - mem% : 2% - - JVM Heap: - max : 880.00 mb - inuse : 136.57 mb - mem% : 44% -==== - -SEE ALSO --------- - -* link:cmd-flush-caches.html[gerrit flush-caches] -* link:config-gerrit.html#cache[Cache Configuration] -* link:config-gerrit.html#cache_names[Standard Caches] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-show-connections.txt b/Documentation/cmd-show-connections.txt deleted file mode 100644 index 177a915124..0000000000 --- a/Documentation/cmd-show-connections.txt +++ /dev/null @@ -1,83 +0,0 @@ -gerrit show-connections -======================= - -NAME ----- -gerrit show-connections - Display active client SSH connections - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit show-connections' [-n] - -DESCRIPTION ------------ -Presents a table of the active SSH connections, the users who -are currently connected to the internal server and performing -an activity. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -Intended for interactive use only. - -OPTIONS -------- --n:: -\--numeric:: - Show client hostnames as IP addresses instead of DNS hostname. - -DISPLAY -------- - -Session:: - Unique session identifier on this server. Session - identifiers have a period of 2\^32-1 and start from a - random value. - -Start:: - Time (local to the server) that this connection started. - -Idle:: - Time since the last data transfer on this connection. - Note that most SSH clients use not only a TCP based - connection keep-alive, but also an encrypted keep alive - higher up in the SSH protocol stack. That higher keep - alive resets the idle timer, about once a minute. - -User:: - The username of the account that is authenticated on this - connection. If the -n option is used, this column shows - the Account Id instead. - -Remote Host:: - Reverse lookup hostname, or if -n option is used, the remote - IP address. - -EXAMPLES --------- - -With reverse DNS lookup (default): -==== - $ ssh -p 29418 review.example.com gerrit show-connections - Session Start Idle User Remote Host - -------------------------------------------------------------- - 3abf31e6 20:09:02 00:00:00 jdoe jdoe-desktop.example.com - -- -==== - -Without reverse DNS lookup: -==== - $ ssh -p 29418 review.example.com gerrit show-connections -n - Session Start Idle User Remote Host - -------------------------------------------------------------- - 3abf31e6 20:09:02 00:00:00 a/1001240 10.0.0.1 - -- -==== - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-show-queue.txt b/Documentation/cmd-show-queue.txt deleted file mode 100644 index 3e3638e48e..0000000000 --- a/Documentation/cmd-show-queue.txt +++ /dev/null @@ -1,78 +0,0 @@ -gerrit show-queue -================= - -NAME ----- -gerrit show-queue - Display the background work queues, including replication - -SYNOPSIS --------- -[verse] -'ssh' -p 'ps' -'ssh' -p 'gerrit show-queue' - -DESCRIPTION ------------ -Presents a table of the pending activity the Gerrit daemon -is currently performing, or will perform in the near future. -Gerrit contains an internal scheduler, similar to cron, that it -uses to queue and dispatch both short and long term activity. - -Tasks that are completed or cancelled exit the queue very quickly -once they enter this state, but it can be possible to observe tasks -in these states. - -ACCESS ------- -Caller must be a member of the privileged 'Administrators' group. - -SCRIPTING ---------- -Intended for interactive use only. - -DISPLAY -------- - -Task:: - Unique task identifier on this server. May be passed into - link:cmd-kill.html[kill] to cancel or terminate the task. - Task identifiers have a period of 2\^32-1, and start from - a random value. - -State:: - If running, blank. -+ -If the task has completed, but has not yet been reaped, 'done'. -If the task has been killed, but has not yet halted or been removed -from the queue, 'killed'. -+ -If the task is ready to execute but is waiting for an idle thread -in its associated thread pool, 'waiting'. -+ -Otherwise the time (local to the server) that this task will begin -execution. - -Command:: - Short text description of the task that will be performed - at the given time. - -EXAMPLES --------- - -The following queue contains two tasks scheduled to replicate the -`tools/gerrit.git` project to two different remote systems, `dst1` -and `dst2`: - -==== - $ ssh -p 29418 review.example.com gerrit show-queue - Task State Command - ------------------------------------------------------------------------------ - 7aae09b2 14:31:15.435 mirror dst1:/home/git/tools/gerrit.git - 9ad09d27 14:31:25.434 mirror dst2:/var/cache/tools/gerrit.git - ------------------------------------------------------------------------------ - 2 tasks -==== - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-stream-events.txt b/Documentation/cmd-stream-events.txt deleted file mode 100644 index fb54f67edb..0000000000 --- a/Documentation/cmd-stream-events.txt +++ /dev/null @@ -1,122 +0,0 @@ -gerrit stream-events -==================== - -NAME ----- -gerrit stream-events - Monitor events occuring in real time - -SYNOPSIS --------- -[verse] -'ssh' -p 'gerrit stream-events' - -DESCRIPTION ------------ - -Provides a portal into the major events occuring on the server, -outputing activity data in real-time to the client. Events are -filtered by the caller's access permissions, ensuring the caller -only receives events for changes they can view on the web, or in -the project repository. - -Event output is in JSON, one event per line. - -ACCESS ------- -Any user who has configured an SSH key. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -EXAMPLES --------- - ------ - $ ssh -p 29418 review.example.com gerrit stream-events - {"type":"comment-added",change:{"project":"tools/gerrit", ...}, ...} - {"type":"comment-added",change:{"project":"tools/gerrit", ...}, ...} ------ - -SCHEMA ------- -The JSON messages consist of nested objects referencing the *change*, -*patchset*, *account* involved, and other attributes as appropriate. -The currently supported message types are *patchset-created*, -*comment-added*, *change-merged*, and *change-abandoned*. - -Note that any field may be missing in the JSON messages, so consumers of -this JSON stream should deal with that appropriately. - -Events -~~~~~~ -Patchset Created -^^^^^^^^^^^^^^^^ -type:: "patchset-created" - -change:: link:json.html#change[change attribute] - -patchset:: link:json.html#patchset[patchset attribute] - -uploader:: link:json.html#account[account attribute] - -Change Abandoned -^^^^^^^^^^^^^^^^ -type:: "change-abandoned" - -change:: link:json.html#change[change attribute] - -patchset:: link:json.html#patchset[patchset attribute] - -abandoner:: link:json.html#account[account attribute] - -Change Restored -^^^^^^^^^^^^^^^^ -type:: "change-restored" - -change:: link:json.html#change[change attribute] - -patchset:: link:json.html#patchset[patchset attribute] - -restorer:: link:json.html#account[account attribute] - -Change Merged -^^^^^^^^^^^^^ -type:: "change-merged" - -change:: link:json.html#change[change attribute] - -patchset:: link:json.html#patchset[patchset attribute] - -submitter:: link:json.html#account[account attribute] - -Comment Added -^^^^^^^^^^^^^ -type:: "comment-added" - -change:: link:json.html#change[change attribute] - -patchset:: link:json.html#patchset[patchset attribute] - -author:: link:json.html#account[account attribute] - -comment:: Comment text author had written - -Ref Updated -^^^^^^^^^^^ -type:: "ref-updated" - -submitter:: link:json.html#account[account attribute] - -refUpdate:: link:json.html#refupdate[refupdate attribute] - - -SEE ALSO --------- - -* link:json.html[JSON Data Formats] -* link:access-control.html[Access Controls] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/cmd-suexec.txt b/Documentation/cmd-suexec.txt deleted file mode 100644 index 98a66ad33b..0000000000 --- a/Documentation/cmd-suexec.txt +++ /dev/null @@ -1,50 +0,0 @@ -suexec -====== - -NAME ----- -suexec - Execute a command as any registered user account - -SYNOPSIS --------- -[verse] -'ssh' -p 'Gerrit Code Review'@localhost -i 'suexec' \--as [\--from HOST:PORT] [\--] [COMMAND] - -DESCRIPTION ------------ -The suexec command can only be invoked by the magic user Gerrit Code Review -and permits executing any other command as any other registered user account. - -OPTIONS -------- - -\--as:: - Email address of the user you want to impersonate. -\--from:: - Hostname and port of the machine you want to impersonate the command - coming from. -COMMAND:: - Gerrit command you want to run. - -ACCESS ------- -Caller must be the magic user Gerrit Code Review using the SSH daemon's host key -or a key on this daemon's peer host key ring. - -SCRIPTING ---------- -This command is intended to be used in scripts. - -EXAMPLES --------- - -Approve the change with commit c0ff33 as "Verified +1" as user bob@example.com -===== - $ sudo -u gerrit ssh -p 29418 -i site_path/etc/ssh_host_rsa_key \ - 'Gerrit Code Review'@localhost suexec --as bob@example.com -- \ - gerrit approve --verified=+1 c0ff33 -===== - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/config-contact.txt b/Documentation/config-contact.txt deleted file mode 100644 index 845a1babd4..0000000000 --- a/Documentation/config-contact.txt +++ /dev/null @@ -1,215 +0,0 @@ -Gerrit Code Review - Contact Information -======================================== - -To help ensure contributor privacy, but still support gathering of -contributor agreements as necessary, Gerrit encrypts all offline -contact information gathered from users. This data is shipped to -another server, typically at a different location, to make it more -difficult for an attacker to obtain. - -This feature is optional. If the crypto APIs aren't installed -and the `contactstore.url` setting in `gerrit.config` is not set, -Gerrit will not collect contact information from users. - - -Setup ------ - -Ensure Bouncy Castle Crypto API is available in the web application's -CLASSPATH (e.g. in `'JETTY_HOME'/lib/plus` for Jetty). Gerrit needs -both `bcprov-jdk\*-*.jar` and `bcpg-jdk\*-*.jar` to be provided -for the contact encryption to work. - -* link:http://www.bouncycastle.org/latest_releases.html[Bouncy Castle Crypto API] - -Ensure a proper JCE policy file is installed. By default most -JRE installations forbid the use of a strong key, resulting in -SecurityException messages when trying to encrypt the contact data. -You need to obtain a strong JCE policy file and install it by hand. -Look for the 'Unlimited Strength Jurisdiction Policy' download. - -* link:http://java.sun.com/javase/downloads/index.jsp[Java SE Downloads] - -Create a public/private key pair for contact data handling. -Generate the keys on a protected system, where the resulting -private key is unlikely to fall into the wrong hands. - -==== - gpg --gen-key -==== - -Select to use a `DSA and Elgamal` key type, as the public key will -be used for data encryption. - -The information chosen for name, email and comment fields can be -anything reasonable which would identify the contact store of this -Gerrit instance. It is probably a good idea to not use a real -person's name here, but instead some sort of organizational role. -The actual values chosen don't matter later, and are only to help -document the purpose of the key. - -Chose a fairly long expiration period, such as 20 years. For most -Gerrit instances, contact data will be written once, and rarely, -if ever, read back. - -Export the public key for Gerrit to use during encryption. The -public key must be stored in a file called `contact_information.pub` -and reside inside of the `site_config` directory. Armoring it -during export makes it easier to transport between systems, as -you can easily copy-and-paste the text. Gerrit can read both the -armored and unarmored formats. - -==== - gpg --export --armor KEYEMAIL >$site_path/etc/contact_information.pub -==== - -Consider storing the private key with some sort of key escrow -service within your organization. Without the private key it -is impossible to recover contact records. - -Install a contact store implementation somewhere to receive -the contact records. To be really paranoid, Gerrit always -ships the data to another HTTP server, preferrably over HTTPS. -Existing open-source server implementations can be found in the -gerrit-contactstore project. - -* link:http://android.git.kernel.org/?p=tools/gerrit-contactstore.git[gerrit-contactstore] - -Configure `'$site_path'/etc/gerrit.config` with the contact store's -URL (in `contactstore.url`), and if needed, APPSEC value (in -`contactstore.appsec`): - -==== - git config --file $site_path/etc/gerrit.config appsec.url https://... - git config --file $site_path/etc/gerrit.config appsec.appsec sekret -==== - - -Contact Store Protocol ----------------------- - -To implement a new contact store, the following details are useful. - -Gerrit connects to the contact store by sending a standard -`application/x-www-form-urlencoded` within an HTTP POST request -sent to the store URL (the exact URL that is in contactstore.url) -with the following form fields in the body: - -* APPSEC -+ -A shared secret "password" that should be known only to Gerrit -and the contact store. The contact store should test this value to -deter spamming of the contact store by outside parties. Gerrit reads -this from contactstore.appsec. - -* account_id -+ -Unique account_id value from the Gerrit database for the account -the contact information belongs to. Base 10 integer. - -* email -+ -Preferred email address of the account. May facilitate lookups in -the contact store at a future date. May be omitted or the empty -string if the user hasn't chosen a preferred email. - -* filed -+ -Seconds since the UNIX epoch of when the contact information -was filed. May be omitted or the empty string if Gerrit -doesn't think the supplied contact information is valid enough. - -* data -+ -Encrypted account data as an armored ASCII blob. This is usually -several KB of text data as a single string, with embedded newlines -to break the lines at about 70-75 characters per line. Data can -be decoded using GnuPG with the correct private key. - -Upon successful store, the contact store application should respond -with HTTP status code `200` and a body consisting only of `OK` -(or `OK\n`). Any other response code or body is considered to be -a failure by Gerrit. - -Using `https://` for the store URL is *highly* encouraged, as it -prevents man-in-the-middle attacks from reading the shared secret -APPSEC token, or messing with the data field. - -Data Format -~~~~~~~~~~~ - -Once decrypted the `data` field looks something like the following: - ----- -Account-Id: 1001240 -Date: 2009-02-23 20:32:32.852 UTC -Full-Name: John Doe -Preferred-Email: jdoe@example.com -Identity: jd15@some-isp.com -Identity: jdoe@example.com -Identity: jdoe@example.com -Address: - 123 Any Street - Any Town, Somewhere -Country: USA -Phone-Number: +1 (555) 555-1212 -Fax-Number: 555.1200 ----- - -The fields are as follows: - -* `Account-Id` -+ -Value of the `account_id` field in the metadata database. This is -a unique key for this account, and links all data records to it. - -* `Date` -+ -Date and time of when this contact record was submitted by the user. -Written in an ISO formatted date/time string (`YYYY-MM-DD hh:mm:ss`), -in the UTC timezone. - -* `Full-Name` -+ -The `full_name` field of the account record when the user submitted -the contact information. This should be the user's given name and -family name. - -* `Preferred-Email` -+ -The `preferred_email` field of the account record when the user -submitted the contact information. This should be one of the emails -listed in the `Identity` field. - -* `Identity` -+ -This field occurs once for each `account_external_id` record -in the database for this account. The email address is listed, -and if the user is using OpenID authentication, the OpenID claimed -identity follows in brackets (`<...>`). Identity lines without an -OpenID identity are usually created by sending an email containing -a unique hyperlink that the user must visit to setup the identity. - -* `Address` -+ -Free form text, as entered by the user. This should describe some -location that physical documents could be sent to, but it is not -verified, so users can enter pretty much anything here. Each line -is prefixed with a single TAB character, but is otherwise exactly -as entered. - -* `Country` -+ -Free form text, as entered by the user. This should be some sort -of country name or ISO country abbreviation, but it is not verified, -so it can be pretty much anything. - -* `Phone-Number`, `Fax-Number` -+ -Free form text, as entered by the user. The format here can be -anything, and as the example shows, may not even be consistent in -the same record. - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt deleted file mode 100644 index 1326718435..0000000000 --- a/Documentation/config-gerrit.txt +++ /dev/null @@ -1,2108 +0,0 @@ -Gerrit Code Review - Configuration -================================== - -File `etc/gerrit.config` ------------------------- - -The optional file `'$site_path'/etc/gerrit.config` is a Git-style -config file that controls many host specific settings for Gerrit. - -[NOTE] -The contents of the `etc/gerrit.config` file are cached at startup -by Gerrit. If you modify any propeties in this file, Gerrit needs -to be restarted before it will use the new values. - -Sample `etc/gerrit.config`: ----- -[core] - packedGitLimit = 200 m - -[cache] - directory = /var/cache/gerrit2 - -[cache "diff"] - diskbuffer = 10 m ----- - -[[auth]]Section auth -~~~~~~~~~~~~~~~~~~~~ - -See also link:config-sso.html[SSO configuration]. - -[[auth.type]]auth.type:: -+ -Type of user authentication employed by Gerrit. The supported -values are: -+ -* `OpenID` -+ -The default setting. Gerrit uses any valid OpenID -provider chosen by the end-user. For more information see -http://openid.net/[openid.net]. -+ -* `OpenID_SSO` -+ -Supports OpenID from a single provider. There is no registration -link, and the "Sign In" link sends the user directly to the provider's -SSO entry point. -+ -* `HTTP` -+ -Gerrit relies upon data presented in the HTTP request. This includes -HTTP basic authentication, or some types of commerical single-sign-on -solutions. With this setting enabled the authentication must -take place in the web server or servlet container, and not from -within Gerrit. -+ -* `HTTP_LDAP` -+ -Exactly like `HTTP` (above), but additionally Gerrit pre-populates -a user's full name and email address based on information obtained -from the user's account object in LDAP. The user's group membership -is also pulled from LDAP, making any LDAP groups that a user is a -member of available as groups in Gerrit. -+ -* `CLIENT_SSL_CERT_LDAP` -+ -This authentication type is actually kind of SSO. Gerrit will configure -Jetty's SSL channel to request client's SSL certificate. For this -authentication to work a Gerrit administrator has to import the root -certificate of the trust chain used to issue the client's certificate -into the /etc/keystore. -After the authentication is done Gerrit will obtain basic user -registration (name and email) from LDAP, and some group memberships. -Therefore, the "_LDAP" suffix in the name of this authentication type. -This authentication type can only be used under hosted daemon mode, and -the httpd.listenUrl must use https:// as the protocol. -+ -* `LDAP` -+ -Gerrit prompts the user to enter a username and a password, which -it then verifies by performing a simple bind against the configured -<>. In this configuration the web server -is not involved in the user authentication process. -+ -The actual username used in the LDAP simple bind request is the -account's full DN, which is discovered by first querying the -directory using either an anonymous request, or the configured -<> identity. - -* `LDAP_BIND` -+ -Gerrit prompts the user to enter a username and a password, which -it then verifies by performing a simple bind against the configured -<>. In this configuration the web server -is not involved in the user authentication process. -+ -Unlike LDAP above, the username used to perform the LDAP simple bind -request is the exact string supplied by in the dialog by the user. -The configured <> identity is not used to obtain -account information. -+ -* `DEVELOPMENT_BECOME_ANY_ACCOUNT` -+ -*DO NOT USE*. Only for use in a development environment. -+ -When this is the configured authentication method a hyperlink titled -`Become` appears in the top right corner of the page, taking the -user to a form where they can enter the username of any existing -user account, and immediately login as that account, without any -authentication taking place. This form of authentication is only -useful for the GWT hosted mode shell, where OpenID authentication -redirects might be risky to the developer's host computer, and HTTP -authentication is not possible. - -+ -By default, OpenID. - -[[auth.allowedOpenID]]auth.allowedOpenID:: -+ -List of permitted OpenID providers. A user may only authenticate -with an OpenID that matches this list. Only used if `auth.type` -was set to OpenID (the default). -+ -Patterns may be either a -link:http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html[standard -Java regular expression (java.util.regex)] (start with `^` and -end with `$`) or be a simple prefix (any other string). -+ -By default, the list contains two values, `http://` and `https://`, -allowing users to authenticate with any OpenID provider. - -[[auth.trustedOpenID]]auth.trustedOpenID:: -+ -List of trusted OpenID providers. Only used if `auth.type` was -set to OpenID (the default). -+ -In order for a user to take advantage of permissions beyond those -granted to the `Anonymous Users` and `Registered Users` groups, -the user account must only have OpenIDs which match at least one -pattern from this list. -+ -Patterns may be either a -link:http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html[standard -Java regular expression (java.util.regex)] (start with `^` and -end with `$`) or be a simple prefix (any other string). -+ -By default, the list contains two values, `http://` and `https://`, -allowing Gerrit to trust any OpenID it receives. - -[[auth.maxOpenIdSessionAge]]auth.maxOpenIdSessionAge:: -+ -Time in seconds before an OpenID provider must force the user -to authenticate themselves again before authentication to this -Gerrit server. Currently this is only a polite request, and users -coming from providers that don't support the PAPE extension will -be accepted anyway. In the future it may be enforced, rejecting -users coming from providers that don't honor the max session age. -+ -If set to 0, the provider will always force the user to authenticate -(e.g. supply their password). Values should use common unit suffixes -to express their setting: -+ -* s, sec, second, seconds -* m, min, minute, minutes -* h, hr, hour, hours -* d, day, days -* w, week, weeks (`1 week` is treated as `7 days`) -* mon, month, months (`1 month` is treated as `30 days`) -* y, year, years (`1 year` is treated as `365 days`) - -+ -Default is -1, permitting infinite time between authentications. - -[[auth.openIdSsoUrl]]auth.openIdSsoUrl:: -+ -The SSO entry point URL. Only used if `auth.type` was set to -set to OpenID_SSO. -+ -The "Sign In" link will send users directly to this URL. - -[[auth.httpHeader]]auth.httpHeader:: -+ -HTTP header to trust the username from, or unset to select HTTP basic -or digest authentication. Only used if `auth.type` was set to HTTP. - -[[auth.logoutUrl]]auth.logoutUrl:: -+ -URL to redirect a browser to after the end-user has clicked on the -"Sign Out" link in the upper right corner. Organizations using an -enterprise single-sign-on solution may want to redirect the browser -to the SSO product's sign-out page. -+ -If not set, the redirect returns to the list of all open changes. - -[[auth.registerUrl]]auth.registerUrl:: -+ -Target for the "Register" link in the upper right corner. Used only -when auth.type is `LDAP`. -+ -If not set, no "Register" link is displayed. - -[[auth.cookiePath]]auth.cookiePath:: -+ -Sets "path" attribute of the authentication cookie. -+ -If not set, HTTP request's path is used. - -[[auth.cookieSecure]]auth.cookieSecure:: -+ -Sets "secure" flag of the authentication cookie. If true, cookies -will be transmitted only over HTTPS protocol. -+ -By default, false. - -[[auth.emailFormat]]auth.emailFormat:: -+ -Optional format string to construct user email addresses out of -user login names. Only used if auth.type is `HTTP`, `HTTP_LDAP` -or `LDAP`. -+ -This value can be set to a format string, where `\{0\}` is replaced -with the login name. E.g. "\{0\}+gerrit@example.com" with a user -login name of "foo" will produce "foo+gerrit@example.com" during -the first time user "foo" registers. -+ -If the site is using `HTTP_LDAP` or `LDAP`, using this option is -discouraged. Setting `ldap.accountEmailAddress` and importing the -email address from the LDAP directory is generally preferred. - -[[auth.contributorAgreements]]auth.contributorAgreements:: -+ -Controls whether or not the contributor agreement features are -enabled for the Gerrit site. If enabled a user must complete a -contributor agreement before they can upload changes. -+ -If enabled, the admin must also insert one or more rows into -`contributor_agreements` and create agreement files under -`'$site_path'/static`, so users can actually complete one or -more agreements. -+ -By default this is false (no agreements are used). - -auth.allowGoogleAccountUpgrade:: -+ -Allows Google Account users to automatically update their Gerrit -account when/if their Google Account OpenID identity token changes. -Identity tokens can change if the server changes hostnames, or -for other reasons known only to Google. The upgrade path works -by matching users by email address if the identity is not present, -and then changing the identity. -+ -This setting also permits old Gerrit 1.x users to seamlessly upgrade -from Google Accounts on Google App Engine to OpenID authentication. -+ -Having this enabled incurs an extra database query when Google -Account users register with the Gerrit server. -+ -By default, unset/false. - -[[cache]]Section cache -~~~~~~~~~~~~~~~~~~~~~~ - -[[cache.directory]]cache.directory:: -+ -Path to a local directory where Gerrit can write cached entities for -future lookup. This local disk cache is used to retain potentially -expensive to compute information across restarts. If the location -does not exist, Gerrit will try to create it. -+ -If not absolute, the path is resolved relative to `$site_path`. -+ -Default is unset, no disk cache. - -[[cache.name.maxAge]]cache..maxAge:: -+ -Maximum age to keep an entry in the cache. If an entry has not -been accessed in this period of time, it is removed from the cache. -Values should use common unit suffixes to express their setting: -+ -* s, sec, second, seconds -* m, min, minute, minutes -* h, hr, hour, hours -* d, day, days -* w, week, weeks (`1 week` is treated as `7 days`) -* mon, month, months (`1 month` is treated as `30 days`) -* y, year, years (`1 year` is treated as `365 days`) - -+ -If a unit suffix is not specified, `minutes` is assumed. If 0 is -supplied, the maximum age is infinite and items are never purged -except when the cache is full. -+ -Default is `90 days` for most caches, except: -+ -* `"adv_bases"`: default is `10 minutes` -* `"ldap_groups"`: default is `1 hour` -* `"web_sessions"`: default is `12 hours` - -[[cache.name.memoryLimit]]cache..memoryLimit:: -+ -Maximum number of cache items to retain in memory. Keep in mind -this is total number of items, not bytes of heap used. -+ -Default is 1024 for most caches, except: -+ -* `"adv_bases"`: default is `4096` -* `"diff"`: default is `128` -* `"diff_intraline"`: default is `128` - -[[cache.name.diskLimit]]cache..diskLimit:: -+ -Maximum number of cache items to retain on disk, if this cache -supports storing its items to disk. Like memoryLimit, this is -total number of items, not bytes of disk used. If 0, disk storage -for this cache is disabled. -+ -Default is 16384. - -[[cache.name.diskBuffer]]cache..diskBuffer:: -+ -Number of bytes to buffer in memory before writing less frequently -accessed cache items to disk, if this cache supports storing its -items to disk. -+ -Default is 5 MiB. -+ -Common unit suffixes of 'k', 'm', or 'g' are supported. - -[[cache_names]]Standard Caches -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -cache `"accounts"`:: -+ -Cache entries contain important details of an active user, including -their display name, preferences, known email addresses, and group -memberships. Entry information is obtained from the following -database tables: -+ -* `accounts` -+ -* `account_group_members` -+ -* `account_external_ids` - -+ -If direct updates are made to any of these database tables, this -cache should be flushed. - -cache `"accounts_byemail"`:: -+ -Caches account identities keyed by email address, which is scanned -from the `account_external_ids` database table. If updates are -made to this table, this cache should be flushed. - -cache `"adv_bases"`:: -+ -Used only for push over smart HTTP when branch level access controls -are enabled. The cache entry contains all commits that are avaliable -for the client to use as potential delta bases. Push over smart HTTP -requires two HTTP requests, and this cache tries to carry state from -the first request into the second to ensure it can complete. - -cache `"diff"`:: -+ -Each item caches the differences between two commits, at both the -directory and file levels. Gerrit uses this cache to accelerate -the display of affected file names, as well as file contents. -+ -Entries in this cache are relatively large, so the memory limit -should not be set incredibly high. Administrators should try to -target cache.diff.memoryLimit to be roughly the number of changes -which their users will process in a 1 or 2 day span. -+ -Keeping entries for 90 days gives sufficient time for most changes -to be submitted or abandoned before their relevant difference items -expire out. - -cache `"diff_intraline"`:: -+ -Each item caches the intraline difference of one file, when compared -between two commits. Gerrit uses this cache to accelerate display of -intraline differences when viewing a file. -+ -Entries in this cache are relatively large, so the memory limit -should not be set incredibly high. Administrators should try to -target cache.diff.memoryLimit to be roughly the number of changes -which their users will process in a 1 or 2 day span. -+ -Keeping entries for 90 days gives sufficient time for most changes -to be submitted or abandoned before their relevant difference items -expire out. - -cache `"groups"`:: -+ -Caches the basic group information from the `account_groups` table, -including the group owner, name, and description. -+ -Gerrit group membership obtained from the `account_group_members` -table is cached under the `"accounts"` cache, above. External group -membership obtained from LDAP is cached under `"ldap_groups"`. - -cache `"groups_byinclude"`:: -+ -Caches group inclusions in other groups. If direct updates are made -to the `account_group_includes` table, this cache should be flushed. - -cache `"ldap_groups"`:: -+ -Caches the LDAP groups that a user belongs to, if LDAP has been -configured on this server. This cache should be configured with a -low maxAge setting, to ensure LDAP modifications are picked up in -a timely fashion. - -cache `"ldap_usernames"`:: -+ -Caches a mapping of LDAP username to Gerrit account identity. The -cache automatically updates when a user first creates their account -within Gerrit, so the cache expire time is largely irrelevant. - -cache `"projects"`:: -+ -Caches the project description records, from the `projects` table -in the database. If a project record is updated or deleted, this -cache should be flushed. Newly inserted projects do not require -a cache flush, as they will be read upon first reference. - -cache `"sshkeys"`:: -+ -Caches unpacked versions of user SSH keys, so the internal SSH daemon -can match against them during authentication. The unit of storage -is per-user, so 1024 items translates to 1024 unique user accounts. -As each individual user account may configure multiple SSH keys, -the total number of keys may be larger than the item count. -+ -This cache is based off the `account_ssh_keys` table and the -`accounts.ssh_user_name` column in the database. If either is -modified directly, this cache should be flushed. - -cache `"web_sessions"`:: -+ -Tracks the live user sessions coming in over HTTP. Flushing this -cache would cause all users to be signed out immediately, forcing -them to sign-in again. To avoid breaking active users, this cache -is not flushed automatically by `gerrit flush-caches --all`, but -instead must be explicitly requested. -+ -If no disk cache is configured (or `cache.web_sessions.diskLimit` -is set to 0) a server restart will force all users to sign-out, -and need to sign-in again after the restart, as the cache was -unable to persist the session information. Enabling a disk cache -is strongly recommended. -+ -Session storage is relatively inexpensive, the average entry in -this cache is approximately 248 bytes, depending on the JVM. - -See also link:cmd-flush-caches.html[gerrit flush-caches]. - -[[cache_options]]Cache Options -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -cache.diff_intraline.maxIdleWorkers:: -+ -Number of idle worker threads to maintain for the intraline difference -computations. There is no upper bound on how many concurrent requests -can occur at once, if additional threads are started to handle a peak -load, only this many will remaining idle afterwards. -+ -Default is 1.5x number of available CPUs. - -cache.diff_intraline.timeout:: -+ -Maximum number of milliseconds to wait for intraline difference data -before giving up and disabling it for a particular file pair. This is -a work around for an infinite loop bug in the intraline difference -implementation. If computation takes longer than the timeout the -worker thread is terminated and no intraline difference is displayed. -+ -Values should use common unit suffixes to express their setting: -+ -* ms, milliseconds -* s, sec, second, seconds -* m, min, minute, minutes -* h, hr, hour, hours - -+ -If a unit suffix is not specified, `milliseconds` is assumed. -+ -Default is 5 seconds. - -cache.diff_intraline.enabled:: -+ -Boolean to enable or disable the computation of intraline differences -when populating a diff cache entry. This flag is provided primarily -as a backdoor to disable the intraline difference feature if -necessary. To maintain backwards compatability with prior versions, -this setting will fallback to `cache.diff.intraline` if not set in the -configuration. -+ -Default is true, enabled. - -cache.projects.checkFrequency:: -+ -How often project configuration should be checked for update from Git. -Gerrit Code Review caches project access rules and configuration in -memory, checking the refs/meta/config branch every checkFrequency -minutes to see if a new revision should be loaded and used for future -access. Values can be specified using standard time unit abbreviations -('ms', 'sec', 'min', etc.). -+ -If set to 0, checks occur every time, which may slow down operations. -Administrators may force the cache to flush with -link:cmd-flush-caches.html[gerrit flush-caches]. -+ -Default is 5 minutes. - - -[[commentlink]]Section commentlink -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Comment links are find/replace strings applied to change descriptions, -patch comments, and in-line code comments to turn set strings into -hyperlinks. One common use is for linking to bug-tracking systems. - -In the following example configuration the 'changeid' comment link -will match typical Gerrit Change-Id values and create a hyperlink -to changes which reference it. The second configuration 'bugzilla' -will hyperlink terms such as 'bug 42' to an external bug tracker, -supplying the argument record number '42' for display. The third -configuration 'tracker' uses raw HTML to more preciously control -how the replacement is displayed to the user. - ----- -[commentlink "changeid"] - match = (I[0-9a-f]{8,40}) - link = "#q,$1,n,z" - -[commentlink "bugzilla"] - match = "(bug\\s+#?)(\\d+)" - link = http://bugs.example.com/show_bug.cgi?id=$2 - -[commentlink "tracker"] - match = ([Bb]ug:\\s+)(\\d+) - html = $1$2 ----- - -[[commentlink.name.match]]commentlink..match:: -+ -A JavaScript regular expression to match positions to be replaced -with a hyperlink. Subexpressions of the matched string can be -stored using groups and accessed with `$'n'` syntax, where 'n' -is the group number, starting from 1. -+ -The configuration file parser eats one level of backslashes, so the -character class `\s` requires `\\s` in the configuration file. The -parser also terminates the line at the first `#`, so a match -expression containing # must be wrapped in double quotes. -+ -To match case insensitive strings, a character class with both the -upper and lower case character for each position must be used. For -example, to match the string `bug` in a case insensitive way the match -pattern `[bB][uU][gG]` needs to be used. -+ -A common pattern to match is `bug\\s+(\\d+)`. - -[[commentlink.name.link]]commentlink..link:: -+ -The URL to direct the user to whenever the regular expression is -matched. Groups in the match expression may be accessed as `$'n'`. -+ -The link property is used only when the html property is not present. - -[[commentlink.name.html]]commentlink..html:: -+ -HTML to replace the entire matched string with. If present, -this property overrides the link property above. Groups in the -match expression may be accessed as `$'n'`. -+ -The configuration file eats double quotes, so escaping them as -`\"` is necessary to protect them from the parser. - - -[[contactstore]]Section contactstore -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -[[contactstore.url]]contactstore.url:: -+ -URL of the web based contact store Gerrit will send any offline -contact information to when it collects the data from users as part -of a contributor agreement. -+ -See link:config-contact.html[Contact Information]. - -[[contactstore.appsec]]contactstore.appsec:: -+ -Shared secret of the web based contact store. - - -[[container]]Section container -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -These settings are applied only if Gerrit is started as the container -process through Gerrit's 'gerrit.sh' rc.d compatible wrapper script. - -[[container.heapLimit]]container.heapLimit:: -+ -Maximum heap size of the Java process running Gerrit, in bytes. -This property is translated into the '-Xmx' flag for the JVM. -+ -Default is platform and JVM specific. -+ -Common unit suffixes of 'k', 'm', or 'g' are supported. - -[[container.javaHome]]container.javaHome:: -+ -Path of the JRE/JDK installation to run Gerrit with. If not set, the -Gerrit startup script will attempt to search your system and guess -a suitable JRE. Overrides the environment variable 'JAVA_HOME'. - -[[container.javaOptions]]container.javaOptions:: -+ -Additional options to pass along to the Java runtime. If multiple -values are configured, they are passed in order on the command line, -separated by spaces. These options are appended onto 'JAVA_OPTIONS'. - -[[container.slave]]container.slave:: -+ -Used on Gerrit slave installations. If set to true the Gerrit JVM is -called with the '--slave' switch, enabling slave mode. If no value is -set (or any other value), gerrit defaults to master mode. - -[[container.user]]container.user:: -+ -Login name (or UID) of the operating system user the Gerrit JVM -will execute as. If not set, defaults to the user who launched -the 'gerrit.sh' wrapper script. - -[[container.war]]container.war:: -+ -Path of the JAR file to start daemon execution with. This should -be the path of the local 'gerrit.war' archive. Overrides the -environment variable 'GERRIT_WAR'. -+ -If not set, defaults to '$site_path/bin/gerrit.war', or to -'$HOME/gerrit.war'. - - -[[core]]Section core -~~~~~~~~~~~~~~~~~~~~ - -[[core.packedGitWindowSize]]core.packedGitWindowSize:: -+ -Number of bytes of a pack file to load into memory in a single -read operation. This is the "page size" of the JGit buffer cache, -used for all pack access operations. All disk IO occurs as single -window reads. Setting this too large may cause the process to load -more data than is required; setting this too small may increase -the frequency of `read()` system calls. -+ -Default on JGit is 8 KiB on all platforms. -+ -Common unit suffixes of 'k', 'm', or 'g' are supported. - -[[core.packedGitLimit]]core.packedGitLimit:: -+ -Maximum number of bytes to load and cache in memory from pack files. -If JGit needs to access more than this many bytes it will unload less -frequently used windows to reclaim memory space within the process. -As this buffer must be shared with the rest of the JVM heap, it -should be a fraction of the total memory available. -+ -Default on JGit is 10 MiB on all platforms. -+ -Common unit suffixes of 'k', 'm', or 'g' are supported. - -[[core.deltaBaseCaseLimit]]core.deltaBaseCacheLimit:: -+ -Maximum number of bytes to reserve for caching base objects -that multiple deltafied objects reference. By storing the entire -decompressed base object in a cache Git is able to avoid unpacking -and decompressing frequently used base objects multiple times. -+ -Default on JGit is 10 MiB on all platforms. You probably do not -need to adjust this value. -+ -Common unit suffixes of 'k', 'm', or 'g' are supported. - -[[core.packedGitOpenFiles]]core.packedGitOpenFiles:: -+ -Maximum number of pack files to have open at once. A pack file -must be opened in order for any of its data to be available in -a cached window. -+ -If you increase this to a larger setting you may need to also adjust -the ulimit on file descriptors for the host JVM, as Gerrit needs -additional file descriptors available for network sockets and other -repository data manipulation. -+ -Default on JGit is 128 file descriptors on all platforms. - -[[core.streamFileThreshold]]core.streamFileThreshold:: -+ -Largest object size, in bytes, that JGit will allocate as a -contiguous byte array. Any file revision larger than this threshold -will have to be streamed, typically requiring the use of temporary -files under '$GIT_DIR/objects' to implement psuedo-random access -during delta decompression. -+ -Servers with very high traffic should set this to be larger than -the size of their common big files. For example a server managing -the Android platform typically has to deal with ~10-12 MiB XML -files, so `15 m` would be a reasonable setting in that environment. -Setting this too high may cause the JVM to run out of heap space -when handling very big binary files, such as device firmware or -CD-ROM ISO images. -+ -Default is 50 MiB on all platforms. Prior to Gerrit 2.1.6, -this value was effectively 2047 MiB. -+ -Common unit suffixes of 'k', 'm', or 'g' are supported. - -[[core.packedGitMmap]]core.packedGitMmap:: -+ -When true, JGit will use `mmap()` rather than `malloc()+read()` -to load data from pack files. The use of mmap can be problematic -on some JVMs as the garbage collector must deduce that a memory -mapped segment is no longer in use before a call to `munmap()` -can be made by the JVM native code. -+ -In server applications (such as Gerrit) that need to access many -pack files, setting this to true risks artifically running out -of virtual address space, as the garbage collector cannot reclaim -unused mapped spaces fast enough. -+ -Default on JGit is false. Although potentially slower, it yields -much more predictable behavior. - -[[database]]Section database -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The database section configures where Gerrit stores its metadata -records about user accounts and change reviews. - ----- -[database] - type = POSTGRESQL - hostname = localhost - database = reviewdb - username = gerrit2 - password = s3kr3t ----- - -[[database.type]]database.type:: -+ -Type of database server to connect to. If set this value will be -used to automatically create correct database.driver and database.url -values to open the connection. -+ -* `POSTGRESQL` -+ -Connect to a PostgreSQL database server. -+ -* `H2` -+ -Connect to a local embedded H2 database. -+ -* `MYSQL` -+ -Connect to a MySQL database server. -+ -* `JDBC` -+ -Connect using a JDBC driver class name and URL. - -+ -If not specified, database.driver and database.url are used as-is, -and if they are also not specified, defaults to H2. - -[[database.hostname]]database.hostname:: -+ -Hostname of the database server. Defaults to 'localhost'. - -[[database.port]]database.port:: -+ -Port number of the database server. Defaults to the default port -of the server named by database.type. - -[[database.database]]database.database:: -+ -For POSTGRESQL or MYSQL, the name of the database on the server. -+ -For H2, this is the path to the database, and if not absolute is -relative to `'$site_path'`. - -[[database.username]]database.username:: -+ -Username to connect to the database server as. - -[[database.password]]database.password:: -+ -Password to authenticate to the database server with. - -[[database.driver]]database.driver:: -+ -Name of the JDBC driver class to connect to the database with. -Setting this usually isn't necessary as it can be derived from -database.type or database.url for any supported database. - -[[database.url]]database.url:: -+ -'jdbc:' URL for the database. Setting this variable usually -isn't necessary as it can be constructed from the all of the -above properties. - -[[database.poolLimit]]database.poolLimit:: -+ -Maximum number of open database connections. If the server needs -more than this number, request processing threads will wait up -to <> seconds for a -connection to be released before they abort with an exception. -This limit must be several units higher than the total number of -httpd and sshd threads as some request processing code paths may -need multiple connections. -+ -Default is 8. - -[[database.poolMinIdle]]database.poolMinIdle:: -+ -Minimum number of connections to keep idle in the pool. -Default is 4. - -[[database.poolMaxIdle]]database.poolMaxIdle:: -+ -Maximum number of connections to keep idle in the pool. If there -are more idle connections, connections will be closed instead of -being returned back to the pool. -Default is 4. - -[[database.poolMaxWait]]database.poolMaxWait:: -+ -Maximum amount of time a request processing thread will wait to -acquire a database connection from the pool. If no connection is -released within this time period, the processing thread will abort -its current operations and return an error to the client. -Values should use common unit suffixes to express their setting: -+ -* ms, milliseconds -* s, sec, second, seconds -* m, min, minute, minutes -* h, hr, hour, hours - -+ -If a unit suffix is not specified, `milliseconds` is assumed. -+ -Default is `30 seconds`. - -[[download]]Section download -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ----- -[download] - scheme = ssh - scheme = http - scheme = anon_http - scheme = anon_git - scheme = repo_download ----- - -The download section configures the allowed download methods. - -[[download.scheme]]download.scheme:: -+ -Schemes that should be used to download changes. -+ -Multiple schemes are supported: -+ -* `http` -+ -Authenticated HTTP download is allowed. -+ -* `ssh` -+ -Authenticated SSH download is allowed. -+ -* `anon_http` -+ -Anonymous HTTP download is allowed. -+ -* `anon_git` -+ -Anonymous Git download is allowed. This is not default, it is also -necessary to set <> -variable. -+ -* `repo_download` -+ -Gerrit advertises patch set downloads with the `repo download` -command, assuming that all projects managed by this instance are -generally worked on with the repo multi-repository tool. This is -not default, as not all instances will deploy repo. - -+ -If download.scheme is not specified, SSH, HTTP and Anonymous HTTP -downloads are allowed. - -[[gerrit]]Section gerrit -~~~~~~~~~~~~~~~~~~~~~~~~ - -[[gerrit.basePath]]gerrit.basePath:: -+ -Local filesystem directory holding all Git repositories that -Gerrit knows about and can process changes for. A project -entity in Gerrit maps to a local Git repository by creating -the path string `"$\{basePath}/$\{project_name}.git"`. -+ -If relative, the path is resolved relative to `'$site_path'`. - -[[gerrit.canonicalWebUrl]]gerrit.canonicalWebUrl:: -+ -The default URL for Gerrit to be accessed through. -+ -Typically this would be set to "http://review.example.com/" or -"http://example.com/gerrit/" so Gerrit can output links that point -back to itself. -+ -Setting this is highly recommended, as its necessary for the upload -code invoked by "git push" or "repo upload" to output hyperlinks -to the newly uploaded changes. - -[[gerrit.canonicalGitUrl]]gerrit.canonicalGitUrl:: -+ -Optional base URL for repositories available over the anonymous git -protocol. For example, set this to `git://mirror.example.com/base/` -to have Gerrit display patch set download URLs in the UI. Gerrit -automatically appends the project name onto the end of the URL. -+ -By default unset, as the git daemon must be configured externally -by the system administrator, and might not even be running on the -same host as Gerrit. - -[[gerrit.replicateOnStartup]]gerrit.replicateOnStartup:: -+ -If true, replicates to all remotes on startup to ensure they are -in-sync with this server. By default, true. - -[[gitweb]]Section gitweb -~~~~~~~~~~~~~~~~~~~~~~~~ - -Gerrit can forward requests to either an internally managed gitweb -(which allows Gerrit to enforce some access controls), or to an -externally managed gitweb (where the web server manages access). -See also link:config-gitweb.html[Gitweb Integration]. - -[[gitweb.cgi]]gitweb.cgi:: -+ -Path to the locally installed `gitweb.cgi` executable. This CGI will -be called by Gerrit Code Review when the URL `/gitweb` is accessed. -Project level access controls are enforced prior to calling the CGI. -+ -Defaults to `/usr/lib/cgi-bin/gitweb.cgi` if gitweb.url is not set. - -[[gitweb.url]]gitweb.url:: -+ -Optional URL of an affiliated gitweb service. Defines the -web location where a `gitweb.cgi` is installed to browse -gerrit.basePath and the repositories it contains. -+ -Gerrit appends any necessary query arguments onto the end of this URL. -For example, "?p=$project.git;h=$commit". - -[[gitweb.type]]gitweb.type:: -+ -Optional type of affiliated gitweb service. This allows using -alternatives to gitweb, such as cgit. -+ -Valid values are `gitweb`, `cgit` or `custom`. - -[[gitweb.type]]gitweb.revision:: -+ -Optional pattern to use for constructing the gitweb URL when pointing -at a specific commit when `custom` is used above. -+ -Valid replacements are `$\{project\}` for the project name in Gerrit -and `$\{commit\}` for the SHA1 hash for the commit. - -[[gitweb.type]]gitweb.project:: -+ -Optional pattern to use for constructing the gitweb URL when pointing -at a specific project when `custom` is used above. -+ -Valid replacements are `$\{project\}` for the project name in Gerrit. - -[[gitweb.type]]gitweb.branch:: -+ -Optional pattern to use for constructing the gitweb URL when pointing -at a specific branch when `custom` is used above. -+ -Valid replacements are `$\{project\}` for the project name in Gerrit -and `$\{branch\}` for the name of the branch. - - -[[hooks]]Section hooks -~~~~~~~~~~~~~~~~~~~~~~~~ - -See also link:config-hooks.html[Hooks]. - -[[hooks.path]]hooks.path:: -+ -Optional path to hooks, if not specified then `'$site_path'/hooks` will be used. - -[[hooks.patchsetCreatedHook]]hooks.patchsetCreatedHook:: -+ -Optional filename for the patchset created hook, if not specified then -`patchset-created` will be used. - -[[hooks.commentAddedHook]]hooks.commentAddedHook:: -+ -Optional filename for the comment added hook, if not specified then -`comment-added` will be used. - -[[hooks.changeMergedHook]]hooks.changeMergedHook:: -+ -Optional filename for the change merged hook, if not specified then -`change-merged` will be used. - -[[hooks.changeAbandonedHook]]hooks.changeAbandonedHook:: -+ -Optional filename for the change abandoned hook, if not specified then -`change-abandoned` will be used. - -[[http]]Section http -~~~~~~~~~~~~~~~~~~~~ - -[[http.proxy]]http.proxy:: -+ -URL of the proxy server when making outgoing HTTP -connections for OpenID login transactions. Syntax -should be `http://`'hostname'`:`'port'. - -[[http.proxyUsername]]http.proxyUsername:: -+ -Optional username to authenticate to the HTTP proxy with. -This property is honored only if the username does not -appear in the http.proxy property above. - -[[http.proxyPassword]]http.proxyPassword:: -+ -Optional password to authenticate to the HTTP proxy with. -This property is honored only if the password does not -appear in the http.proxy property above. - - -[[httpd]]Section httpd -~~~~~~~~~~~~~~~~~~~~~~ - -The httpd section configures the embedded servlet container. - -[[httpd.listenUrl]]httpd.listenUrl:: -+ -Specifies the URLs the internal HTTP daemon should listen for -connections on. The special hostname '\*' may be used to listen -on all local addresses. A context path may optionally be included, -placing Gerrit Code Review's web address within a subdirectory of -the server. -+ -Multiple protocol schemes are supported: -+ -* `http://`'hostname'`:`'port' -+ -Plain-text HTTP protocol. If port is not supplied, defaults to 80, -the standard HTTP port. -+ -* `https://`'hostname'`:`'port' -+ -SSL encrypted HTTP protocol. If port is not supplied, defaults to -443, the standard HTTPS port. -+ -Externally facing production sites are encouraged to use a reverse -proxy configuration and `proxy-https://` (below), rather than using -the embedded servlet container to implement the SSL processing. -The proxy server with SSL support is probably easier to configure, -provides more configuration options to control cipher usage, and -is likely using natively compiled encryption algorithms, resulting -in higher throughput. -+ -* `proxy-http://`'hostname'`:`'port' -+ -Plain-text HTTP relayed from a reverse proxy. If port is not -supplied, defaults to 8080. -+ -Like http, but additional header parsing features are -enabled to honor X-Forwarded-For, X-Forwarded-Host and -X-Forwarded-Server. These headers are typically set by Apache's -link:http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers[mod_proxy]. -+ -* `proxy-https://`'hostname'`:`'port' -+ -Plain text HTTP relayed from a reverse proxy that has already -handled the SSL encryption/decryption. If port is not supplied, -defaults to 8080. -+ -Behaves exactly like proxy-http, but also sets the scheme to assume -'https://' is the proper URL back to the server. - -+ -If multiple values are supplied, the daemon will listen on all -of them. -+ -By default, http://*:8080. - -[[httpd.reuseAddress]]httpd.reuseAddress:: -+ -If true, permits the daemon to bind to the port even if the port -is already in use. If false, the daemon ensures the port is not -in use before starting. Busy sites may need to set this to true -to permit fast restarts. -+ -By default, true. - -[[httpd.requestHeaderSize]]httpd.requestHeaderSize:: -+ -Size, in bytes, of the buffer used to parse the HTTP headers of an -incoming HTTP request. The entire request headers, including any -cookies sent by the browser, must fit within this buffer, otherwise -the server aborts with the response '413 Request Entity Too Large'. -+ -One buffer of this size is allocated per active connection. -Allocating a buffer that is too large wastes memory that cannot be -reclaimed, allocating a buffer that is too small may cause unexpected -errors caused by very long Referer URLs or large cookie values. -+ -By default, 16384 (16 K), which is sufficient for most OpenID and -other web-based single-sign-on integrations. - -[[httpd.sslKeyStore]]httpd.sslKeyStore:: -+ -Path of the Java keystore containing the server's SSL certificate -and private key. This keystore is required for `https://` in URL. -+ -To create a self-signed certificate for simple internal usage: -+ ----- -keytool -keystore keystore -alias jetty -genkey -keyalg RSA -chmod 600 keystore ----- -+ -If not absolute, the path is resolved relative to `$site_path`. -+ -By default, `$site_path/etc/keystore`. - -[[httpd.sslKeyPassword]]httpd.sslKeyPassword:: -+ -Password used to decrypt the private portion of the sslKeyStore. -Java key stores require a password, even if the administrator -doesn't want to enable one. -+ -If set to the empty string the embedded server will prompt for the -password during startup. -+ -By default, `gerrit`. - -[[httpd.requestLog]]httpd.requestLog:: -+ -Enable (or disable) the `'$site_path'/logs/httpd_log` request log. -If enabled, an NCSA combined log format request log file is written -out by the internal HTTP daemon. -+ -By default, true if httpd.listenUrl uses http:// or https://, -and false if httpd.listenUrl uses proxy-http:// or proxy-https://. - -[[httpd.acceptorThreads]]httpd.acceptorThreads:: -+ -Number of worker threads dedicated to accepting new incoming TCP -connections and allocate them connection-specific resources. -+ -By default, 2, which should be suitable for most high-traffic sites. - -[[httpd.minThreads]]httpd.minThreads:: -+ -Minimum number of spare threads to keep in the worker thread pool. -This number must be at least 1 larger than httpd.acceptorThreads -multipled by the number of httpd.listenUrls configured. -+ -By default, 5, suitable for most lower-volume traffic sites. - -[[httpd.maxThreads]]httpd.maxThreads:: -+ -Maximum number of threads to permit in the worker thread pool. -+ -By default 25, suitable for most lower-volume traffic sites. - -[[httpd.maxQueued]]httpd.maxQueued:: -+ -Maximum number of client connections which can enter the worker -thread pool waiting for a worker thread to become available. -0 disables the queue and permits infinite number of connections. -+ -By default 50. - -[[httpd.maxWait]]httpd.maxWait:: -+ -Maximum amount of time a client will wait to for an available -thread to handle a project clone, fetch or push request over the -smart HTTP transport. -+ -Values should use common unit suffixes to express their setting: -+ -* s, sec, second, seconds -* m, min, minute, minutes -* h, hr, hour, hours -* d, day, days -* w, week, weeks (`1 week` is treated as `7 days`) -* mon, month, months (`1 month` is treated as `30 days`) -* y, year, years (`1 year` is treated as `365 days`) - -+ -If a unit suffix is not specified, `minutes` is assumed. If 0 -is supplied, the maximum age is infinite and connections will not -abort until the client disconnects. -+ -By default, 5 minutes. - - -[[ldap]]Section ldap -~~~~~~~~~~~~~~~~~~~~ - -LDAP integration is only enabled if `auth.type` was set to -`HTTP_LDAP`, `LDAP` or `CLIENT_SSL_CERT_LDAP`. See above for a -detailed description of the auth.type settings and their -implications. - -An example LDAP configuration follows, and then discussion of -the parameters introduced here. Suitable defaults for most -parameters are automatically guessed based on the type of server -detected during startup. The guessed defaults support both -link:http://www.ietf.org/rfc/rfc2307.txt[RFC 2307] and Active -Directory. - ----- -[ldap] - server = ldap://ldap.example.com - - accountBase = ou=people,dc=example,dc=com - accountPattern = (&(objectClass=person)(uid=${username})) - accountFullName = displayName - accountEmailAddress = mail - - groupBase = ou=groups,dc=example,dc=com - groupMemberPattern = (&(objectClass=group)(member=${dn})) ----- - -[[ldap.server]]ldap.server:: -+ -URL of the organization's LDAP server to query for user information -and group membership from. Must be of the form `ldap://host` or -`ldaps://host` to bind with either a plaintext or SSL connection. -+ -If auth.type is `LDAP` this setting should use `ldaps://` to -ensure the end user's plaintext password is transmitted only over -an encrypted connection. - -[[ldap.sslVerify]]ldap.sslVerify:: -+ -If false and ldap.server is an `ldaps://` style URL, Gerrit -will not verify the server certificate when it connects to -perform a query. -+ -By default, true, requiring the certificate to be verified. - -[[ldap.username]]ldap.username:: -+ -_(Optional)_ Username to bind to the LDAP server with. If not set, -an anonymous connection to the LDAP server is attempted. - -[[ldap.password]]ldap.password:: -+ -_(Optional)_ Password for the user identified by `ldap.username`. -If not set, an anonymous (or passwordless) connection to the LDAP -server is attempted. - -[[ldap.referral]]ldap.referral:: -+ -_(Optional)_ How an LDAP referral should be handled if it is -encountered during directory traversal. Set to `follow` to -automatically follow any referrals, or `ignore` to stop and fail -with `javax.naming.PartialResultException: Unprocessed Continuation -Reference(s)` -+ -By default, `ignore`. - -[[ldap.accountBase]]ldap.accountBase:: -+ -Root of the tree containing all user accounts. This is typically -of the form `ou=people,dc=example,dc=com`. - -[[ldap.accountScope]]ldap.accountScope:: -+ -Scope of the search performed for accounts. Must be one of: -+ -* `one`: Search only one level below accountBase, but not recursive -* `sub` or `subtree`: Search recursively below accountBase -* `base` or `object`: Search exactly accountBase; probably not desired - -+ -Default is `subtree` as many directories have several levels. - -[[ldap.accountPattern]]ldap.accountPattern:: -+ -Query pattern to use when searching for a user account. This may be -any valid LDAP query expression, including the standard `(&...)` and -`(|...)` operators. If auth.type is `HTTP_LDAP` then the variable -`$\{username\}` is replaced with a parameter set to the username -that was supplied by the HTTP server. If auth.type is `LDAP` then -the variable `$\{username\}` is replaced by the string entered by -the end user. -+ -This pattern is used to search the objects contained directly under -the `ldap.accountBase` tree. A typical setting for this parameter -is `(uid=$\{username\})` or `(cn=$\{username\})`, but the proper -setting depends on the LDAP schema used by the directory server. -+ -Default is `(uid=$\{username\})` for RFC 2307 servers, -and `(&(objectClass=user)(sAMAccountName=${username}))` -for Active Directory. - -[[ldap.accountFullName]]ldap.accountFullName:: -+ -_(Optional)_ Name of an attribute on the user account object which -contains the initial value for the user's full name field in Gerrit. -Typically this is the `displayName` property in LDAP, but could -also be `legalName` or `cn`. -+ -Attribute values may be concatenated with literal strings, for -example to join given name and surname together use the pattern -`$\{givenName\} $\{SN\}`. -+ -If set, users will be unable to modify their full name field, as -Gerrit will populate it only from the LDAP data. -+ -Default is `displayName` for RFC 2307 servers, -and `${givenName} ${sn}` for Active Directory. - -[[ldap.accountEmailAddress]]ldap.accountEmailAddress:: -+ -_(Optional)_ Name of an attribute on the user account object which -contains the user's Internet email address, as defined by this -LDAP server. -+ -Attribute values may be concatenated with literal strings, -for example to set the email address to the lowercase form -of sAMAccountName followed by a constant domain name, use -`$\{sAMAccountName.toLowerCase\}@example.com`. -+ -If set, the preferred email address will be prefilled from LDAP, -but users may still be able to register additional email address, -and select a different preferred email address. -+ -Default is `mail`. - -[[ldap.accountSshUserName]]ldap.accountSshUserName:: -+ -_(Optional)_ Name of an attribute on the user account object which -contains the initial value for the user's SSH username field in -Gerrit. Typically this is the `uid` property in LDAP, but could -also be `cn`. Administrators should prefer to match the attribute -corresponding to the user's workstation username, as this is what -SSH clients will default to. -+ -Attribute values may also be forced to lowercase, or to uppercase in -an expression. For example, `$\{sAMAccountName.toLowerCase\}` will -force the value of sAMAccountName, if defined, to be all lowercase. -The suffix `.toUpperCase` can be used for the other direction. -The suffix `.localPart` can be used to split attribute values of -the form 'user@example.com' and return only the left hand side, for -example `$\{userPrincipalName.localPart\}` would provide only 'user'. -+ -If set, users will be unable to modify their SSH username field, as -Gerrit will populate it only from the LDAP data. -+ -Default is `uid` for RFC 2307 servers, -and `${sAMAccountName.toLowerCase}` for Active Directory. - -[[ldap.accountMemberField]]ldap.accountMemberField:: -+ -_(Optional)_ Name of an attribute on the user account object which -contains the groups the user is part of. Typically used for Active -Directory servers. -+ -Default is unset for RFC 2307 servers (disabled) -and `memberOf` for Active Directory. - -[[ldap.groupBase]]ldap.groupBase:: -+ -Root of the tree containing all group objects. This is typically -of the form `ou=groups,dc=example,dc=com`. - -[[ldap.groupScope]]ldap.groupScope:: -+ -Scope of the search performed for group objects. Must be one of: -+ -* `one`: Search only one level below groupBase, but not recursive -* `sub` or `subtree`: Search recursively below groupBase -* `base` or `object`: Search exactly groupBase; probably not desired - -+ -Default is `subtree` as many directories have several levels. - -[[ldap.groupPattern]]ldap.groupPattern:: -+ -Query pattern used when searching for an LDAP group to connect -to a Gerrit group. This may be any valid LDAP query expression, -including the standard `(&...)` and `(|...)` operators. The variable -`$\{groupname\}` is replaced with the search term supplied by the -group owner. -+ -Default is `(cn=$\{groupname\})` for RFC 2307, -and `(&(objectClass=group)(cn=$\{groupname\}))` for Active Directory. - -[[ldap.groupMemberPattern]]ldap.groupMemberPattern:: -+ -Query pattern to use when searching for the groups that a user -account is currently a member of. This may be any valid LDAP query -expression, including the standard `(&...)` and `(|...)` operators. -+ -If auth.type is `HTTP_LDAP` then the variable `$\{username\}` is -replaced with a parameter set to the username that was supplied -by the HTTP server. Other variables appearing in the pattern, -such as `$\{fooBarAttribute\}`, are replaced with the value of the -corresponding attribute (in this case, `fooBarAttribute`) as read -from the user's account object matched under `ldap.accountBase`. -Attributes such as `$\{dn\}` or `$\{uidNumber\}` may be useful. -+ -Default is `(memberUid=$\{username\})` for RFC 2307, -and unset (disabled) for Active Directory. - - -[[mimetype]]Section mimetype -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -[[mimetype.name.safe]]mimetype..safe:: -+ -If set to true, files with the MIME type `` will be sent as -direct downloads to the user's browser, rather than being wrapped up -inside of zipped archives. The type name may be a complete type -name, e.g. `image/gif`, a generic media type, e.g. `image/\*`, -or the wildcard `\*/*` to match all types. -+ -By default, false for all MIME types. - -Common examples: ----- -[mimetype "image/*"] - safe = true - -[mimetype "application/pdf"] - safe = true - -[mimetype "application/msword"] - safe = true - -[mimetype "application/vnd.ms-excel"] - safe = true ----- - - -[[pack]]Section pack -~~~~~~~~~~~~~~~~~~~~ -Global settings controlling how Gerrit Code Review creates pack -streams for Git clients running clone, fetch, or pull. Most of these -variables are per-client request, and thus should be carefully set -given the expected concurrent request load and available CPU and -memory resources. - -[[pack.deltacompression]]pack.deltacompression:: -+ -If true, delta compression between objects is enabled. This may -result in a smaller overall transfer for the client, but requires -more server memory and CPU time. -+ -False (off) by default, matching Gerrit Code Review 2.1.4. - -[[pack.threads]]pack.threads:: -+ -Maximum number of threads to use for delta compression (if enabled). -This is per-client request. If set to 0 then the number of CPUs is -auto-detected and one thread per CPU is used, per client request. -+ -By default, 1. - - -[[receive]]Section receive -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Sets the group of users allowed to execute 'receive-pack' on the -server, 'receive-pack' is what runs on the server during a user's -push or repo upload command. - ----- -[receive] - allowGroup = GROUP_ALLOWED_TO_EXECUTE - allowGroup = YET_ANOTHER_GROUP_ALLOWED_TO_EXECUTE ----- - -[[receive.allowGroup]]receive.allowGroup:: -+ -Name of the groups of users that are allowed to execute -'receive-pack' on the server. One or more groups can be set. -+ -If no groups are added, any user will be allowed to execute -'receive-pack' on the server. - - -[[repository]]Section repository -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Repositories in this sense are the same as projects. - -In the following example configuration the `Administrators` and the -`Registered Users` groups are set to be the ones to be allowed to -create projects matching `*` (any project). `Registered Users` is -set to be the default owner of new projects. - ----- -[repository "*"] - createGroup = Administrators - createGroup = Registered Users - ownerGroup = Registered Users ----- - -[NOTE] -Currently only the repository name `*` is supported. -This is a wildcard designating all repositories. - -[[repository.name.createGroup]]repository..createGroup:: -+ -A name of a group which exists in the database. Zero, one or many -groups are allowed. Each on its own line. Groups which don't exist -in the database are ignored. -+ -If no groups are declared (or only non-existing ones), the default -value `Administrators` is used. - -[[repository.name.ownerGroup]]repository..ownerGroup:: -+ -A name of a group which exists in the database. Zero, one or many -groups are allowed. Each on its own line. Groups which don't exist -in the database are ignored. -+ -If no groups are declared (or only non-existing ones), it defaults -to whatever is declared by `repository..createGroup` (including -any fallback to `Administrators`.) - -[[sendemail]]Section sendemail -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -[[sendemail.enable]]sendemail.enable:: -+ -If false Gerrit will not send email messages, for any reason, -and all other properties of section sendemail are ignored. -+ -By default, true, allowing notifications to be sent. - -[[sendemail.from]]sendemail.from:: -+ -Designates what name and address Gerrit will place in the From -field of any generated email messages. The supported values are: -+ -* `USER` -+ -Gerrit will set the From header to use the current user's -Full Name and Preferred Email. This may cause messsages to be -classified as spam if the user's domain has SPF or DKIM enabled -and <> is not a trusted -relay for that domain. -+ -* `MIXED` -+ -Shorthand for `$\{user\} (Code Review) ` where -`review@example.com` is the same as <>. -See below for a description of how the replacement is handled. -+ -* `SERVER` -+ -Gerrit will set the From header to the same name and address -it records in any commits Gerrit creates. This is set by -<> and <>, or guessed -from the local operating system. -+ -* 'Code Review' `<`'review'`@`'example.com'`>` -+ -If set to a name and email address in brackets, Gerrit will use -this name and email address for any messages, overriding the name -that may have been selected for commits by user.name and user.email. -Optionally, the name portion may contain the placeholder `$\{user\}`, -which is replaced by the Full Name of the current user. - -+ -By default, MIXED. - -[[sendemail.smtpServer]]sendemail.smtpServer:: -+ -Hostname (or IP address) of a SMTP server that will relay -messages generated by Gerrit to end users. -+ -By default, 127.0.0.1 (aka localhost). - -[[sendemail.smtpServerPort]]sendemail.smtpServerPort:: -+ -Port number of the SMTP server in sendemail.smtpserver. -+ -By default, 25, or 465 if smtpEncryption is 'ssl'. - -[[sendemail.smtpEncryption]]sendemail.smtpEncryption:: -+ -Specify the encryption to use, either 'ssl' or 'tls'. -+ -By default, 'none', indicating no encryption is used. - -[[sendemail.sslVerify]]sendemail.sslVerify:: -+ -If false and sendemail.smtpEncryption is 'ssl' or 'tls', Gerrit -will not verify the server certificate when it connects to send -an email message. -+ -By default, true, requiring the certificate to be verified. - -[[sendemail.smtpUser]]sendemail.smtpUser:: -+ -User name to authenticate with, if required for relay. - -[[sendemail.smtpPass]]sendemail.smtpPass:: -+ -Password for the account named by sendemail.smtpUser. - -[[sendemail.allowrcpt]]sendemail.allowrcpt:: -+ -If present, each value adds one entry to the whitelist of email -addresses that Gerrit can send email to. If set to a complete -email address, that one address is added to the white list. -If set to a domain name, any address at that domain can receive -email from Gerrit. -+ -By default, unset, permitting delivery to any email address. - -[[sendemail.importance]]sendemail.importance:: -+ -If present, emails sent from Gerrit will have the given level -of importance. Valid values include 'high' and 'low', which -email clients will render in different ways. -+ -By default, unset, so no Importance header is generated. - -[[sendemail.expiryDays]]sendemail.expiryDays:: -+ -If present, emails sent from Gerrit will expire after the given -number of days. This will add the Expiry-Date header and -email clients may expire or expunge mails whose Expiry-Date -header is in the past. This should be a positive non-zero -number indicating how many days in the future the mails -should expire. -+ -By default, unset, so no Expiry-Date header is generated. - -[[sshd]] Section sshd -~~~~~~~~~~~~~~~~~~~~~ - -[[sshd.listenAddress]]sshd.listenAddress:: -+ -Specifies the local addresses the internal SSHD should listen -for connections on. The following forms may be used to specify -an address. In any form, `:'port'` may be omitted to use the -default of 29418. -+ -* 'hostname':'port' (for example `review.example.com:29418`) -* 'IPv4':'port' (for example `10.0.0.1:29418`) -* ['IPv6']:'port' (for example `[ff02::1]:29418`) -* \*:'port' (for example `*:29418`) - -+ -If multiple values are supplied, the daemon will listen on all -of them. -+ -By default, *:29418. - -[[sshd.reuseAddress]]sshd.reuseAddress:: -+ -If true, permits the daemon to bind to the port even if the port -is already in use. If false, the daemon ensures the port is not -in use before starting. Busy sites may need to set this to true -to permit fast restarts. -+ -By default, true. - -[[sshd.tcpKeepAlive]]sshd.tcpKeepAlive:: -+ -If true, enables TCP keepalive messages to the other side, so -the daemon can terminate connections if the peer disappears. -+ -By default, true. - -[[sshd.threads]]sshd.threads:: -+ -Number of threads to use when executing SSH command requests. -If additional requests are received while all threads are busy they -are queued and serviced in a first-come-first-serve order. -+ -By default, 1.5x the number of CPUs available to the JVM. - -[[sshd.batchThreads]]sshd.batchThreads:: -+ -Number of threads to allocate for SSH command requests from -non-interactive users. If equals to 0, then all non-interactive -requests are executed in the same queue as interactive requests. -+ -Any other value will remove the number of threads from the queue -allocated to interactive users, and create a separate thread pool -of the requested size, which will be used to run commands from -non-interactive users. -+ -If the number of threads requested for non-interactive users is larger -than the total number of threads allocated in sshd.threads, then the -value of sshd.threads is increased to accomodate the requested value. -+ -By default, 0. - -[[sshd.streamThreads]]sshd.streamThreads:: -+ -Number of threads to use when formatting events to asynchronous -streaming clients. Event formatting is multiplexed onto this thread -pool by a simple FIFO scheduling system. -+ -By default, 1 plus the number of CPUs available to the JVM. - -[sshd.commandStartThreads]]sshd.commandStartThreads:: -+ -Number of threads used to parse a command line submitted by a client -over SSH for execution, create the internal data structures used by -that command, and schedule it for execution on another thread. -+ -By default, 2. - -[[sshd.maxAuthTries]]sshd.maxAuthTries:: -+ -Maximum number of authentication attempts before the server -disconnects the client. Each public key that a client has loaded -into its local agent counts as one auth request. Users can work -around the server's limit by loading less keys into their agent, -or selecting a specific key in their `~/.ssh/config` file with -the `IdentityFile` option. -+ -By default, 6. - -[[sshd.loginGraceTime]]sshd.loginGraceTime:: -+ -Time in seconds that a client has to authenticate before the server -automatically terminates their connection. Values should use common -unit suffixes to express their setting: -+ -* s, sec, second, seconds -* m, min, minute, minutes -* h, hr, hour, hours -* d, day, days - -+ -By default, 2 minutes. - -[[sshd.maxConnectionsPerUser]]sshd.maxConnectionsPerUser:: -+ -Maximum number of concurrent SSH sessions that a user account -may open at one time. This is the number of distinct SSH logins -the each user may have active at one time, and is not related to -the number of commands a user may issue over a single connection. -If set to 0, there is no limit. -+ -By default, 64. - -[[sshd.cipher]]sshd.cipher:: -+ -Available ciphers. To permit multiple ciphers, specify multiple -`sshd.cipher` keys in the configuration file, one cipher name -per key. Cipher names starting with `+` are enabled in addition -to the default ciphers, cipher names starting with `-` are removed -from the default cipher set. -+ -Supported ciphers: aes128-cbc, aes128-cbc, aes256-cbc, blowfish-cbc, -3des-cbc, none. -+ -By default, all supported ciphers except `none` are available. - -[[sshd.mac]]sshd.mac:: -+ -Available MAC (message authentication code) algorithms. To permit -multiple algorithms, specify multiple `sshd.mac` keys in the -configuration file, one MAC per key. MAC names starting with `+` -are enabled in addition to the default MACs, MAC names starting with -`-` are removed from the default MACs. -+ -Supported MACs: hmac-md5, hmac-md5-96, hmac-sha1, hmac-sha1-96. -+ -By default, all supported MACs are available. - -[[suggest]] Section suggest -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -[[suggest.accounts]]:: -+ -If `ALL`, all matching user accounts will be offered as -completion suggestions when adding a reviewer to a change, -or a user to a group. -+ -If `SAME_GROUP`, only users who are also members of a group the -current user is a member of will be offered. -+ -If `VISIBLE_GROUP`, only users who are members of at least one group -that is visible to the current user will be offered. -+ -If `OFF`, no account suggestions are given. -+ -Default is `ALL`. - -[[theme]] Section theme -~~~~~~~~~~~~~~~~~~~~~~~ - -[[theme.backgroundColor]]theme.backgroundColor:: -+ -Background color for the page, and major data tables like the all -open changes table or the account dashboard. The value must be a -valid HTML hex color code, or standard color name. -+ -By default `FCFEEF` (a creme color) for signed-out theme and white -(`FFFFFF`) for signed-in theme. - -[[theme.topMenuColor]]theme.topMenuColor:: -+ -This is the color of the main menu bar at the top of the page. -The value must be a valid HTML hex color code, or standard color -name. The value defaults to <>. - -[[theme.textColor]]theme.textColor:: -+ -Text color for the page, and major data tables like the all -open changes table or the account dashboard. The value must be a -valid HTML hex color code, or standard color name. -+ -By default black, `000000`. - -[[theme.trimColor]]theme.trimColor:: -+ -Primary color used as a background color behind text. This is -the color of the main menu bar at the top, of table headers, -and of major UI areas that we want to offset from other portions -of the page. The value must be a valid HTML hex color code, or -standard color name. -+ -By default a shade of green, `D4E9A9`. - -[[theme.selectionColor]]theme.selectionColor:: -+ -Background color used within a trimColor area to denote the currently -selected tab, or the background color used in a table to denote the -currently selected row. The value must be a valid HTML hex color -code, or standard color name. -+ -By default a shade of yellow, `FFFFCC`. - -A different theme may be used for signed-in vs. signed-out user status -by using the "signed-in" and "signed-out" theme sections. Variables -not specified in a section are inherited from the default theme. - ----- -[theme] - backgroundColor = FFFFFF -[theme "signed-in"] - backgroundColor = C0C0C0 -[theme "signed-out"] - backgroundColor = 00FFFF ----- - -[[trackingid]] Section trackingid -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Tagged footer lines containing references to external -tracking systems, parsed out of the commit message and -saved in Gerrit's database. After making changes to -this section, existing changes must be reindexed with the -link:pgm-ScanTrackingIds.html[ScanTrackingIds] program. - -The tracking ids are serachable using tr: or -bug:. - ----- -[trackingid "jira-bug"] - footer = Bugfix: - match = JRA\\d{2,8} - system = JIRA - -[trackingid "jira-feature"] - footer = Feature - match = JRA(\\d{2,8}) - system = JIRA ----- - -[[trackingid.name.footer]]trackingid..footer:: -+ -A prefix tag that identify the footer line to parse for tracking ids. -Several trakingid entries can have the same footer tag. -(the trailing ":" is optional) - -[[trackingid.name.match]]trackingid..match:: -+ -A link:http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html[standard -Java regular expression (java.util.regex)] used to match the -external tracking id part of the footer line. The match can -result in several entries in the DB. If grouping is used in the -regex the first group will be interpreted as the tracking id. -Tracking ids > 20 char will be ignored. -+ -The configuration file parser eats one level of backslashes, so the -character class `\s` requires `\\s` in the configuration file. The -parser also terminates the line at the first `#`, so a match -expression containing # must be wrapped in double quotes. - -[[trackingid.name.system]]trackingid..system:: -+ -The name of the external tracking system(max 10 char). -It is possible to have several trackingid entries for the same -tracking system. - -[[transfer]] Section transfer -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -[[transfer.timeout]]transfer.timeout:: -+ -Number of seconds to wait for a single network read or write -to complete before giving up and declaring the remote side is -not responding. If 0, there is no timeout, and this server will -wait indefinitely for a transfer to finish. -+ -A timeout should be large enough to mostly transfer the objects to -the other side. 1 second may be too small for larger projects, -especially over a WAN link, while 10-30 seconds is a much more -reasonable timeout value. -+ -Defaults to 0 seconds, wait indefinitely. - - -[[upload]]Section upload -~~~~~~~~~~~~~~~~~~~~~~~~~~ -Sets the group of users allowed to execute 'upload-pack' on the -server, 'upload-pack' is what runs on the server during a user's -fetch, clone or repo sync command. - ----- -[upload] - allowGroup = GROUP_ALLOWED_TO_EXECUTE - allowGroup = YET_ANOTHER_GROUP_ALLOWED_TO_EXECUTE ----- - -[[upload.allowGroup]]upload.allowGroup:: -+ -Name of the groups of users that are allowed to execute 'upload-pack' -on the server. One or more groups can be set. -+ -If no groups are added, any user will be allowed to execute -'upload-pack' on the server. - - -[[user]] Section user -~~~~~~~~~~~~~~~~~~~~~ - -[[user.name]]user.name:: -+ -Name that Gerrit calls itself in Git when it creates a new Git -commit, such as a merge during change submission. -+ -By default this is "Gerrit Code Review". - -[[user.email]]user.email:: -+ -Email address that Gerrit refers to itself as when it creates a -new Git commit, such as a merge commit during change submission. -+ -If not set, Gerrit generates this as "gerrit@`hostname`", where -`hostname` is the hostname of the system Gerrit is running on. -+ -By default, not set, generating the value at startup. - - -File `etc/secure.config` -------------------------- -The optional file `'$site_path'/etc/secure.config` overrides (or -supplements) the settings supplied by `'$site_path'/etc/gerrit.config`. -The file should be readable only by the daemon process and can be -used to contain private configuration entries that wouldn't normally -be exposed to everyone. - -Sample `etc/secure.config`: ----- -[database] - username = webuser - password = s3kr3t - -[ldap] - password = l3tm3srch - -[httpd] - sslKeyPassword = g3rr1t - -[sendemail] - smtpPass = sp@m - -[remote "bar"] - password = s3kr3t ----- - -File `etc/replication.config` ------------------------------ - -The optional file `'$site_path'/etc/replication.config` controls how -Gerrit automatically replicates changes it makes to any of the Git -repositories under its control. - -* link:config-replication.html[Git Replication/Mirroring] - -Database system_config ----------------------- - -Several columns in the `system_config` table within the metadata -database may be set to control how Gerrit behaves. - -[NOTE] -The contents of the `system_config` table are cached at startup -by Gerrit. If you modify any columns in this table, Gerrit needs -to be restarted before it will use the new values. - -Configurable Parameters -~~~~~~~~~~~~~~~~~~~~~~~ - -site_path:: -+ -Local filesystem directory holding the site customization assets. -Placing this directory under version control and/or backup is a -good idea. -+ -Files in this directory provide additional configuration. -+ -Other files support site customization. -+ -* link:config-headerfooter.html[Site Header/Footer] -* link:config-replication.html[Git Replication/Mirroring] - -Not User Serviceable -~~~~~~~~~~~~~~~~~~~~ - -These fields generally shouldn't be modified. - -register_email_private_key:: -+ -Private key used to sign the links emailed to users when they -request to register a new email address on their user account. -When the link is activated, the private key authenticates the link -was created and sent by this Gerrit server, proving that the user -can receive email at the address they are registering. -+ -This column is automatically generated when the database is -initialized. Changing it to a new value would cause all current -links to be invalidated. -+ -Changing it is not recommended. - -admin_group_id:: -+ -Unique identity of the group with full privileges. Any user who -is a member of this group may manage any other group, any project, -and other system settings over the web. -+ -This is initialized by Gerrit to be the "Administrators" group. -+ -Changing it is not recommended. - -anonymous_group_id:: -+ -Unique identity of the group for anonymous (not authenticated) users. -+ -All users are a member of this group, whether or not they are -actually signed in to Gerrit. Any access rights assigned to -this group are inherited by all users. -+ -This is initialized by Gerrit to be the "Anonymous Users" group. -+ -Changing it is not recommended. - -registered_group_id:: -+ -Unique identity of the group for all authenticated users. -+ -All signed-in users are a member of this group. Any access rights -assigned to this group are inherited by all users once they have -authenticated to Gerrit. -+ -Since account registration is open and fairly easy to obtain, -moving from the "Anonymous Users" group to this group is not -very difficult. Caution should be taken when assigning any -permissions to this group. -+ -This is initialized by Gerrit to be the "Registered Users" group. -+ -Changing it is not recommended. - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/config-gitweb.txt b/Documentation/config-gitweb.txt deleted file mode 100644 index a08eb873b8..0000000000 --- a/Documentation/config-gitweb.txt +++ /dev/null @@ -1,122 +0,0 @@ -Gerrit Code Review - Gitweb Integration -======================================= - -Gerrit Code Review can manage and generate hyperlinks to gitweb, -allowing users to jump from Gerrit content to the same information, -but shown by gitweb. - - -Internal/Managed gitweb ------------------------ - -In the internal configuration, Gerrit inspects the request, enforces -its project level access controls, and directly executes `gitweb.cgi` -if the user is authorized to view the page. - -To enable the internal configuration, set -link:config-gerrit.html#gitweb.cgi[gitweb.cgi] with the path of the -installed CGI. This defaults to `/usr/lib/cgi-bin/gitweb.cgi`, -which is a common installation path for the 'gitweb' package on -Linux distributions. - -==== - git config --file $site_path/etc/gerrit.config gitweb.cgi /usr/lib/cgi-bin/gitweb.cgi - git config --file $site_path/etc/gerrit.config --unset gitweb.url -==== - -Alternatively, if Gerrit is served behind reverse proxy, it can -generate different URLs for gitweb's links (they need to be -rewritten to `/gitweb?args` on the web server). This allows -for serving gitweb under different URL than the Gerrit instance. -To enable this feature, set both: `gitweb.cgi` and `gitweb.url`. - -==== - git config --file $site_path/etc/gerrit.config gitweb.cgi /usr/lib/cgi-bin/gitweb.cgi - git config --file $site_path/etc/gerrit.config gitweb.url /pretty/path/to/gitweb -==== - -After updating `'$site_path'/etc/gerrit.config`, the Gerrit server must -be restarted and clients must reload the host page to see the change. - -Configuration -~~~~~~~~~~~~~ - -Most of the gitweb configuration file is handled automatically -by Gerrit Code Review. Site specific overrides can be placed in -`'$site_path'/etc/gitweb_config.perl`, as this file is loaded as -part of the generated configuration file. - -Logo and CSS -~~~~~~~~~~~~ - -If the package-manager installed CGI (`/usr/lib/cgi-bin/gitweb.cgi`) -is being used, the stock CSS and logo files will be served from -either `/usr/share/gitweb` or `/var/www`. - -Otherwise, Gerrit expects `gitweb.css` and `git-logo.png` to be found -in the same directory as the CGI script itself. This matches with -the default source code distribution, and most custom installations. - -Access Control -~~~~~~~~~~~~~~ - -Access controls for internally managed gitweb page views are enforced -using the standard project READ +1 permission. - - -External/Unmanaged gitweb -------------------------- - -In the external configuration, gitweb runs under the control of an -external web server, and Gerrit access controls are not enforced. - -To enable the external gitweb integration, set -link:config-gerrit.html#gitweb.url[gitweb.url] with the URL of your -gitweb CGI. - -The CGI's `$projectroot` should be the same directory as -gerrit.basePath, or a fairly current replica. If a replica is -being used, ensure it uses a full mirror, so the `refs/changes/*` -namespace is available. - -==== - git config --file $site_path/etc/gerrit.config gitweb.url http://example.com/gitweb.cgi - git config --file $site_path/etc/gerrit.config --unset gitweb.cgi -==== - -After updating `'$site_path'/etc/gerrit.config`, the Gerrit server must -be restarted and clients must reload the host page to see the change. - -Access Control -~~~~~~~~~~~~~~ - -Gitweb access controls can be implemented using standard web server -access controls. This isn't typically integrated with Gerrit's own -access controls. Caution must be taken to ensure the controls are -consistent if access needs to be restricted. - -Caching Gitweb -~~~~~~~~~~~~~~ - -If your repository set is large and you are expecting a lot -of users, you may want to look at the caching forks used by -high-traffic sites like kernel.org or repo.or.cz. - -Alternatives to gitweb -~~~~~~~~~~~~~~~~~~~~~~ -There are other alternatives to gitweb that can also be used with -Gerrit, such as cgit. - -cgit can be used by specifying `gitweb.type` to be 'cgit'. - -It is also possible to define custom patterns. - -See Also --------- - -* link:config-gerrit.html#gitweb[Section gitweb] -* link:http://hjemli.net/git/cgit/[cgit] - -GERRIT ------- -Part of link:index.html[Gerrit Code Review] diff --git a/Documentation/config-headerfooter.txt b/Documentation/config-headerfooter.txt deleted file mode 100644 index c06080b50b..0000000000 --- a/Documentation/config-headerfooter.txt +++ /dev/null @@ -1,132 +0,0 @@ -Gerrit Code Review - Site Customization -======================================= - -Gerrit supports some customization of the HTML it sends to -the browser, allowing organizations to alter the look and -feel of the application to fit with their general scheme. - -HTML Header/Footer ------------------- - -At startup Gerrit reads the following files (if they exist) and -uses them to customize the HTML page it sends to clients: - -* `'$site_path'/etc/GerritSiteHeader.html` -+ -HTML is inserted below the menu bar, but above any page content. -This is a good location for an organizational logo, or links to -other systems like bug tracking. - -* `'$site_path'/etc/GerritSiteFooter.html` -+ -HTML is inserted at the bottom of the page, below all other content, -but just above the footer rule and the "Powered by Gerrit Code -Review (v....)" message shown at the extreme bottom. - -* `'$site_path'/etc/GerritSite.css` -+ -The CSS rules are inlined into the top of the HTML page, inside -of a ` - - -

Configuration Error

-
- Check the HTTP server's authentication settings. -
- -

- The HTTP server did not provide the username in the - HEADER header when it - forwarded the request to Gerrit Code Review. -

- -

- If the HTTP server is Apache HTTPd, check the proxy - configuration includes an authorization directive with - the proper location, ensuring it ends with '/': -

-
-<VirtualHost review.example.com:80>
-    ServerName review.example.com
-
-    ProxyRequests Off
-    ProxyVia Off
-    ProxyPreserveHost On
-
-    <Proxy *>
-          Order deny,allow
-          Allow from all
-    </Proxy>
-
-
<Location /r/login/> - AuthType Basic - AuthName "Gerrit Code Review" - Require valid-user - ... - </Location>
- ProxyPass /r/ http://.../r/ -</VirtualHost> -
- - diff --git a/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/auth/container/LoginRedirect.html b/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/auth/container/LoginRedirect.html deleted file mode 100644 index 856ee71f3c..0000000000 --- a/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/auth/container/LoginRedirect.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - Gerrit Code Review - - - -

Redirecting to Gerrit Code Review.

- - diff --git a/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/raw/HostPage.html b/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/raw/HostPage.html deleted file mode 100644 index ff09f50506..0000000000 --- a/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/raw/HostPage.html +++ /dev/null @@ -1,54 +0,0 @@ - - - Gerrit Code Review - - - - - - - -
-
-
-

Loading Gerrit Code Review ...

- -
-
-
- -
-
- - - - diff --git a/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/raw/LegacyGerrit.html b/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/raw/LegacyGerrit.html deleted file mode 100644 index 5050bf245f..0000000000 --- a/gerrit-httpd/src/main/resources/com/google/gerrit/httpd/raw/LegacyGerrit.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - Gerrit Code Review - - - -

Redirecting to Gerrit Code Review.

- - diff --git a/gerrit-httpd/src/test/java/com/google/gerrit/httpd/rpc/project/ListBranchesTest.java b/gerrit-httpd/src/test/java/com/google/gerrit/httpd/rpc/project/ListBranchesTest.java deleted file mode 100644 index 51fcf2e6f5..0000000000 --- a/gerrit-httpd/src/test/java/com/google/gerrit/httpd/rpc/project/ListBranchesTest.java +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright (C) 2009 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.project; - -import static org.easymock.EasyMock.createStrictMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.expectLastCall; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.eclipse.jgit.lib.Constants.HEAD; -import static org.eclipse.jgit.lib.Constants.R_HEADS; -import static org.eclipse.jgit.lib.Ref.Storage.LOOSE; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import com.google.gerrit.common.data.ListBranchesResult; -import com.google.gerrit.reviewdb.Branch; -import com.google.gerrit.reviewdb.Project; -import com.google.gerrit.server.git.GitRepositoryManager; -import com.google.gerrit.server.project.NoSuchProjectException; -import com.google.gerrit.server.project.ProjectControl; -import com.google.gerrit.server.project.RefControl; -import com.google.gwtorm.client.KeyUtil; -import com.google.gwtorm.server.StandardKeyEncoder; - -import org.easymock.IExpectationSetters; -import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.ObjectIdRef; -import org.eclipse.jgit.lib.Ref; -import org.eclipse.jgit.lib.RefUpdate; -import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.SymbolicRef; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class ListBranchesTest extends LocalDiskRepositoryTestCase { - static { - KeyUtil.setEncoderImpl(new StandardKeyEncoder()); - } - - private ObjectId idA; - private Project.NameKey name; - private Repository realDb; - private Repository mockDb; - private ProjectControl.Factory pcf; - private ProjectControl pc; - private GitRepositoryManager grm; - private List refMocks; - - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - - idA = ObjectId.fromString("df84c2f4f7ce7e0b25cdeac84b8870bcff319885"); - name = new Project.NameKey("test"); - realDb = createBareRepository(); - - mockDb = createStrictMock(Repository.class); - pc = createStrictMock(ProjectControl.class); - pcf = createStrictMock(ProjectControl.Factory.class); - grm = createStrictMock(GitRepositoryManager.class); - refMocks = new ArrayList(); - } - - private IExpectationSetters validate() - throws NoSuchProjectException { - return expect(pcf.validateFor(eq(name), // - eq(ProjectControl.OWNER | ProjectControl.VISIBLE))); - } - - private void doReplay() { - replay(mockDb, pc, pcf, grm); - replay(refMocks.toArray()); - } - - private void doVerify() { - verify(mockDb, pc, pcf, grm); - verify(refMocks.toArray()); - } - - private void set(String branch, ObjectId id) throws IOException { - final RefUpdate u = realDb.updateRef(R_HEADS + branch); - u.setForceUpdate(true); - u.setNewObjectId(id); - switch (u.update()) { - case NEW: - case FAST_FORWARD: - case FORCED: - break; - default: - fail("unexpected update failure " + branch + " " + u.getResult()); - } - } - - @Test - public void testProjectNotVisible() throws Exception { - final NoSuchProjectException err = new NoSuchProjectException(name); - validate().andThrow(err); - doReplay(); - try { - new ListBranches(pcf, grm, name).call(); - fail("did not throw when expected not authorized"); - } catch (NoSuchProjectException e2) { - assertSame(err, e2); - } - doVerify(); - } - - - private ListBranchesResult permitted(boolean getHead) - throws NoSuchProjectException, IOException { - Map refs = realDb.getAllRefs(); - - validate().andReturn(pc); - - expect(grm.openRepository(eq(name))).andReturn(mockDb); - expect(mockDb.getAllRefs()).andDelegateTo(realDb); - if (getHead) { - expect(mockDb.getRef(HEAD)).andDelegateTo(realDb); - if (!refs.containsKey(HEAD) && realDb.getRef(HEAD) != null) { - refs.put(HEAD, realDb.getRef(HEAD)); - } - } - - Set targets = targets(refs); - for (Ref ref : refs.values()) { - assumeVisible(ref, true, targets); - } - - mockDb.close(); - - expect(pc.canAddRefs()).andReturn(true); - - expectLastCall(); - - doReplay(); - final ListBranchesResult r = new ListBranches(pcf, grm, name).call(); - doVerify(); - assertNotNull(r); - assertNotNull(r.getBranches()); - return r; - } - - private Set targets(Map refs) { - Set targets = new HashSet(); - for (Ref ref : refs.values()) { - if (ref.isSymbolic()) { - targets.add(ref.getLeaf().getName()); - } - } - return targets; - } - - private void assumeVisible(Ref ref, boolean visible, Set targets) { - RefControl rc = createStrictMock(RefControl.class); - refMocks.add(rc); - expect(rc.isVisible()).andReturn(visible); - if (visible && !ref.isSymbolic() && !targets.contains(ref.getName())) { - expect(rc.canDelete()).andReturn(true); - } - - if (ref.isSymbolic()) { - expect(pc.controlForRef(ref.getTarget().getName())).andReturn(rc); - } else { - expect(pc.controlForRef(ref.getName())).andReturn(rc); - } - } - - @Test - public void testEmptyProject() throws Exception { - ListBranchesResult r = permitted(true); - - assertEquals(1, r.getBranches().size()); - - Branch b = r.getBranches().get(0); - assertNotNull(b); - - assertNotNull(b.getNameKey()); - assertSame(name, b.getNameKey().getParentKey()); - assertEquals(HEAD, b.getNameKey().get()); - - assertEquals(HEAD, b.getName()); - assertEquals(HEAD, b.getShortName()); - - assertNotNull(b.getRevision()); - assertEquals("master", b.getRevision().get()); - } - - @Test - public void testMasterBranch() throws Exception { - set("master", idA); - - ListBranchesResult r = permitted(false); - assertEquals(2, r.getBranches().size()); - - Branch b = r.getBranches().get(0); - assertNotNull(b); - - assertNotNull(b.getNameKey()); - assertSame(name, b.getNameKey().getParentKey()); - assertEquals(HEAD, b.getNameKey().get()); - - assertEquals(HEAD, b.getName()); - assertEquals(HEAD, b.getShortName()); - - assertNotNull(b.getRevision()); - assertEquals("master", b.getRevision().get()); - - b = r.getBranches().get(1); - assertNotNull(b); - - assertNotNull(b.getNameKey()); - assertSame(name, b.getNameKey().getParentKey()); - assertEquals(R_HEADS + "master", b.getNameKey().get()); - - assertEquals(R_HEADS + "master", b.getName()); - assertEquals("master", b.getShortName()); - - assertNotNull(b.getRevision()); - assertEquals(idA.name(), b.getRevision().get()); - } - - @Test - public void testBranchNotHead() throws Exception { - set("foo", idA); - - ListBranchesResult r = permitted(true); - assertEquals(2, r.getBranches().size()); - - Branch b = r.getBranches().get(0); - assertNotNull(b); - - assertNotNull(b.getNameKey()); - assertSame(name, b.getNameKey().getParentKey()); - assertEquals(HEAD, b.getNameKey().get()); - - assertEquals(HEAD, b.getName()); - assertEquals(HEAD, b.getShortName()); - - assertNotNull(b.getRevision()); - assertEquals("master", b.getRevision().get()); - assertFalse(b.getCanDelete()); - - b = r.getBranches().get(1); - assertNotNull(b); - - assertNotNull(b.getNameKey()); - assertSame(name, b.getNameKey().getParentKey()); - assertEquals(R_HEADS + "foo", b.getNameKey().get()); - - assertEquals(R_HEADS + "foo", b.getName()); - assertEquals("foo", b.getShortName()); - - assertNotNull(b.getRevision()); - assertEquals(idA.name(), b.getRevision().get()); - assertTrue(b.getCanDelete()); - } - - @Test - public void testSortByName() throws Exception { - Map u = new LinkedHashMap(); - u.put("foo", new ObjectIdRef.Unpeeled(LOOSE, R_HEADS + "foo", idA)); - u.put("bar", new ObjectIdRef.Unpeeled(LOOSE, R_HEADS + "bar", idA)); - u.put(HEAD, new SymbolicRef(HEAD, new ObjectIdRef.Unpeeled(LOOSE, R_HEADS - + "master", null))); - - validate().andReturn(pc); - expect(grm.openRepository(eq(name))).andReturn(mockDb); - expect(mockDb.getAllRefs()).andReturn(u); - for (Ref ref : u.values()) { - assumeVisible(ref, true, targets(u)); - } - expect(pc.canAddRefs()).andReturn(true); - mockDb.close(); - expectLastCall(); - - doReplay(); - final ListBranchesResult r = new ListBranches(pcf, grm, name).call(); - doVerify(); - assertNotNull(r); - - assertEquals(3, r.getBranches().size()); - assertEquals(HEAD, r.getBranches().get(0).getShortName()); - assertEquals("bar", r.getBranches().get(1).getShortName()); - assertEquals("foo", r.getBranches().get(2).getShortName()); - } - - @Test - public void testHeadNotVisible() throws Exception { - ObjectIdRef.Unpeeled bar = - new ObjectIdRef.Unpeeled(LOOSE, R_HEADS + "bar", idA); - Map u = new LinkedHashMap(); - u.put(bar.getName(), bar); - u.put(HEAD, new SymbolicRef(HEAD, bar)); - - validate().andReturn(pc); - expect(grm.openRepository(eq(name))).andReturn(mockDb); - expect(mockDb.getAllRefs()).andReturn(u); - assumeVisible(bar, false, targets(u)); - assumeVisible(bar, false, targets(u)); - expect(pc.canAddRefs()).andReturn(true); - mockDb.close(); - expectLastCall(); - - doReplay(); - final ListBranchesResult r = new ListBranches(pcf, grm, name).call(); - doVerify(); - assertNotNull(r); - assertTrue(r.getBranches().isEmpty()); - } - - @Test - public void testHeadVisibleButBranchHidden() throws Exception { - ObjectIdRef.Unpeeled bar = - new ObjectIdRef.Unpeeled(LOOSE, R_HEADS + "bar", idA); - ObjectIdRef.Unpeeled foo = - new ObjectIdRef.Unpeeled(LOOSE, R_HEADS + "foo", idA); - - Map u = new LinkedHashMap(); - u.put(bar.getName(), bar); - u.put(HEAD, new SymbolicRef(HEAD, bar)); - u.put(foo.getName(), foo); - - validate().andReturn(pc); - expect(grm.openRepository(eq(name))).andReturn(mockDb); - expect(mockDb.getAllRefs()).andReturn(u); - assumeVisible(bar, true, targets(u)); - assumeVisible(bar, true, targets(u)); - assumeVisible(foo, false, targets(u)); - expect(pc.canAddRefs()).andReturn(true); - mockDb.close(); - expectLastCall(); - - doReplay(); - final ListBranchesResult r = new ListBranches(pcf, grm, name).call(); - doVerify(); - assertNotNull(r); - - assertEquals(2, r.getBranches().size()); - - assertEquals(HEAD, r.getBranches().get(0).getShortName()); - assertFalse(r.getBranches().get(0).getCanDelete()); - - assertEquals("bar", r.getBranches().get(1).getShortName()); - assertFalse(r.getBranches().get(1).getCanDelete()); - } -} diff --git a/gerrit-launcher/.gitignore b/gerrit-launcher/.gitignore deleted file mode 100644 index 903c6c80f5..0000000000 --- a/gerrit-launcher/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target -/.classpath -/.project -/.settings/org.maven.ide.eclipse.prefs diff --git a/gerrit-launcher/.settings/org.eclipse.core.resources.prefs b/gerrit-launcher/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 82eb859e3b..0000000000 --- a/gerrit-launcher/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/gerrit-launcher/.settings/org.eclipse.core.runtime.prefs b/gerrit-launcher/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 8667cfd4a3..0000000000 --- a/gerrit-launcher/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -line.separator=\n diff --git a/gerrit-launcher/.settings/org.eclipse.jdt.core.prefs b/gerrit-launcher/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 04afc7fac5..0000000000 --- a/gerrit-launcher/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,268 +0,0 @@ -#Tue May 12 17:44:13 PDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=16 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=80 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/gerrit-launcher/.settings/org.eclipse.jdt.ui.prefs b/gerrit-launcher/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d4218a5fc0..0000000000 --- a/gerrit-launcher/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -#Wed Jul 29 11:31:38 PDT 2009 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Google Format -formatter_settings_version=11 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax; -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=true -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/gerrit-launcher/pom.xml b/gerrit-launcher/pom.xml deleted file mode 100644 index a5b0159078..0000000000 --- a/gerrit-launcher/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - 4.0.0 - - - com.google.gerrit - gerrit-parent - 2.2-SNAPSHOT - - - gerrit-launcher - Gerrit Code Review - Launcher - - - Bootstraps the rest of our classpath after Main - - 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 deleted file mode 100644 index a097d75851..0000000000 --- a/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java +++ /dev/null @@ -1,471 +0,0 @@ -// Copyright (C) 2009 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.launcher; - -import static java.util.concurrent.TimeUnit.DAYS; -import static java.util.concurrent.TimeUnit.MILLISECONDS; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.net.JarURLConnection; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.CodeSource; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.jar.Attributes; -import java.util.jar.JarFile; -import java.util.jar.Manifest; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -/** Main class for a JAR file to run code from "WEB-INF/lib". */ -public final class GerritLauncher { - private static final String pkg = "com.google.gerrit.pgm"; - public static final String NOT_ARCHIVED = "NOT_ARCHIVED"; - - public static void main(final String argv[]) throws Exception { - System.exit(mainImpl(argv)); - } - - private static int mainImpl(final String argv[]) throws Exception { - if (argv.length == 0) { - File me; - try { - me = getDistributionArchive(); - } catch (FileNotFoundException e) { - me = null; - } - - String jar = me != null ? me.getName() : "gerrit.war"; - System.err.println("Gerrit Code Review " + getVersion(me)); - System.err.println("usage: java -jar " + jar + " command [ARG ...]"); - System.err.println(); - System.err.println("The most commonly used commands are:"); - System.err.println(" init Initialize a Gerrit installation"); - System.err.println(" daemon Run the Gerrit network daemons"); - System.err.println(" gsql Run the interactive query console"); - System.err.println(" version Display the build version number"); - System.err.println(); - System.err.println(" ls List files available for cat"); - System.err.println(" cat FILE Display a file from the archive"); - System.err.println(); - return 1; - } - - // Special cases, a few global options actually are programs. - // - if ("-v".equals(argv[0]) || "--version".equals(argv[0])) { - argv[0] = "version"; - } else if ("-p".equals(argv[0]) || "--cat".equals(argv[0])) { - argv[0] = "cat"; - } else if ("-l".equals(argv[0]) || "--ls".equals(argv[0])) { - argv[0] = "ls"; - } - - // Run the application class - // - final ClassLoader cl = libClassLoader(); - Thread.currentThread().setContextClassLoader(cl); - return invokeProgram(cl, argv); - } - - private static String getVersion(final File me) { - if (me == null) { - return ""; - } - - try { - final JarFile jar = new JarFile(me); - try { - Manifest mf = jar.getManifest(); - Attributes att = mf.getMainAttributes(); - String val = att.getValue(Attributes.Name.IMPLEMENTATION_VERSION); - return val != null ? val : ""; - } finally { - jar.close(); - } - } catch (IOException e) { - return ""; - } - } - - private static int invokeProgram(final ClassLoader loader, - final String[] origArgv) throws Exception { - String name = origArgv[0]; - final String[] argv = new String[origArgv.length - 1]; - System.arraycopy(origArgv, 1, argv, 0, argv.length); - - Class clazz; - try { - try { - String cn = name; - if (cn.equals(cn.toLowerCase())) { - cn = cn.substring(0, 1).toUpperCase() + cn.substring(1); - } - clazz = Class.forName(pkg + "." + cn, true, loader); - } catch (ClassNotFoundException cnfe) { - if (name.equals(name.toLowerCase())) { - clazz = Class.forName(pkg + "." + name, true, loader); - } else { - throw cnfe; - } - } - } catch (ClassNotFoundException cnfe) { - System.err.println("fatal: unknown command " + name); - System.err.println(" (no " + pkg + "." + name + ")"); - return 1; - } - - final Method main; - try { - main = clazz.getMethod("main", argv.getClass()); - } catch (SecurityException e) { - System.err.println("fatal: unknown command " + name); - return 1; - } catch (NoSuchMethodException e) { - System.err.println("fatal: unknown command " + name); - return 1; - } - - final Object res; - try { - if ((main.getModifiers() & Modifier.STATIC) == Modifier.STATIC) { - res = main.invoke(null, new Object[] {argv}); - } else { - res = main.invoke(clazz.newInstance(), new Object[] {argv}); - } - } catch (InvocationTargetException ite) { - if (ite.getCause() instanceof Exception) { - throw (Exception) ite.getCause(); - } else if (ite.getCause() instanceof Error) { - throw (Error) ite.getCause(); - } else { - throw ite; - } - } - if (res instanceof Number) { - return ((Number) res).intValue(); - } else { - return 0; - } - } - - private static ClassLoader libClassLoader() throws IOException { - final File path; - try { - path = getDistributionArchive(); - } catch (FileNotFoundException e) { - if (NOT_ARCHIVED == e.getMessage()) { - // Assume the CLASSPATH was made complete by the calling process, - // as we are likely being run from within a developer's IDE. - // - return GerritLauncher.class.getClassLoader(); - } - throw e; - } - - final ArrayList jars = new ArrayList(); - try { - final ZipFile zf = new ZipFile(path); - try { - final Enumeration e = zf.entries(); - while (e.hasMoreElements()) { - final ZipEntry ze = e.nextElement(); - if (ze.isDirectory()) { - continue; - } - - if (ze.getName().startsWith("WEB-INF/lib/")) { - final File tmp = createTempFile(safeName(ze), ".jar"); - final FileOutputStream out = new FileOutputStream(tmp); - try { - final InputStream in = zf.getInputStream(ze); - try { - final byte[] buf = new byte[4096]; - int n; - while ((n = in.read(buf, 0, buf.length)) > 0) { - out.write(buf, 0, n); - } - } finally { - in.close(); - } - } finally { - out.close(); - } - jars.add(tmp.toURI().toURL()); - } - } - } finally { - zf.close(); - } - } catch (IOException e) { - throw new IOException("Cannot obtain libraries from " + path, e); - } - - if (jars.isEmpty()) { - return GerritLauncher.class.getClassLoader(); - } - return new URLClassLoader(jars.toArray(new URL[jars.size()])); - } - - private static String safeName(final ZipEntry ze) { - // Try to derive the name of the temporary file so it - // doesn't completely suck. Best if we can make it - // match the name it was in the archive. - // - String name = ze.getName(); - if (0 <= name.lastIndexOf('/')) { - name = name.substring(name.lastIndexOf('/') + 1); - } - if (0 <= name.lastIndexOf('.')) { - name = name.substring(0, name.lastIndexOf('.')); - } - if (name.isEmpty()) { - name = "code"; - } - return name; - } - - private static File myArchive; - - /** - * Locate the JAR/WAR file we were launched from. - * - * @return local path of the Gerrit WAR file. - * @throws FileNotFoundException if the code cannot guess the location. - */ - public static File getDistributionArchive() throws FileNotFoundException { - if (myArchive == null) { - myArchive = locateMyArchive(); - } - return myArchive; - } - - private static File locateMyArchive() throws FileNotFoundException { - final ClassLoader myCL = GerritLauncher.class.getClassLoader(); - final String myName = - GerritLauncher.class.getName().replace('.', '/') + ".class"; - - final URL myClazz = myCL.getResource(myName); - if (myClazz == null) { - throw new FileNotFoundException("Cannot find JAR: no " + myName); - } - - // ZipFile may have the path of our JAR hiding within itself. - // - try { - Field nameField = ZipFile.class.getDeclaredField("name"); - nameField.setAccessible(true); - - JarFile jar = ((JarURLConnection) myClazz.openConnection()).getJarFile(); - File path = new File((String) nameField.get(jar)); - if (path.isFile()) { - return path; - } - } catch (Exception e) { - // Nope, that didn't work. Try a different method. - // - } - - // Maybe this is a local class file, running under a debugger? - // - if ("file".equals(myClazz.getProtocol())) { - final File path = new File(myClazz.getPath()); - if (path.isFile() && path.getParentFile().isDirectory()) { - throw new FileNotFoundException(NOT_ARCHIVED); - } - } - - // The CodeSource might be able to give us the source as a stream. - // If so, copy it to a local file so we have random access to it. - // - final CodeSource src = - GerritLauncher.class.getProtectionDomain().getCodeSource(); - if (src != null) { - try { - final InputStream in = src.getLocation().openStream(); - try { - final File tmp = createTempFile("gerrit_", ".zip"); - final FileOutputStream out = new FileOutputStream(tmp); - try { - final byte[] buf = new byte[4096]; - int n; - while ((n = in.read(buf, 0, buf.length)) > 0) { - out.write(buf, 0, n); - } - } finally { - out.close(); - } - return tmp; - } finally { - in.close(); - } - } catch (IOException e) { - // Nope, that didn't work. - // - } - } - - throw new FileNotFoundException("Cannot find local copy of JAR"); - } - - private static boolean temporaryDirectoryFound; - private static File temporaryDirectory; - - /** - * Creates a temporary file within the application's unpack location. - *

- * The launcher unpacks the nested JAR files into a temporary directory, - * allowing the classes to be loaded from local disk with standard Java APIs. - * This method constructs a new temporary file in the same directory. - *

- * The method first tries to create {@code prefix + suffix} within the - * directory under the assumption that a given {@code prefix + suffix} - * combination is made at most once per JVM execution. If this fails (e.g. the - * named file already exists) a mangled unique name is used and returned - * instead, with the unique string appearing between the prefix and suffix. - *

- * Files created by this method will be automatically deleted by the JVM when - * it terminates. If the returned file is converted into a directory by the - * caller, the caller must arrange for the contents to be deleted before the - * directory is. - *

- * If supported by the underlying operating system, the temporary directory - * which contains these temporary files is accessible only by the user running - * the JVM. - * - * @param prefix prefix of the file name. - * @param suffix suffix of the file name. - * @return the path of the temporary file. The returned object exists in the - * filesystem as a file; caller may need to delete and recreate as a - * directory if a directory was preferred. - * @throws IOException the file could not be created. - */ - public static synchronized File createTempFile(String prefix, String suffix) - throws IOException { - if (!temporaryDirectoryFound) { - final File d = File.createTempFile("gerrit_", "_app", tmproot()); - if (d.delete() && d.mkdir()) { - // Try to lock the directory down to be accessible by us. - // We first have to remove all permissions, then add back - // only the owner permissions. - // - d.setWritable(false, false /* all */); - d.setReadable(false, false /* all */); - d.setExecutable(false, false /* all */); - - d.setWritable(true, true /* owner only */); - d.setReadable(true, true /* owner only */); - d.setExecutable(true, true /* owner only */); - - d.deleteOnExit(); - temporaryDirectory = d; - } - temporaryDirectoryFound = true; - } - - if (temporaryDirectory != null) { - // If we have a private directory and this name has not yet - // been used within the private directory, create it as-is. - // - final File tmp = new File(temporaryDirectory, prefix + suffix); - if (tmp.createNewFile()) { - tmp.deleteOnExit(); - return tmp; - } - } - - if (!prefix.endsWith("_")) { - prefix += "_"; - } - - final File tmp = File.createTempFile(prefix, suffix, temporaryDirectory); - tmp.deleteOnExit(); - return tmp; - } - - private static File tmproot() { - // 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 tmp = new File(new File(home, ".gerritcodereview"), "tmp"); - if (!tmp.exists() && !tmp.mkdirs()) { - System.err.println("warning: cannot create " + tmp.getAbsolutePath()); - System.err.println("warning: using system temporary directory instead"); - return null; - } - - // Try to clean up any stale empty directories. Assume any empty - // directory that is older than 7 days is one of these dead ones - // that we can clean up. - // - final File[] tmpEntries = tmp.listFiles(); - if (tmpEntries != null) { - final long now = System.currentTimeMillis(); - final long expired = now - MILLISECONDS.convert(7, DAYS); - for (final File tmpEntry : tmpEntries) { - if (tmpEntry.isDirectory() && tmpEntry.lastModified() < expired) { - final String[] all = tmpEntry.list(); - if (all == null || all.length == 0) { - tmpEntry.delete(); - } - } - } - } - - try { - return tmp.getCanonicalFile(); - } catch (IOException e) { - return tmp; - } - } - - private GerritLauncher() { - } -} diff --git a/gerrit-main/.gitignore b/gerrit-main/.gitignore deleted file mode 100644 index 903c6c80f5..0000000000 --- a/gerrit-main/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target -/.classpath -/.project -/.settings/org.maven.ide.eclipse.prefs diff --git a/gerrit-main/.settings/org.eclipse.core.resources.prefs b/gerrit-main/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 82eb859e3b..0000000000 --- a/gerrit-main/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/gerrit-main/.settings/org.eclipse.core.runtime.prefs b/gerrit-main/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 8667cfd4a3..0000000000 --- a/gerrit-main/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -line.separator=\n diff --git a/gerrit-main/.settings/org.eclipse.jdt.core.prefs b/gerrit-main/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 4b4b392be9..0000000000 --- a/gerrit-main/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,268 +0,0 @@ -#Mon Jan 04 14:26:32 PST 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.2 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.2 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=16 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=80 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/gerrit-main/.settings/org.eclipse.jdt.ui.prefs b/gerrit-main/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d4218a5fc0..0000000000 --- a/gerrit-main/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -#Wed Jul 29 11:31:38 PDT 2009 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Google Format -formatter_settings_version=11 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax; -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=true -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/gerrit-main/pom.xml b/gerrit-main/pom.xml deleted file mode 100644 index f630be64e1..0000000000 --- a/gerrit-main/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 4.0.0 - - - com.google.gerrit - gerrit-parent - 2.2-SNAPSHOT - - - gerrit-main - Gerrit Code Review - Main - - - Main class to bootstrap out of a WAR - - - - - com.google.gerrit - gerrit-launcher - ${project.version} - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.2 - 1.2 - UTF-8 - - - - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - false - - - - - - - diff --git a/gerrit-main/src/main/java/Main.java b/gerrit-main/src/main/java/Main.java deleted file mode 100644 index 30a55fb5c8..0000000000 --- a/gerrit-main/src/main/java/Main.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2009 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. - - -public final class Main { - // We don't do any real work here because we need to import - // the archive lookup code and we cannot import a class in - // the default package. So this is just a tiny springboard - // to jump into the real main code. - // - - public static void main(final String argv[]) throws Exception { - if (onSupportedJavaVersion()) { - com.google.gerrit.launcher.GerritLauncher.main(argv); - - } else { - System.exit(1); - } - } - - private static boolean onSupportedJavaVersion() { - final String version = System.getProperty("java.specification.version"); - if (1.6 <= parse(version)) { - return true; - - } else { - System.err.println("fatal: Gerrit Code Review requires Java 6 or later"); - System.err.println(" (trying to run on Java " + version + ")"); - return false; - } - } - - private static double parse(String version) { - if (version == null || version.length() == 0) { - return 0.0; - } - - try { - final int fd = version.indexOf('.'); - final int sd = version.indexOf('.', fd + 1); - if (0 < sd) { - version = version.substring(0, sd); - } - return Double.parseDouble(version); - } catch (NumberFormatException e) { - return 0.0; - } - } - - private Main() { - } -} diff --git a/gerrit-patch-commonsnet/.gitignore b/gerrit-patch-commonsnet/.gitignore deleted file mode 100644 index 903c6c80f5..0000000000 --- a/gerrit-patch-commonsnet/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target -/.classpath -/.project -/.settings/org.maven.ide.eclipse.prefs diff --git a/gerrit-patch-commonsnet/.settings/org.eclipse.core.resources.prefs b/gerrit-patch-commonsnet/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 82eb859e3b..0000000000 --- a/gerrit-patch-commonsnet/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/gerrit-patch-commonsnet/.settings/org.eclipse.core.runtime.prefs b/gerrit-patch-commonsnet/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 8667cfd4a3..0000000000 --- a/gerrit-patch-commonsnet/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -line.separator=\n diff --git a/gerrit-patch-commonsnet/.settings/org.eclipse.jdt.core.prefs b/gerrit-patch-commonsnet/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 04afc7fac5..0000000000 --- a/gerrit-patch-commonsnet/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,268 +0,0 @@ -#Tue May 12 17:44:13 PDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=16 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=80 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/gerrit-patch-commonsnet/.settings/org.eclipse.jdt.ui.prefs b/gerrit-patch-commonsnet/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d4218a5fc0..0000000000 --- a/gerrit-patch-commonsnet/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -#Wed Jul 29 11:31:38 PDT 2009 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Google Format -formatter_settings_version=11 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax; -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=true -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/gerrit-patch-commonsnet/pom.xml b/gerrit-patch-commonsnet/pom.xml deleted file mode 100644 index 738d6cee6b..0000000000 --- a/gerrit-patch-commonsnet/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - 4.0.0 - - - com.google.gerrit - gerrit-parent - 2.2-SNAPSHOT - - - gerrit-patch-commonsnet - Gerrit Code Review - Patch commons-net - - - Hacks to expose package-private data from commons-net to Gerrit - - - - - commons-net - commons-net - - - - commons-codec - commons-codec - - - - org.slf4j - slf4j-api - - - - com.google.gerrit - gerrit-util-ssl - ${project.version} - - - diff --git a/gerrit-patch-commonsnet/src/main/java/org/apache/commons/net/smtp/AuthSMTPClient.java b/gerrit-patch-commonsnet/src/main/java/org/apache/commons/net/smtp/AuthSMTPClient.java deleted file mode 100644 index 7d7bc49c4c..0000000000 --- a/gerrit-patch-commonsnet/src/main/java/org/apache/commons/net/smtp/AuthSMTPClient.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (C) 2009 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.apache.commons.net.smtp; - -import com.google.gerrit.util.ssl.BlindSSLSocketFactory; - -import org.apache.commons.codec.binary.Base64; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.SocketException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.List; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; -import javax.net.ssl.SSLSocketFactory; - -public class AuthSMTPClient extends SMTPClient { - private static final String UTF_8 = "UTF-8"; - - private String authTypes; - - public AuthSMTPClient(final String charset) { - super(charset); - } - - public void enableSSL(final boolean verify) { - _socketFactory_ = sslFactory(verify); - } - - public boolean startTLS(final String hostname, final int port, final boolean verify) - throws SocketException, IOException { - if (sendCommand("STARTTLS") != 220) { - return false; - } - - _socket_ = sslFactory(verify).createSocket(_socket_, hostname, port, true); - _connectAction_(); - return true; - } - - private static SSLSocketFactory sslFactory(final boolean verify) { - if (verify) { - return (SSLSocketFactory) SSLSocketFactory.getDefault(); - } else { - return (SSLSocketFactory) BlindSSLSocketFactory.getDefault(); - } - } - - @Override - public String[] getReplyStrings() { - return _replyLines.toArray(new String[_replyLines.size()]); - } - - @Override - public boolean login() throws IOException { - final String name = getLocalAddress().getHostName(); - if (name == null) { - return false; - } - - boolean ok = SMTPReply.isPositiveCompletion(sendCommand("EHLO", name)); - authTypes = ""; - for (String line : getReplyStrings()) { - if (line != null && (line.startsWith("250 AUTH ") || line.startsWith("250-AUTH "))) { - authTypes = line; - break; - } - } - - return ok; - } - - public boolean auth(String smtpUser, String smtpPass) throws IOException { - List types = Arrays.asList(authTypes.split(" ")); - if ("".equals(authTypes)) { - // Server didn't advertise authentication support. - // - return true; - } - - if (smtpPass == null) { - smtpPass = ""; - } - if (types.contains("CRAM-SHA1")) { - return authCram(smtpUser, smtpPass, "SHA1"); - } - if (types.contains("CRAM-MD5")) { - return authCram(smtpUser, smtpPass, "MD5"); - } - if (types.contains("LOGIN")) { - return authLogin(smtpUser, smtpPass); - } - if (types.contains("PLAIN")) { - return authPlain(smtpUser, smtpPass); - } - throw new IOException("Unsupported AUTH: " + authTypes); - } - - private boolean authCram(String smtpUser, String smtpPass, String alg) - throws UnsupportedEncodingException, IOException { - final String macName = "Hmac" + alg; - if (sendCommand("AUTH", "CRAM-" + alg) != 334) { - return false; - } - - final String enc = getReplyStrings()[0].split(" ", 2)[1]; - final byte[] nonce = Base64.decodeBase64(enc.getBytes(UTF_8)); - final String sec; - try { - Mac mac = Mac.getInstance(macName); - mac.init(new SecretKeySpec(smtpPass.getBytes(UTF_8), macName)); - sec = toHex(mac.doFinal(nonce)); - } catch (NoSuchAlgorithmException e) { - throw new IOException("Cannot use CRAM-" + alg, e); - } catch (InvalidKeyException e) { - throw new IOException("Cannot use CRAM-" + alg, e); - } - - String token = smtpUser + ' ' + sec; - String cmd = encodeBase64(token.getBytes(UTF_8)); - return SMTPReply.isPositiveCompletion(sendCommand(cmd)); - } - - private boolean authLogin(String smtpUser, String smtpPass) throws UnsupportedEncodingException, - IOException { - if (sendCommand("AUTH", "LOGIN") != 334) { - return false; - } - - String cmd = encodeBase64(smtpUser.getBytes(UTF_8)); - if(sendCommand(cmd) != 334) { - return false; - } - - cmd = encodeBase64(smtpPass.getBytes(UTF_8)); - return SMTPReply.isPositiveCompletion(sendCommand(cmd)); - } - - private static final char[] hexchar = - {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - - private String toHex(final byte[] b) { - final StringBuilder sec = new StringBuilder(); - for (int i = 0; i < b.length; i++) { - final int u = (b[i] >> 4) & 0xf; - final int l = b[i] & 0xf; - sec.append(hexchar[u]); - sec.append(hexchar[l]); - } - return sec.toString(); - } - - private boolean authPlain(String smtpUser, String smtpPass) throws UnsupportedEncodingException, - IOException { - String token = '\0' + smtpUser + '\0' + smtpPass; - String cmd = "PLAIN " + encodeBase64(token.getBytes(UTF_8)); - return SMTPReply.isPositiveCompletion(sendCommand("AUTH", cmd)); - } - - private static String encodeBase64(final byte[] data) throws UnsupportedEncodingException { - return new String(Base64.encodeBase64(data), UTF_8); - } -} diff --git a/gerrit-patch-jgit/.gitignore b/gerrit-patch-jgit/.gitignore deleted file mode 100644 index 903c6c80f5..0000000000 --- a/gerrit-patch-jgit/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target -/.classpath -/.project -/.settings/org.maven.ide.eclipse.prefs diff --git a/gerrit-patch-jgit/.settings/org.eclipse.core.resources.prefs b/gerrit-patch-jgit/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 82eb859e3b..0000000000 --- a/gerrit-patch-jgit/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/gerrit-patch-jgit/.settings/org.eclipse.core.runtime.prefs b/gerrit-patch-jgit/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 8667cfd4a3..0000000000 --- a/gerrit-patch-jgit/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -line.separator=\n diff --git a/gerrit-patch-jgit/.settings/org.eclipse.jdt.core.prefs b/gerrit-patch-jgit/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 04afc7fac5..0000000000 --- a/gerrit-patch-jgit/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,268 +0,0 @@ -#Tue May 12 17:44:13 PDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=16 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=80 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/gerrit-patch-jgit/.settings/org.eclipse.jdt.ui.prefs b/gerrit-patch-jgit/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d4218a5fc0..0000000000 --- a/gerrit-patch-jgit/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -#Wed Jul 29 11:31:38 PDT 2009 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Google Format -formatter_settings_version=11 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax; -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=true -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/gerrit-patch-jgit/pom.xml b/gerrit-patch-jgit/pom.xml deleted file mode 100644 index f2d1cfdd93..0000000000 --- a/gerrit-patch-jgit/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - 4.0.0 - - - com.google.gerrit - gerrit-parent - 2.2-SNAPSHOT - - - gerrit-patch-jgit - Gerrit Code Review - Patch JGit - - - Hacks to expose package-private data from JGit to Gerrit - - - - - org.eclipse.jgit - org.eclipse.jgit - - - - gwtjsonrpc - gwtjsonrpc - - - - com.google.gwt - gwt-user - provided - - - - - - - org.apache.maven.plugins - maven-source-plugin - - - - jar - - - - - - - diff --git a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/JGit.gwt.xml b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/JGit.gwt.xml deleted file mode 100644 index 5aeb936526..0000000000 --- a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/JGit.gwt.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/EditDeserializer.java b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/EditDeserializer.java deleted file mode 100644 index 1df89b7d9d..0000000000 --- a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/EditDeserializer.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2009 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 com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.List; - -public class EditDeserializer implements JsonDeserializer, - JsonSerializer { - public Edit deserialize(final JsonElement json, final Type typeOfT, - final JsonDeserializationContext context) throws JsonParseException { - if (json.isJsonNull()) { - return null; - } - if (!json.isJsonArray()) { - throw new JsonParseException("Expected array for Edit type"); - } - - final JsonArray o = (JsonArray) json; - final int cnt = o.size(); - if (cnt < 4 || cnt % 4 != 0) { - throw new JsonParseException("Expected array of 4 for Edit type"); - } - - if (4 == cnt) { - return new Edit(get(o, 0), get(o, 1), get(o, 2), get(o, 3)); - } - - List l = new ArrayList((cnt / 4) - 1); - for (int i = 4; i < cnt;) { - int as = get(o, i++); - int ae = get(o, i++); - int bs = get(o, i++); - int be = get(o, i++); - l.add(new Edit(as, ae, bs, be)); - } - return new ReplaceEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3), l); - } - - private static int get(final JsonArray a, final int idx) - throws JsonParseException { - final JsonElement v = a.get(idx); - if (!v.isJsonPrimitive()) { - throw new JsonParseException("Expected array of 4 for Edit type"); - } - final JsonPrimitive p = (JsonPrimitive) v; - if (!p.isNumber()) { - throw new JsonParseException("Expected array of 4 for Edit type"); - } - return p.getAsInt(); - } - - public JsonElement serialize(final Edit src, final Type typeOfSrc, - final JsonSerializationContext context) { - if (src == null) { - return new JsonNull(); - } - final JsonArray a = new JsonArray(); - add(a, src); - if (src instanceof ReplaceEdit) { - for (Edit e : ((ReplaceEdit) src).getInternalEdits()) { - add(a, e); - } - } - return a; - } - - private void add(final JsonArray a, final Edit src) { - a.add(new JsonPrimitive(src.getBeginA())); - a.add(new JsonPrimitive(src.getEndA())); - a.add(new JsonPrimitive(src.getBeginB())); - a.add(new JsonPrimitive(src.getEndB())); - } -} diff --git a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/Edit_JsonSerializer.java b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/Edit_JsonSerializer.java deleted file mode 100644 index 7870002389..0000000000 --- a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/Edit_JsonSerializer.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2009 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 com.google.gwt.core.client.JavaScriptObject; -import com.google.gwtjsonrpc.client.impl.JsonSerializer; - -import java.util.ArrayList; -import java.util.List; - -public class Edit_JsonSerializer extends JsonSerializer { - public static final Edit_JsonSerializer INSTANCE = new Edit_JsonSerializer(); - - @Override - public Edit fromJson(Object jso) { - if (jso == null) { - return null; - } - - final JavaScriptObject o = (JavaScriptObject) jso; - final int cnt = length(o); - if (4 == cnt) { - return new Edit(get(o, 0), get(o, 1), get(o, 2), get(o, 3)); - } - - List l = new ArrayList((cnt / 4) - 1); - for (int i = 4; i < cnt;) { - int as = get(o, i++); - int ae = get(o, i++); - int bs = get(o, i++); - int be = get(o, i++); - l.add(new Edit(as, ae, bs, be)); - } - return new ReplaceEdit(get(o, 0), get(o, 1), get(o, 2), get(o, 3), l); - } - - @Override - public void printJson(final StringBuilder sb, final Edit o) { - sb.append('['); - append(sb, o); - if (o instanceof ReplaceEdit) { - for (Edit e : ((ReplaceEdit) o).getInternalEdits()) { - sb.append(','); - append(sb, e); - } - } - sb.append(']'); - } - - private void append(final StringBuilder sb, final Edit o) { - sb.append(o.getBeginA()); - sb.append(','); - sb.append(o.getEndA()); - sb.append(','); - sb.append(o.getBeginB()); - sb.append(','); - sb.append(o.getEndB()); - } - - private static native int length(JavaScriptObject jso) - /*-{ return jso.length; }-*/; - - private static native int get(JavaScriptObject jso, int idx) - /*-{ return jso[idx]; }-*/; -} diff --git a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/ReplaceEdit.java b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/ReplaceEdit.java deleted file mode 100644 index 46681c6473..0000000000 --- a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/diff/ReplaceEdit.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2010 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 java.util.List; - -public class ReplaceEdit extends Edit { - private List internalEdit; - - public ReplaceEdit(int as, int ae, int bs, int be, List internal) { - super(as, ae, bs, be); - internalEdit = internal; - } - - public ReplaceEdit(Edit orig, List internal) { - super(orig.getBeginA(), orig.getEndA(), orig.getBeginB(), orig.getEndB()); - internalEdit = internal; - } - - public List getInternalEdits() { - return internalEdit; - } -} diff --git a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/lib/ObjectIdSerialization.java b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/lib/ObjectIdSerialization.java deleted file mode 100644 index 1d9d9d5127..0000000000 --- a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/lib/ObjectIdSerialization.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2009 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.lib; - -import org.eclipse.jgit.util.IO; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -public class ObjectIdSerialization { - public static void writeCanBeNull(final OutputStream out, final AnyObjectId id) - throws IOException { - if (id != null) { - out.write((byte)1); - writeNotNull(out, id); - } else { - out.write((byte)0); - } - } - - public static void writeNotNull(final OutputStream out, final AnyObjectId id) - throws IOException { - id.copyRawTo(out); - } - - public static ObjectId readCanBeNull(final InputStream in) throws IOException { - switch (in.read()) { - case 0: - return null; - case 1: - return readNotNull(in); - default: - throw new IOException("Invalid flag before ObjectId"); - } - } - - public static ObjectId readNotNull(final InputStream in) throws IOException { - final byte[] b = new byte[20]; - IO.readFully(in, b, 0, 20); - return ObjectId.fromRaw(b); - } - - private ObjectIdSerialization() { - } -} diff --git a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/storage/file/WindowCacheStatAccessor.java b/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/storage/file/WindowCacheStatAccessor.java deleted file mode 100644 index 7e29536139..0000000000 --- a/gerrit-patch-jgit/src/main/java/org/eclipse/jgit/storage/file/WindowCacheStatAccessor.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2009 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.storage.file; - -// Hack to obtain visibility to package level methods only. -// These aren't yet part of the public JGit API. - -public class WindowCacheStatAccessor { - public static int getOpenFiles() { - return WindowCache.getInstance().getOpenFiles(); - } - - public static long getOpenBytes() { - return WindowCache.getInstance().getOpenBytes(); - } - - private WindowCacheStatAccessor() { - } -} diff --git a/gerrit-pgm/.gitignore b/gerrit-pgm/.gitignore deleted file mode 100644 index 903c6c80f5..0000000000 --- a/gerrit-pgm/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target -/.classpath -/.project -/.settings/org.maven.ide.eclipse.prefs diff --git a/gerrit-pgm/.settings/org.eclipse.core.resources.prefs b/gerrit-pgm/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 82eb859e3b..0000000000 --- a/gerrit-pgm/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/gerrit-pgm/.settings/org.eclipse.core.runtime.prefs b/gerrit-pgm/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 8667cfd4a3..0000000000 --- a/gerrit-pgm/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -line.separator=\n diff --git a/gerrit-pgm/.settings/org.eclipse.jdt.core.prefs b/gerrit-pgm/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 04afc7fac5..0000000000 --- a/gerrit-pgm/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,268 +0,0 @@ -#Tue May 12 17:44:13 PDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=16 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=80 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/gerrit-pgm/.settings/org.eclipse.jdt.ui.prefs b/gerrit-pgm/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d4218a5fc0..0000000000 --- a/gerrit-pgm/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -#Wed Jul 29 11:31:38 PDT 2009 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Google Format -formatter_settings_version=11 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax; -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=true -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/gerrit-pgm/pom.xml b/gerrit-pgm/pom.xml deleted file mode 100644 index 54f16a7dde..0000000000 --- a/gerrit-pgm/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - 4.0.0 - - - com.google.gerrit - gerrit-parent - 2.2-SNAPSHOT - - - gerrit-pgm - Gerrit Code Review - Pgm - - - Command line executables - - - - - log4j - log4j - - - - com.h2database - h2 - - - - postgresql - postgresql - - - - com.google.gerrit - gerrit-main - ${project.version} - provided - - - - com.google.gerrit - gerrit-util-cli - ${project.version} - - - - com.google.gerrit - gerrit-server - ${project.version} - - - - com.google.gerrit - gerrit-sshd - ${project.version} - - - - com.google.gerrit - gerrit-httpd - ${project.version} - - - - org.eclipse.jetty - jetty-servlet - - - - org.apache.tomcat - servlet-api - - - - org.eclipse.jgit - org.eclipse.jgit.junit - - - diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Cat.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Cat.java deleted file mode 100644 index da6a42e31b..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Cat.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2009 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; - -import com.google.gerrit.launcher.GerritLauncher; -import com.google.gerrit.pgm.util.AbstractProgram; - -import org.kohsuke.args4j.Argument; - -import java.io.IOException; -import java.io.InputStream; - -/** Dump the contents of a file in our archive. */ -public class Cat extends AbstractProgram { - @Argument(index = 0, required = true, metaVar = "FILE", usage = "file to output") - private String fileName; - - @Override - public int run() throws IOException { - while (fileName.startsWith("/")) { - fileName = fileName.substring(1); - } - - String name; - if (fileName.equals("LICENSES.txt")) { - name = fileName; - } else { - name = "WEB-INF/" + fileName; - } - - final InputStream in = open(name); - if (in == null) { - System.err.println("error: no such file " + fileName); - return 1; - } - - try { - try { - final byte[] buf = new byte[4096]; - int n; - while ((n = in.read(buf)) >= 0) { - System.out.write(buf, 0, n); - } - } finally { - System.out.flush(); - } - } finally { - in.close(); - } - return 0; - } - - private InputStream open(String name) { - return GerritLauncher.class.getClassLoader().getResourceAsStream(name); - } -} 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 deleted file mode 100644 index 8c6879d821..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Daemon.java +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (C) 2009 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; - -import static com.google.gerrit.server.schema.DataSourceProvider.Context.MULTI_USER; - -import com.google.gerrit.httpd.HttpCanonicalWebUrlProvider; -import com.google.gerrit.httpd.WebModule; -import com.google.gerrit.lifecycle.LifecycleManager; -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.util.ErrorLogFile; -import com.google.gerrit.pgm.util.LogFileCompressor; -import com.google.gerrit.pgm.util.RuntimeShutdown; -import com.google.gerrit.pgm.util.SiteProgram; -import com.google.gerrit.server.config.AuthConfigModule; -import com.google.gerrit.server.config.CanonicalWebUrlModule; -import com.google.gerrit.server.config.CanonicalWebUrlProvider; -import com.google.gerrit.server.config.GerritGlobalModule; -import com.google.gerrit.server.config.MasterNodeStartup; -import com.google.gerrit.sshd.SshModule; -import com.google.gerrit.sshd.commands.MasterCommandModule; -import com.google.gerrit.sshd.commands.SlaveCommandModule; -import com.google.inject.Injector; -import com.google.inject.Module; -import com.google.inject.Provider; - -import org.kohsuke.args4j.Option; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.lang.Thread.UncaughtExceptionHandler; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; - -/** Run SSH daemon portions of Gerrit. */ -public class Daemon extends SiteProgram { - private static final Logger log = LoggerFactory.getLogger(Daemon.class); - - @Option(name = "--enable-httpd", usage = "Enable the internal HTTP daemon") - private Boolean httpd; - - @Option(name = "--disable-httpd", usage = "Disable the internal HTTP daemon") - void setDisableHttpd(final boolean arg) { - httpd = false; - } - - @Option(name = "--enable-sshd", usage = "Enable the internal SSH daemon") - private boolean sshd = true; - - @Option(name = "--disable-sshd", usage = "Disable the internal SSH daemon") - void setDisableSshd(final boolean arg) { - sshd = false; - } - - @Option(name = "--slave", usage = "Support fetch only; implies --disable-httpd") - private boolean slave; - - @Option(name = "--console-log", usage = "Log to console (not $site_path/logs)") - private boolean consoleLog; - - @Option(name = "--run-id", usage = "Cookie to store in $site_path/logs/gerrit.run") - private String runId; - - private final LifecycleManager manager = new LifecycleManager(); - private Injector dbInjector; - private Injector cfgInjector; - private Injector sysInjector; - private Injector sshInjector; - private Injector webInjector; - private Injector httpdInjector; - private File runFile; - - @Override - public int run() throws Exception { - mustHaveValidSite(); - Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() { - @Override - public void uncaughtException(Thread t, Throwable e) { - log.error("Thread " + t.getName() + " threw exception", e); - } - }); - - if (runId != null) { - runFile = new File(new File(getSitePath(), "logs"), "gerrit.run"); - } - - if (httpd == null) { - httpd = !slave; - } - - if (!httpd && !sshd) { - throw die("No services enabled, nothing to do"); - } - if (slave && httpd) { - throw die("Cannot combine --slave and --enable-httpd"); - } - if (httpd && !sshd) { - // TODO Support HTTP without SSH. - throw die("--enable-httpd currently requires --enable-sshd"); - } - - if (consoleLog) { - } else { - manager.add(ErrorLogFile.start(getSitePath())); - } - - try { - dbInjector = createDbInjector(MULTI_USER); - cfgInjector = createCfgInjector(); - sysInjector = createSysInjector(); - manager.add(dbInjector, cfgInjector, sysInjector); - - if (sshd) { - initSshd(); - } - - if (httpd) { - initHttpd(); - } - - manager.start(); - RuntimeShutdown.add(new Runnable() { - public void run() { - log.info("caught shutdown, cleaning up"); - if (runId != null) { - runFile.delete(); - } - manager.stop(); - } - }); - - log.info("Gerrit Code Review " + myVersion() + " ready"); - if (runId != null) { - try { - runFile.createNewFile(); - runFile.setReadable(true, false); - - FileOutputStream out = new FileOutputStream(runFile); - try { - out.write((runId + "\n").getBytes("UTF-8")); - } finally { - out.close(); - } - } catch (IOException err) { - log.warn("Cannot write --run-id to " + runFile, err); - } - } - - RuntimeShutdown.waitFor(); - return 0; - } catch (Throwable err) { - log.error("Unable to start daemon", err); - return 1; - } - } - - private String myVersion() { - return com.google.gerrit.common.Version.getVersion(); - } - - private Injector createCfgInjector() { - final List modules = new ArrayList(); - modules.add(new AuthConfigModule()); - return dbInjector.createChildInjector(modules); - } - - private Injector createSysInjector() { - final List modules = new ArrayList(); - modules.add(new LogFileCompressor.Module()); - modules.add(cfgInjector.getInstance(GerritGlobalModule.class)); - if (httpd) { - modules.add(new CanonicalWebUrlModule() { - @Override - protected Class> provider() { - return HttpCanonicalWebUrlProvider.class; - } - }); - } else { - modules.add(new CanonicalWebUrlModule() { - @Override - protected Class> provider() { - return CanonicalWebUrlProvider.class; - } - }); - } - if (!slave) { - modules.add(new MasterNodeStartup()); - } - return cfgInjector.createChildInjector(modules); - } - - private void initSshd() { - sshInjector = createSshInjector(); - manager.add(sshInjector); - } - - private Injector createSshInjector() { - final List modules = new ArrayList(); - modules.add(new SshModule()); - if (slave) { - modules.add(new SlaveCommandModule()); - } else { - modules.add(new MasterCommandModule()); - } - return sysInjector.createChildInjector(modules); - } - - private void initHttpd() { - webInjector = createWebInjector(); - - sysInjector.getInstance(HttpCanonicalWebUrlProvider.class) - .setHttpServletRequest( - webInjector.getProvider(HttpServletRequest.class)); - - httpdInjector = createHttpdInjector(); - manager.add(webInjector, httpdInjector); - } - - private Injector createWebInjector() { - final List modules = new ArrayList(); - modules.add(sshInjector.getInstance(WebModule.class)); - modules.add(sshInjector.getInstance(ProjectQoSFilter.Module.class)); - return sysInjector.createChildInjector(modules); - } - - private Injector createHttpdInjector() { - final List modules = new ArrayList(); - modules.add(new JettyModule(new JettyEnv(webInjector))); - return webInjector.createChildInjector(modules); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/ExportReviewNotes.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/ExportReviewNotes.java deleted file mode 100644 index 94cad95535..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/ExportReviewNotes.java +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright (C) 2010 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; - -import static com.google.gerrit.server.schema.DataSourceProvider.Context.MULTI_USER; - -import com.google.gerrit.common.data.ApprovalTypes; -import com.google.gerrit.lifecycle.LifecycleManager; -import com.google.gerrit.lifecycle.LifecycleModule; -import com.google.gerrit.pgm.util.SiteProgram; -import com.google.gerrit.reviewdb.Change; -import com.google.gerrit.reviewdb.PatchSet; -import com.google.gerrit.reviewdb.Project; -import com.google.gerrit.reviewdb.ReviewDb; -import com.google.gerrit.server.account.AccountCacheImpl; -import com.google.gerrit.server.account.GroupCacheImpl; -import com.google.gerrit.server.cache.CachePool; -import com.google.gerrit.server.config.ApprovalTypesProvider; -import com.google.gerrit.server.config.AuthConfigModule; -import com.google.gerrit.server.config.CanonicalWebUrl; -import com.google.gerrit.server.config.CanonicalWebUrlProvider; -import com.google.gerrit.server.config.FactoryModule; -import com.google.gerrit.server.git.CodeReviewNoteCreationException; -import com.google.gerrit.server.git.CreateCodeReviewNotes; -import com.google.gerrit.server.git.GitRepositoryManager; -import com.google.gerrit.server.git.LocalDiskRepositoryManager; -import com.google.gwtorm.client.OrmException; -import com.google.gwtorm.client.SchemaFactory; -import com.google.inject.AbstractModule; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.google.inject.Scopes; - -import org.eclipse.jgit.errors.RepositoryNotFoundException; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.TextProgressMonitor; -import org.eclipse.jgit.lib.ThreadSafeProgressMonitor; -import org.eclipse.jgit.util.BlockList; -import org.kohsuke.args4j.Option; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -/** Export review notes for all submitted changes in all projects. */ -public class ExportReviewNotes extends SiteProgram { - @Option(name = "--threads", usage = "Number of concurrent threads to run") - private int threads = 2; - - private final LifecycleManager manager = new LifecycleManager(); - private final TextProgressMonitor textMonitor = new TextProgressMonitor(); - private final ThreadSafeProgressMonitor monitor = - new ThreadSafeProgressMonitor(textMonitor); - - private Injector dbInjector; - private Injector gitInjector; - - @Inject - private GitRepositoryManager gitManager; - - @Inject - private SchemaFactory database; - - @Inject - private CreateCodeReviewNotes.Factory codeReviewNotesFactory; - - private Map> changes; - - @Override - public int run() throws Exception { - if (threads <= 0) { - threads = 1; - } - - dbInjector = createDbInjector(MULTI_USER); - gitInjector = dbInjector.createChildInjector(new AbstractModule() { - @Override - protected void configure() { - bind(ApprovalTypes.class).toProvider(ApprovalTypesProvider.class).in( - Scopes.SINGLETON); - bind(String.class).annotatedWith(CanonicalWebUrl.class) - .toProvider(CanonicalWebUrlProvider.class).in(Scopes.SINGLETON); - bind(CachePool.class); - - install(AccountCacheImpl.module()); - install(GroupCacheImpl.module()); - install(new AuthConfigModule()); - install(new FactoryModule() { - @Override - protected void configure() { - factory(CreateCodeReviewNotes.Factory.class); - } - }); - install(new LifecycleModule() { - @Override - protected void configure() { - listener().to(CachePool.Lifecycle.class); - listener().to(LocalDiskRepositoryManager.Lifecycle.class); - } - }); - } - }); - - manager.add(dbInjector, gitInjector); - manager.start(); - gitInjector.injectMembers(this); - - List allChangeList = allChanges(); - monitor.beginTask("Scanning changes", allChangeList.size()); - changes = cluster(allChangeList); - allChangeList = null; - - monitor.startWorkers(threads); - for (int tid = 0; tid < threads; tid++) { - new Worker().start(); - } - monitor.waitForCompletion(); - monitor.endTask(); - manager.stop(); - return 0; - } - - private List allChanges() throws OrmException { - final ReviewDb db = database.open(); - try { - return db.changes().all().toList(); - } finally { - db.close(); - } - } - - private Map> cluster(List changes) { - HashMap> m = - new HashMap>(); - for (Change change : changes) { - if (change.getStatus() == Change.Status.MERGED) { - List l = m.get(change.getProject()); - if (l == null) { - l = new BlockList(); - m.put(change.getProject(), l); - } - l.add(change); - } else { - monitor.update(1); - } - } - return m; - } - - private void export(ReviewDb db, Project.NameKey project, List changes) - throws IOException, OrmException, CodeReviewNoteCreationException, - InterruptedException { - final Repository git; - try { - git = gitManager.openRepository(project); - } catch (RepositoryNotFoundException e) { - return; - } - try { - CreateCodeReviewNotes notes = codeReviewNotesFactory.create(db, git); - try { - notes.loadBase(); - for (Change change : changes) { - monitor.update(1); - PatchSet ps = db.patchSets().get(change.currentPatchSetId()); - if (ps == null) { - continue; - } - notes.add(change, ObjectId.fromString(ps.getRevision().get())); - } - notes.commit("Exported prior reviews from Gerrit Code Review\n"); - notes.updateRef(); - } finally { - notes.release(); - } - } finally { - git.close(); - } - } - - private Map.Entry> next() { - synchronized (changes) { - if (changes.isEmpty()) { - return null; - } - - final Project.NameKey name = changes.keySet().iterator().next(); - final List list = changes.remove(name); - return new Map.Entry>() { - @Override - public Project.NameKey getKey() { - return name; - } - - @Override - public List getValue() { - return list; - } - - @Override - public List setValue(List value) { - throw new UnsupportedOperationException(); - } - }; - } - } - - private class Worker extends Thread { - @Override - public void run() { - ReviewDb db; - try { - db = database.open(); - } catch (OrmException e) { - e.printStackTrace(); - return; - } - try { - for (;;) { - Entry> next = next(); - if (next != null) { - try { - export(db, next.getKey(), next.getValue()); - } catch (IOException e) { - e.printStackTrace(); - } catch (OrmException e) { - e.printStackTrace(); - } catch (CodeReviewNoteCreationException e) { - e.printStackTrace(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } else { - break; - } - } - } finally { - monitor.endWorker(); - db.close(); - } - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Gsql.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Gsql.java deleted file mode 100644 index d967969bbf..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Gsql.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2009 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; - -import static com.google.gerrit.server.schema.DataSourceProvider.Context.SINGLE_USER; - -import com.google.gerrit.lifecycle.LifecycleManager; -import com.google.gerrit.pgm.util.RuntimeShutdown; -import com.google.gerrit.pgm.util.SiteProgram; -import com.google.gerrit.server.config.FactoryModule; -import com.google.gerrit.sshd.commands.QueryShell; -import com.google.gerrit.sshd.commands.QueryShell.Factory; -import com.google.inject.Injector; - -import org.kohsuke.args4j.Option; - -import java.io.IOException; - -/** Run Gerrit's SQL query tool */ -public class Gsql extends SiteProgram { - private final LifecycleManager manager = new LifecycleManager(); - private Injector dbInjector; - - @Option(name = "--format", usage = "Set output format") - private QueryShell.OutputFormat format = QueryShell.OutputFormat.PRETTY; - - @Option(name = "-c", metaVar = "SQL QUERY", usage = "Query to execute") - private String query; - - @Override - public int run() throws Exception { - mustHaveValidSite(); - - dbInjector = createDbInjector(SINGLE_USER); - manager.add(dbInjector); - manager.start(); - RuntimeShutdown.add(new Runnable() { - public void run() { - try { - System.in.close(); - } catch (IOException e) { - } - manager.stop(); - } - }); - final QueryShell shell = shellFactory().create(System.in, System.out); - shell.setOutputFormat(format); - if (query != null) { - shell.execute(query); - } else { - shell.run(); - } - return 0; - } - - private Factory shellFactory() { - return dbInjector.createChildInjector(new FactoryModule() { - @Override - protected void configure() { - factory(QueryShell.Factory.class); - } - }).getInstance(QueryShell.Factory.class); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Init.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Init.java deleted file mode 100644 index 68ac33d437..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Init.java +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (C) 2009 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; - -import static com.google.gerrit.server.schema.DataSourceProvider.Context.SINGLE_USER; -import static com.google.inject.Stage.PRODUCTION; - -import com.google.gerrit.common.PageLinks; -import com.google.gerrit.pgm.init.Browser; -import com.google.gerrit.pgm.init.InitFlags; -import com.google.gerrit.pgm.init.InitModule; -import com.google.gerrit.pgm.init.ReloadSiteLibrary; -import com.google.gerrit.pgm.init.SitePathInitializer; -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.pgm.util.Die; -import com.google.gerrit.pgm.util.ErrorLogFile; -import com.google.gerrit.pgm.util.IoUtil; -import com.google.gerrit.pgm.util.SiteProgram; -import com.google.gerrit.reviewdb.ReviewDb; -import com.google.gerrit.server.config.SitePath; -import com.google.gerrit.server.config.SitePaths; -import com.google.gerrit.server.git.GitRepositoryManager; -import com.google.gerrit.server.schema.SchemaUpdater; -import com.google.gerrit.server.schema.UpdateUI; -import com.google.gerrit.server.util.HostPlatform; -import com.google.gwtorm.client.OrmException; -import com.google.gwtorm.client.SchemaFactory; -import com.google.gwtorm.client.StatementExecutor; -import com.google.gwtorm.jdbc.JdbcExecutor; -import com.google.gwtorm.jdbc.JdbcSchema; -import com.google.inject.AbstractModule; -import com.google.inject.CreationException; -import com.google.inject.Guice; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.google.inject.Module; -import com.google.inject.spi.Message; - -import org.kohsuke.args4j.Option; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** Initialize a new Gerrit installation. */ -public class Init extends SiteProgram { - @Option(name = "--batch", usage = "Batch mode; skip interactive prompting") - private boolean batchMode; - - @Option(name = "--no-auto-start", usage = "Don't automatically start daemon after init") - private boolean noAutoStart; - - @Override - public int run() throws Exception { - ErrorLogFile.errorOnlyConsole(); - - final SiteInit init = createSiteInit(); - init.flags.autoStart = !noAutoStart && init.site.isNew; - - final SiteRun run; - try { - init.initializer.run(); - init.flags.deleteOnFailure = false; - - run = createSiteRun(init); - run.upgradeSchema(); - } catch (Exception failure) { - if (init.flags.deleteOnFailure) { - recursiveDelete(getSitePath()); - } - throw failure; - } catch (Error failure) { - if (init.flags.deleteOnFailure) { - recursiveDelete(getSitePath()); - } - throw failure; - } - - System.err.println("Initialized " + getSitePath().getCanonicalPath()); - run.start(); - return 0; - } - - static class SiteInit { - final SitePaths site; - final InitFlags flags; - final ConsoleUI ui; - final SitePathInitializer initializer; - - @Inject - SiteInit(final SitePaths site, final InitFlags flags, final ConsoleUI ui, - final SitePathInitializer initializer) { - this.site = site; - this.flags = flags; - this.ui = ui; - this.initializer = initializer; - } - } - - private SiteInit createSiteInit() { - final ConsoleUI ui = ConsoleUI.getInstance(batchMode); - final File sitePath = getSitePath(); - final List m = new ArrayList(); - - m.add(new InitModule()); - m.add(new AbstractModule() { - @Override - protected void configure() { - bind(ConsoleUI.class).toInstance(ui); - bind(File.class).annotatedWith(SitePath.class).toInstance(sitePath); - bind(ReloadSiteLibrary.class).toInstance(new ReloadSiteLibrary() { - @Override - public void reload() { - Init.super.loadSiteLib(); - } - }); - } - }); - - try { - return Guice.createInjector(PRODUCTION, m).getInstance(SiteInit.class); - } catch (CreationException ce) { - final Message first = ce.getErrorMessages().iterator().next(); - Throwable why = first.getCause(); - - if (why instanceof Die) { - throw (Die) why; - } - - final StringBuilder buf = new StringBuilder(); - buf.append(why.getMessage()); - why = why.getCause(); - while (why != null) { - buf.append("\n caused by "); - buf.append(why.toString()); - why = why.getCause(); - } - throw die(buf.toString(), new RuntimeException("InitInjector failed", ce)); - } - } - - static class SiteRun { - final ConsoleUI ui; - final SitePaths site; - final InitFlags flags; - final SchemaUpdater schemaUpdater; - final SchemaFactory schema; - final GitRepositoryManager repositoryManager; - final Browser browser; - - @Inject - SiteRun(final ConsoleUI ui, final SitePaths site, final InitFlags flags, - final SchemaUpdater schemaUpdater, - final SchemaFactory schema, - final GitRepositoryManager repositoryManager, - final Browser browser) { - this.ui = ui; - this.site = site; - this.flags = flags; - this.schemaUpdater = schemaUpdater; - this.schema = schema; - this.repositoryManager = repositoryManager; - this.browser = browser; - } - - void upgradeSchema() throws OrmException { - final List pruneList = new ArrayList(); - schemaUpdater.update(new UpdateUI() { - @Override - public void message(String msg) { - System.err.println(msg); - System.err.flush(); - } - - @Override - public boolean yesno(boolean def, String msg) { - return ui.yesno(def, msg); - } - - @Override - public void pruneSchema(StatementExecutor e, List prune) { - for (String p : prune) { - if (!pruneList.contains(p)) { - pruneList.add(p); - } - } - } - }); - - if (!pruneList.isEmpty()) { - StringBuilder msg = new StringBuilder(); - msg.append("Execute the following SQL to drop unused objects:\n"); - msg.append("\n"); - for (String sql : pruneList) { - msg.append(" "); - msg.append(sql); - msg.append(";\n"); - } - - if (ui.isBatch()) { - System.err.print(msg); - System.err.flush(); - - } else if (ui.yesno(true, "%s\nExecute now", msg)) { - final JdbcSchema db = (JdbcSchema) schema.open(); - try { - final JdbcExecutor e = new JdbcExecutor(db); - try { - for (String sql : pruneList) { - e.execute(sql); - } - } finally { - e.close(); - } - } finally { - db.close(); - } - } - } - } - - void start() throws Exception { - if (flags.autoStart) { - if (HostPlatform.isWin32()) { - System.err.println("Automatic startup not supported on Win32."); - - } else { - startDaemon(); - if (!ui.isBatch()) { - browser.open(PageLinks.ADMIN_PROJECTS); - } - } - } - } - - void startDaemon() { - final String[] argv = {site.gerrit_sh.getAbsolutePath(), "start"}; - final Process proc; - try { - System.err.println("Executing " + argv[0] + " " + argv[1]); - proc = Runtime.getRuntime().exec(argv); - } catch (IOException e) { - System.err.println("error: cannot start Gerrit: " + e.getMessage()); - return; - } - - try { - proc.getOutputStream().close(); - } catch (IOException e) { - } - - IoUtil.copyWithThread(proc.getInputStream(), System.err); - IoUtil.copyWithThread(proc.getErrorStream(), System.err); - - for (;;) { - try { - final int rc = proc.waitFor(); - if (rc != 0) { - System.err.println("error: cannot start Gerrit: exit status " + rc); - } - break; - } catch (InterruptedException e) { - // retry - } - } - } - - } - - private SiteRun createSiteRun(final SiteInit init) { - return createSysInjector(init).getInstance(SiteRun.class); - } - - private Injector createSysInjector(final SiteInit init) { - final List modules = new ArrayList(); - modules.add(new AbstractModule() { - @Override - protected void configure() { - bind(ConsoleUI.class).toInstance(init.ui); - bind(InitFlags.class).toInstance(init.flags); - } - }); - return createDbInjector(SINGLE_USER).createChildInjector(modules); - } - - private static void recursiveDelete(File path) { - File[] entries = path.listFiles(); - if (entries != null) { - for (File e : entries) { - recursiveDelete(e); - } - } - if (!path.delete() && path.exists()) { - System.err.println("warn: Cannot remove " + path); - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Ls.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Ls.java deleted file mode 100644 index 7e7b602889..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Ls.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2009 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; - -import com.google.gerrit.launcher.GerritLauncher; -import com.google.gerrit.pgm.util.AbstractProgram; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -/** List the files available in our archive. */ -public class Ls extends AbstractProgram { - @Override - public int run() throws IOException { - final ZipFile zf = new ZipFile(GerritLauncher.getDistributionArchive()); - try { - final Enumeration e = zf.entries(); - while (e.hasMoreElements()) { - final ZipEntry ze = e.nextElement(); - String name = ze.getName(); - boolean show = false; - show |= name.startsWith("WEB-INF/"); - show |= name.equals("LICENSES.txt"); - - show &= !ze.isDirectory(); - show &= !name.startsWith("WEB-INF/classes/"); - show &= !name.startsWith("WEB-INF/lib/"); - show &= !name.equals("WEB-INF/web.xml"); - if (show) { - if (name.startsWith("WEB-INF/")) { - name = name.substring("WEB-INF/".length()); - } - System.out.println(name); - } - } - } finally { - zf.close(); - } - return 0; - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/ScanTrackingIds.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/ScanTrackingIds.java deleted file mode 100644 index 45f560a006..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/ScanTrackingIds.java +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (C) 2010 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; - -import static com.google.gerrit.server.schema.DataSourceProvider.Context.MULTI_USER; - -import com.google.gerrit.lifecycle.LifecycleManager; -import com.google.gerrit.pgm.util.SiteProgram; -import com.google.gerrit.reviewdb.Change; -import com.google.gerrit.reviewdb.PatchSet; -import com.google.gerrit.reviewdb.Project; -import com.google.gerrit.reviewdb.ReviewDb; -import com.google.gerrit.server.ChangeUtil; -import com.google.gerrit.server.config.TrackingFooters; -import com.google.gerrit.server.git.GitRepositoryManager; -import com.google.gwtorm.client.OrmException; -import com.google.gwtorm.client.SchemaFactory; -import com.google.inject.Inject; -import com.google.inject.Injector; - -import org.eclipse.jgit.errors.IncorrectObjectTypeException; -import org.eclipse.jgit.errors.MissingObjectException; -import org.eclipse.jgit.errors.RepositoryNotFoundException; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.Repository; -import org.eclipse.jgit.lib.TextProgressMonitor; -import org.eclipse.jgit.revwalk.RevCommit; -import org.eclipse.jgit.revwalk.RevWalk; -import org.kohsuke.args4j.Option; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** Scan changes and update the trackingid information for them. */ -public class ScanTrackingIds extends SiteProgram { - @Option(name = "--threads", usage = "Number of concurrent threads to run") - private int threads = 2 * Runtime.getRuntime().availableProcessors(); - - private final LifecycleManager manager = new LifecycleManager(); - private final TextProgressMonitor monitor = new TextProgressMonitor(); - private List todo; - - private Injector dbInjector; - - @Inject - private TrackingFooters footers; - - @Inject - private GitRepositoryManager gitManager; - - @Inject - private SchemaFactory database; - - @Override - public int run() throws Exception { - if (threads <= 0) { - threads = 1; - } - - dbInjector = createDbInjector(MULTI_USER); - manager.add(dbInjector); - manager.start(); - dbInjector.injectMembers(this); - - final ReviewDb db = database.open(); - try { - todo = db.changes().all().toList(); - synchronized (monitor) { - monitor.beginTask("Scanning changes", todo.size()); - } - } finally { - db.close(); - } - - final List workers = new ArrayList(threads); - for (int tid = 0; tid < threads; tid++) { - Worker t = new Worker(); - t.start(); - workers.add(t); - } - for (Worker t : workers) { - t.join(); - } - synchronized (monitor) { - monitor.endTask(); - } - manager.stop(); - return 0; - } - - private void scan(ReviewDb db, Change change) { - final Project.NameKey project = change.getDest().getParentKey(); - final Repository git; - try { - git = gitManager.openRepository(project); - } catch (RepositoryNotFoundException e) { - return; - } - try { - PatchSet ps = db.patchSets().get(change.currentPatchSetId()); - if (ps == null || ps.getRevision() == null - || ps.getRevision().get() == null) { - return; - } - ChangeUtil.updateTrackingIds(db, change, footers, parse(git, ps) - .getFooterLines()); - } catch (OrmException error) { - System.err.println("ERR " + error.getMessage()); - } catch (IOException error) { - System.err.println("ERR Cannot scan " + change.getId() + ": " - + error.getMessage()); - } finally { - git.close(); - } - } - - private RevCommit parse(final Repository git, PatchSet ps) - throws MissingObjectException, IncorrectObjectTypeException, IOException { - RevWalk rw = new RevWalk(git); - try { - return rw.parseCommit(ObjectId.fromString(ps.getRevision().get())); - } finally { - rw.release(); - } - } - - private Change next() { - synchronized (todo) { - if (todo.isEmpty()) { - return null; - } - return todo.remove(todo.size() - 1); - } - } - - private class Worker extends Thread { - @Override - public void run() { - ReviewDb db; - try { - db = database.open(); - } catch (OrmException e) { - e.printStackTrace(); - return; - } - try { - for (;;) { - Change change = next(); - if (change == null) { - break; - } - scan(db, change); - synchronized (monitor) { - monitor.update(1); - } - } - } finally { - db.close(); - } - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Version.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Version.java deleted file mode 100644 index 2392be532d..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/Version.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2009 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; - -import com.google.gerrit.pgm.util.AbstractProgram; - -/** Display the version of Gerrit. */ -public class Version extends AbstractProgram { - @Override - public int run() throws Exception { - final String v = com.google.gerrit.common.Version.getVersion(); - if (v == null) { - System.err.println("fatal: version unavailable"); - return 1; - } - System.out.println("gerrit version " + v); - return 0; - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/HttpLog.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/HttpLog.java deleted file mode 100644 index a4e13d3a1d..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/HttpLog.java +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright (C) 2010 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.http.jetty; - -import com.google.gerrit.server.CurrentUser; -import com.google.gerrit.server.IdentifiedUser; -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.Provider; -import com.google.inject.servlet.GuiceHelper; - -import org.apache.log4j.Appender; -import org.apache.log4j.AsyncAppender; -import org.apache.log4j.DailyRollingFileAppender; -import org.apache.log4j.Layout; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.spi.ErrorHandler; -import org.apache.log4j.spi.LoggingEvent; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.RequestLog; -import org.eclipse.jetty.server.Response; -import org.eclipse.jetty.util.component.AbstractLifeCycle; - -import java.io.File; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; - -/** Writes the {@code httpd_log} file with per-request data. */ -class HttpLog extends AbstractLifeCycle implements RequestLog { - private static final Logger log = Logger.getLogger(HttpLog.class); - private static final String LOG_NAME = "httpd_log"; - - private static final String P_HOST = "Host"; - private static final String P_USER = "User"; - private static final String P_METHOD = "Method"; - private static final String P_RESOURCE = "Resource"; - private static final String P_PROTOCOL = "Version"; - private static final String P_STATUS = "Status"; - private static final String P_CONTENT_LENGTH = "Content-Length"; - private static final String P_REFERER = "Referer"; - private static final String P_USER_AGENT = "User-Agent"; - - private final AsyncAppender async; - private final Provider userProvider; - - HttpLog(final SitePaths site, final Provider userProvider) { - this.userProvider = userProvider; - - final DailyRollingFileAppender dst = new DailyRollingFileAppender(); - dst.setName(LOG_NAME); - dst.setLayout(new MyLayout()); - dst.setEncoding("UTF-8"); - dst.setFile(new File(resolve(site.logs_dir), LOG_NAME).getPath()); - dst.setImmediateFlush(true); - dst.setAppend(true); - dst.setThreshold(Level.INFO); - dst.setErrorHandler(new DieErrorHandler()); - dst.activateOptions(); - dst.setErrorHandler(new LogLogHandler()); - - async = new AsyncAppender(); - async.setBlocking(true); - async.setBufferSize(64); - async.setLocationInfo(false); - async.addAppender(dst); - async.activateOptions(); - } - - @Override - protected void doStart() throws Exception { - } - - @Override - protected void doStop() throws Exception { - async.close(); - } - - @Override - public void log(final Request req, final Response rsp) { - GuiceHelper.runInContext(req, rsp, new Runnable() { - @Override - public void run() { - doLog(req, rsp); - } - }); - } - - private void doLog(Request req, Response rsp) { - final LoggingEvent event = new LoggingEvent( // - Logger.class.getName(), // fqnOfCategoryClass - null, // logger (optional) - System.currentTimeMillis(), // when - Level.INFO, // level - "", // message text - "HTTPD", // thread name - null, // exception information - null, // current NDC string - null, // caller location - null // MDC properties - ); - - String uri = req.getRequestURI(); - String qs = req.getQueryString(); - if (qs != null) { - uri = uri + "?" + qs; - } - - CurrentUser user = userProvider.get(); - if (user instanceof IdentifiedUser) { - IdentifiedUser who = (IdentifiedUser) user; - if (who.getUserName() != null && !who.getUserName().isEmpty()) { - event.setProperty(P_USER, who.getUserName()); - } else { - event.setProperty(P_USER, "a/" + who.getAccountId()); - } - } - - set(event, P_HOST, req.getRemoteAddr()); - set(event, P_METHOD, req.getMethod()); - set(event, P_RESOURCE, uri); - set(event, P_PROTOCOL, req.getProtocol()); - set(event, P_STATUS, rsp.getStatus()); - set(event, P_CONTENT_LENGTH, rsp.getContentCount()); - set(event, P_REFERER, req.getHeader("Referer")); - set(event, P_USER_AGENT, req.getHeader("User-Agent")); - - async.append(event); - } - - private static void set(LoggingEvent event, String key, String val) { - if (val != null && !val.isEmpty()) { - event.setProperty(key, val); - } - } - - private static void set(LoggingEvent event, String key, long val) { - if (0 < val) { - event.setProperty(key, String.valueOf(val)); - } - } - - private static File resolve(final File logs_dir) { - try { - return logs_dir.getCanonicalFile(); - } catch (IOException e) { - return logs_dir.getAbsoluteFile(); - } - } - - private static final class MyLayout extends Layout { - private final SimpleDateFormat dateFormat; - private long lastTimeMillis; - private String lastTimeString; - - MyLayout() { - final TimeZone tz = TimeZone.getDefault(); - dateFormat = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss Z"); - dateFormat.setTimeZone(tz); - - lastTimeMillis = System.currentTimeMillis(); - lastTimeString = dateFormat.format(new Date(lastTimeMillis)); - } - - @Override - public String format(LoggingEvent event) { - final StringBuilder buf = new StringBuilder(128); - - opt(buf, event, P_HOST); - - buf.append(' '); - buf.append('-'); // identd on client system (never requested) - - buf.append(' '); - opt(buf, event, P_USER); - - buf.append(' '); - buf.append('['); - formatDate(event.getTimeStamp(), buf); - buf.append(']'); - - buf.append(' '); - buf.append('"'); - buf.append(event.getMDC(P_METHOD)); - buf.append(' '); - buf.append(event.getMDC(P_RESOURCE)); - buf.append(' '); - buf.append(event.getMDC(P_PROTOCOL)); - buf.append('"'); - - buf.append(' '); - buf.append(event.getMDC(P_STATUS)); - - buf.append(' '); - opt(buf, event, P_CONTENT_LENGTH); - - buf.append(' '); - dq_opt(buf, event, P_REFERER); - - buf.append(' '); - dq_opt(buf, event, P_USER_AGENT); - - buf.append('\n'); - return buf.toString(); - } - - private void opt(StringBuilder buf, LoggingEvent event, String key) { - String val = (String) event.getMDC(key); - if (val == null) { - buf.append('-'); - } else { - buf.append(val); - } - } - - private void dq_opt(StringBuilder buf, LoggingEvent event, String key) { - String val = (String) event.getMDC(key); - if (val == null) { - buf.append('-'); - } else { - buf.append('"'); - buf.append(val); - buf.append('"'); - } - } - - private void formatDate(final long now, final StringBuilder sbuf) { - final long rounded = now - (int) (now % 1000); - if (rounded != lastTimeMillis) { - synchronized (dateFormat) { - lastTimeMillis = rounded; - lastTimeString = dateFormat.format(new Date(lastTimeMillis)); - sbuf.append(lastTimeString); - } - } else { - sbuf.append(lastTimeString); - } - } - - @Override - public boolean ignoresThrowable() { - return true; - } - - @Override - public void activateOptions() { - } - } - - private static final class DieErrorHandler implements ErrorHandler { - @Override - public void error(String message, Exception e, int errorCode, - LoggingEvent event) { - error(e != null ? e.getMessage() : message); - } - - @Override - public void error(String message, Exception e, int errorCode) { - error(e != null ? e.getMessage() : message); - } - - @Override - public void error(String message) { - throw new RuntimeException("Cannot open log file: " + message); - } - - @Override - public void activateOptions() { - } - - @Override - public void setAppender(Appender appender) { - } - - @Override - public void setBackupAppender(Appender appender) { - } - - @Override - public void setLogger(Logger logger) { - } - } - - private static final class LogLogHandler implements ErrorHandler { - @Override - public void error(String message, Exception e, int errorCode, - LoggingEvent event) { - log.error(message, e); - } - - @Override - public void error(String message, Exception e, int errorCode) { - log.error(message, e); - } - - @Override - public void error(String message) { - log.error(message); - } - - @Override - public void activateOptions() { - } - - @Override - public void setAppender(Appender appender) { - } - - @Override - public void setBackupAppender(Appender appender) { - } - - @Override - public void setLogger(Logger logger) { - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyEnv.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyEnv.java deleted file mode 100644 index ebca46700a..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyEnv.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2009 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.http.jetty; - -import com.google.inject.Injector; - -public class JettyEnv { - final Injector webInjector; - - public JettyEnv(final Injector webInjector) { - this.webInjector = webInjector; - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyModule.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyModule.java deleted file mode 100644 index 1ae9355316..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyModule.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2009 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.http.jetty; - -import com.google.gerrit.lifecycle.LifecycleModule; -import com.google.inject.AbstractModule; - -public class JettyModule extends AbstractModule { - private final JettyEnv env; - - public JettyModule(final JettyEnv env) { - this.env = env; - } - - @Override - protected void configure() { - bind(JettyEnv.class).toInstance(env); - bind(JettyServer.class); - install(new LifecycleModule() { - @Override - protected void configure() { - listener().to(JettyServer.Lifecycle.class); - } - }); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyServer.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyServer.java deleted file mode 100644 index 7ab8d30254..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/JettyServer.java +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright (C) 2009 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.http.jetty; - -import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static java.util.concurrent.TimeUnit.SECONDS; - -import com.google.gerrit.launcher.GerritLauncher; -import com.google.gerrit.lifecycle.LifecycleListener; -import com.google.gerrit.reviewdb.AuthType; -import com.google.gerrit.server.CurrentUser; -import com.google.gerrit.server.config.ConfigUtil; -import com.google.gerrit.server.config.GerritServerConfig; -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.google.inject.Provider; -import com.google.inject.Singleton; -import com.google.inject.servlet.GuiceFilter; -import com.google.inject.servlet.GuiceServletContextListener; - -import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Handler; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.handler.ContextHandler; -import org.eclipse.jetty.server.handler.ContextHandlerCollection; -import org.eclipse.jetty.server.handler.RequestLogHandler; -import org.eclipse.jetty.server.nio.SelectChannelConnector; -import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; -import org.eclipse.jetty.servlet.DefaultServlet; -import org.eclipse.jetty.servlet.FilterMapping; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.eclipse.jetty.util.thread.ThreadPool; -import org.eclipse.jgit.lib.Config; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -@Singleton -public class JettyServer { - static class Lifecycle implements LifecycleListener { - private final JettyServer server; - - @Inject - Lifecycle(final JettyServer server) { - this.server = server; - } - - @Override - public void start() { - try { - server.httpd.start(); - } catch (Exception e) { - throw new IllegalStateException("Cannot start HTTP daemon", e); - } - } - - @Override - public void stop() { - try { - server.httpd.stop(); - server.httpd.join(); - } catch (Exception e) { - throw new IllegalStateException("Cannot stop HTTP daemon", e); - } - } - } - - private final SitePaths site; - private final Server httpd; - - private boolean reverseProxy; - - /** Location on disk where our WAR file was unpacked to. */ - private Resource baseResource; - - @Inject - JettyServer(@GerritServerConfig final Config cfg, final SitePaths site, - final JettyEnv env, final Provider userProvider) - throws MalformedURLException, IOException { - this.site = site; - - httpd = new Server(); - httpd.setConnectors(listen(cfg)); - httpd.setThreadPool(threadPool(cfg)); - - Handler app = makeContext(env, cfg); - if (cfg.getBoolean("httpd", "requestlog", !reverseProxy)) { - RequestLogHandler handler = new RequestLogHandler(); - handler.setRequestLog(new HttpLog(site, userProvider)); - handler.setHandler(app); - app = handler; - } - httpd.setHandler(app); - - httpd.setStopAtShutdown(false); - httpd.setSendDateHeader(true); - httpd.setSendServerVersion(false); - httpd.setGracefulShutdown((int) MILLISECONDS.convert(1, SECONDS)); - } - - private Connector[] listen(final Config cfg) { - // OpenID and certain web-based single-sign-on products can cause - // some very long headers, especially in the Referer header. We - // need to use a larger default header size to ensure we have - // the space required. - // - final int requestHeaderSize = - cfg.getInt("httpd", "requestheadersize", 16386); - final URI[] listenUrls = listenURLs(cfg); - final boolean reuseAddress = cfg.getBoolean("httpd", "reuseaddress", true); - final int acceptors = cfg.getInt("httpd", "acceptorThreads", 2); - final AuthType authType = ConfigUtil.getEnum(cfg, "auth", null, "type", AuthType.OPENID); - - reverseProxy = true; - final Connector[] connectors = new Connector[listenUrls.length]; - for (int idx = 0; idx < listenUrls.length; idx++) { - final URI u = listenUrls[idx]; - final int defaultPort; - final SelectChannelConnector c; - - if (AuthType.CLIENT_SSL_CERT_LDAP.equals(authType) && ! "https".equals(u.getScheme())) { - throw new IllegalArgumentException("Protocol '" + u.getScheme() - + "' " + " not supported in httpd.listenurl '" + u - + "' when auth.type = '" + AuthType.CLIENT_SSL_CERT_LDAP.name() - + "'; only 'https' is supported"); - } - - if ("http".equals(u.getScheme())) { - reverseProxy = false; - defaultPort = 80; - c = new SelectChannelConnector(); - } else if ("https".equals(u.getScheme())) { - final SslSelectChannelConnector ssl = new SslSelectChannelConnector(); - final File keystore = getFile(cfg, "sslkeystore", "etc/keystore"); - String password = cfg.getString("httpd", null, "sslkeypassword"); - if (password == null) { - password = "gerrit"; - } - ssl.setKeystore(keystore.getAbsolutePath()); - ssl.setTruststore(keystore.getAbsolutePath()); - ssl.setKeyPassword(password); - ssl.setTrustPassword(password); - - if (AuthType.CLIENT_SSL_CERT_LDAP.equals(authType)) { - ssl.setNeedClientAuth(true); - } - - reverseProxy = false; - defaultPort = 443; - c = ssl; - - } else if ("proxy-http".equals(u.getScheme())) { - defaultPort = 8080; - c = new SelectChannelConnector(); - c.setForwarded(true); - - } else if ("proxy-https".equals(u.getScheme())) { - defaultPort = 8080; - c = new SelectChannelConnector() { - @Override - public void customize(EndPoint endpoint, Request request) - throws IOException { - request.setScheme("https"); - super.customize(endpoint, request); - } - }; - c.setForwarded(true); - - } else { - throw new IllegalArgumentException("Protocol '" + u.getScheme() + "' " - + " not supported in httpd.listenurl '" + u + "';" - + " only 'http', 'https', 'proxy-http, 'proxy-https'" - + " are supported"); - } - - try { - if (u.getHost() == null && (u.getAuthority().equals("*") // - || u.getAuthority().startsWith("*:"))) { - // Bind to all local addresses. Port wasn't parsed right by URI - // due to the illegal host of "*" so replace with a legal name - // and parse the URI. - // - final URI r = - new URI(u.toString().replace('*', 'A')).parseServerAuthority(); - c.setHost(null); - c.setPort(0 < r.getPort() ? r.getPort() : defaultPort); - } else { - final URI r = u.parseServerAuthority(); - c.setHost(r.getHost()); - c.setPort(0 < r.getPort() ? r.getPort() : defaultPort); - } - } catch (URISyntaxException e) { - throw new IllegalArgumentException("Invalid httpd.listenurl " + u, e); - } - - c.setRequestHeaderSize(requestHeaderSize); - c.setAcceptors(acceptors); - c.setReuseAddress(reuseAddress); - c.setStatsOn(false); - - connectors[idx] = c; - } - return connectors; - } - - private URI[] listenURLs(final Config cfg) { - String[] urls = cfg.getStringList("httpd", null, "listenurl"); - if (urls.length == 0) { - urls = new String[] {"http://*:8080/"}; - } - - final URI[] r = new URI[urls.length]; - for (int i = 0; i < r.length; i++) { - final String s = urls[i]; - try { - r[i] = new URI(s); - } catch (URISyntaxException e) { - throw new IllegalArgumentException("Invalid httpd.listenurl " + s, e); - } - } - return r; - } - - private File getFile(final Config cfg, final String name, final String def) { - String path = cfg.getString("httpd", null, name); - if (path == null || path.length() == 0) { - path = def; - } - return site.resolve(path); - } - - private ThreadPool threadPool(Config cfg) { - final QueuedThreadPool pool = new QueuedThreadPool(); - pool.setName("HTTP"); - pool.setMinThreads(cfg.getInt("httpd", null, "minthreads", 5)); - pool.setMaxThreads(cfg.getInt("httpd", null, "maxthreads", 25)); - pool.setMaxQueued(cfg.getInt("httpd", null, "maxqueued", 50)); - return pool; - } - - private Handler makeContext(final JettyEnv env, final Config cfg) - throws MalformedURLException, IOException { - final Set paths = new HashSet(); - for (URI u : listenURLs(cfg)) { - String p = u.getPath(); - if (p == null || p.isEmpty()) { - p = "/"; - } - while (1 < p.length() && p.endsWith("/")) { - p = p.substring(0, p.length() - 1); - } - paths.add(p); - } - - final List all = new ArrayList(); - for (String path : paths) { - all.add(makeContext(path, env)); - } - - if (all.size() == 1) { - // If we only have one context path in our web space, return it - // without any wrapping so Jetty has less work to do per-request. - // - return all.get(0); - } else { - // We have more than one path served out of this container so - // combine them in a handler which supports dispatching to the - // individual contexts. - // - final ContextHandlerCollection r = new ContextHandlerCollection(); - r.setHandlers(all.toArray(new Handler[0])); - return r; - } - } - - private ContextHandler makeContext(final String contextPath, - final JettyEnv env) throws MalformedURLException, IOException { - final ServletContextHandler app = new ServletContextHandler(); - - // This is the path we are accessed by clients within our domain. - // - app.setContextPath(contextPath); - - // Serve static resources directly from our JAR. This way we don't - // need to unpack them into yet another temporary directory prior to - // serving to clients. - // - app.setBaseResource(getBaseResource()); - - // Perform the same binding as our web.xml would do, but instead - // of using the listener to create the injector pass the one we - // already have built. - // - app.addFilter(GuiceFilter.class, "/*", FilterMapping.DEFAULT); - app.addEventListener(new GuiceServletContextListener() { - @Override - protected Injector getInjector() { - return env.webInjector; - } - }); - - // Jetty requires at least one servlet be bound before it will - // bother running the filter above. Since the filter has all - // of our URLs except the static resources, the only servlet - // we need to bind is the default static resource servlet from - // the Jetty container. - // - final ServletHolder ds = app.addServlet(DefaultServlet.class, "/"); - ds.setInitParameter("dirAllowed", "false"); - ds.setInitParameter("redirectWelcome", "false"); - ds.setInitParameter("useFileMappedBuffer", "false"); - ds.setInitParameter("gzip", "true"); - - app.setWelcomeFiles(new String[0]); - return app; - } - - private Resource getBaseResource() throws IOException { - if (baseResource == null) { - try { - baseResource = unpackWar(); - } catch (FileNotFoundException err) { - if (err.getMessage() == GerritLauncher.NOT_ARCHIVED) { - baseResource = useDeveloperBuild(); - } else { - throw err; - } - } - } - return baseResource; - } - - private Resource unpackWar() throws IOException { - final File srcwar = GerritLauncher.getDistributionArchive(); - - // Obtain our local temporary directory, but it comes back as a file - // so we have to switch it to be a directory post creation. - // - File dstwar = GerritLauncher.createTempFile("gerrit_", "war"); - if (!dstwar.delete() || !dstwar.mkdir()) { - throw new IOException("Cannot mkdir " + dstwar.getAbsolutePath()); - } - - // Jetty normally refuses to serve out of a symlinked directory, as - // a security feature. Try to resolve out any symlinks in the path. - // - try { - dstwar = dstwar.getCanonicalFile(); - } catch (IOException e) { - dstwar = dstwar.getAbsoluteFile(); - } - - final ZipFile zf = new ZipFile(srcwar); - try { - final Enumeration e = zf.entries(); - while (e.hasMoreElements()) { - final ZipEntry ze = e.nextElement(); - final String name = ze.getName(); - - if (ze.isDirectory()) continue; - if (name.startsWith("WEB-INF/")) continue; - if (name.startsWith("META-INF/")) continue; - if (name.startsWith("com/google/gerrit/launcher/")) continue; - if (name.equals("Main.class")) continue; - - final File rawtmp = new File(dstwar, name); - mkdir(rawtmp.getParentFile()); - rawtmp.deleteOnExit(); - - final FileOutputStream rawout = new FileOutputStream(rawtmp); - try { - final InputStream in = zf.getInputStream(ze); - try { - final byte[] buf = new byte[4096]; - int n; - while ((n = in.read(buf, 0, buf.length)) > 0) { - rawout.write(buf, 0, n); - } - } finally { - in.close(); - } - } finally { - rawout.close(); - } - } - } finally { - zf.close(); - } - - return Resource.newResource(dstwar.toURI()); - } - - private void mkdir(final File dir) throws IOException { - if (!dir.isDirectory()) { - mkdir(dir.getParentFile()); - if (!dir.mkdir()) - throw new IOException("Cannot mkdir " + dir.getAbsolutePath()); - dir.deleteOnExit(); - } - } - - private Resource useDeveloperBuild() throws IOException { - // Find ourselves in the CLASSPATH. We should be a loose class file. - // - URL u = getClass().getResource(getClass().getSimpleName() + ".class"); - if (u == null) { - throw new FileNotFoundException("Cannot find web application root"); - } - if (!"file".equals(u.getProtocol())) { - throw new FileNotFoundException("Cannot find web root from " + u); - } - - // Pop up to the top level classes folder that contains us. - // - File dir = new File(u.getPath()); - String myName = getClass().getName(); - for (;;) { - int dot = myName.lastIndexOf('.'); - if (dot < 0) { - dir = dir.getParentFile(); - break; - } - myName = myName.substring(0, dot); - dir = dir.getParentFile(); - } - - // We should be in a Maven style output, that is $jar/target/classes. - // - if (!dir.getName().equals("classes")) { - throw new FileNotFoundException("Cannot find web root from " + u); - } - dir = dir.getParentFile(); // pop classes - if (!dir.getName().equals("target")) { - throw new FileNotFoundException("Cannot find web root from " + u); - } - dir = dir.getParentFile(); // pop target - dir = dir.getParentFile(); // pop the module we are in - - // Drop down into gerrit-gwtui to find the WAR assets we need. - // - dir = new File(new File(dir, "gerrit-gwtui"), "target"); - final File[] entries = dir.listFiles(); - if (entries == null) { - throw new FileNotFoundException("No " + dir); - } - for (File e : entries) { - if (e.isDirectory() /* must be a directory */ - && e.getName().startsWith("gerrit-gwtui-") - && new File(e, "gerrit/gerrit.nocache.js").isFile()) { - return Resource.newResource(e.toURI()); - } - } - throw new FileNotFoundException("No " + dir + "/gerrit-gwtui-*"); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/ProjectQoSFilter.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/ProjectQoSFilter.java deleted file mode 100644 index 6870ca45b5..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/http/jetty/ProjectQoSFilter.java +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (C) 2010 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.http.jetty; - -import static com.google.gerrit.server.config.ConfigUtil.getTimeUnit; -import static com.google.inject.Scopes.SINGLETON; -import static java.util.concurrent.TimeUnit.MINUTES; -import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE; - -import com.google.gerrit.server.CurrentUser; -import com.google.gerrit.server.IdentifiedUser; -import com.google.gerrit.server.config.GerritServerConfig; -import com.google.gerrit.server.git.WorkQueue; -import com.google.gerrit.server.git.WorkQueue.CancelableRunnable; -import com.google.gerrit.sshd.CommandExecutorQueueProvider; -import com.google.gerrit.sshd.QueueProvider; -import com.google.inject.Inject; -import com.google.inject.Provider; -import com.google.inject.Singleton; -import com.google.inject.servlet.ServletModule; - -import org.eclipse.jetty.continuation.Continuation; -import org.eclipse.jetty.continuation.ContinuationListener; -import org.eclipse.jetty.continuation.ContinuationSupport; -import org.eclipse.jgit.lib.Config; - -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Use Jetty continuations to defer execution until threads are available. - *

- * We actually schedule a task into the same execution queue as the SSH daemon - * uses for command execution, and then park the web request in a continuation - * until an execution thread is available. This ensures that the overall JVM - * process doesn't exceed the configured limit on concurrent Git requests. - *

- * During Git request execution however we have to use the Jetty service thread, - * not the thread from the SSH execution queue. Trying to complete the request - * on the SSH execution queue caused Jetty's HTTP parser to crash, so we instead - * block the SSH execution queue thread and ask Jetty to resume processing on - * the web service thread. - */ -@Singleton -public class ProjectQoSFilter implements Filter { - private static final String ATT_SPACE = ProjectQoSFilter.class.getName(); - private static final String TASK = ATT_SPACE + "/TASK"; - private static final String CANCEL = ATT_SPACE + "/CANCEL"; - - private static final String FILTER_RE = - "^/p/(.*)/(git-upload-pack|git-receive-pack)$"; - private static final Pattern URI_PATTERN = Pattern.compile(FILTER_RE); - - public static class Module extends ServletModule { - - @Override - protected void configureServlets() { - bind(QueueProvider.class).to(CommandExecutorQueueProvider.class) - .in(SINGLETON); - filterRegex(FILTER_RE).through(ProjectQoSFilter.class); - } - } - - private final Provider userProvider; - private final QueueProvider queue; - - private final ServletContext context; - private final long maxWait; - - @Inject - ProjectQoSFilter(final Provider userProvider, - QueueProvider queue, final ServletContext context, - @GerritServerConfig final Config cfg) { - this.userProvider = userProvider; - this.queue = queue; - this.context = context; - this.maxWait = getTimeUnit(cfg, "httpd", null, "maxwait", 5, MINUTES); - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - final HttpServletRequest req = (HttpServletRequest) request; - final HttpServletResponse rsp = (HttpServletResponse) response; - final Continuation cont = ContinuationSupport.getContinuation(req); - - WorkQueue.Executor executor = getExecutor(); - - if (cont.isInitial()) { - TaskThunk task = new TaskThunk(executor, cont, req); - if (maxWait > 0) { - cont.setTimeout(maxWait); - } - cont.suspend(rsp); - cont.addContinuationListener(task); - cont.setAttribute(TASK, task); - executor.submit(task); - - } else if (cont.isExpired()) { - rsp.sendError(SC_SERVICE_UNAVAILABLE); - - } else if (cont.isResumed() && cont.getAttribute(CANCEL) == Boolean.TRUE) { - rsp.sendError(SC_SERVICE_UNAVAILABLE); - - } else if (cont.isResumed()) { - TaskThunk task = (TaskThunk) cont.getAttribute(TASK); - try { - task.begin(Thread.currentThread()); - chain.doFilter(req, rsp); - } finally { - task.end(); - Thread.interrupted(); - } - - } else { - context.log("Unexpected QoS continuation state, aborting request"); - rsp.sendError(SC_SERVICE_UNAVAILABLE); - } - } - - private WorkQueue.Executor getExecutor() { - WorkQueue.Executor executor; - if (userProvider.get().isBatchUser()) { - executor = queue.getBatchQueue(); - } else { - executor = queue.getInteractiveQueue(); - } - return executor; - } - - @Override - public void init(FilterConfig config) { - } - - @Override - public void destroy() { - } - - private final class TaskThunk implements CancelableRunnable, - ContinuationListener { - - private final WorkQueue.Executor executor; - private final Continuation cont; - private final String name; - private final Object lock = new Object(); - private boolean done; - private Thread worker; - - TaskThunk(final WorkQueue.Executor executor, final Continuation cont, - final HttpServletRequest req) { - this.executor = executor; - this.cont = cont; - this.name = generateName(req); - } - - @Override - public void run() { - cont.resume(); - - synchronized (lock) { - while (!done) { - try { - lock.wait(); - } catch (InterruptedException e) { - if (worker != null) { - worker.interrupt(); - } else { - break; - } - } - } - } - } - - void begin(Thread thread) { - synchronized (lock) { - worker = thread; - } - } - - void end() { - synchronized (lock) { - worker = null; - done = true; - lock.notifyAll(); - } - } - - @Override - public void cancel() { - cont.setAttribute(CANCEL, Boolean.TRUE); - cont.resume(); - } - - @Override - public void onComplete(Continuation self) { - } - - @Override - public void onTimeout(Continuation self) { - executor.remove(this); - } - - @Override - public String toString() { - return name; - } - - private String generateName(HttpServletRequest req) { - String userName = ""; - - CurrentUser who = userProvider.get(); - if (who instanceof IdentifiedUser) { - String name = ((IdentifiedUser) who).getUserName(); - if (name != null && !name.isEmpty()) { - userName = " (" + name + ")"; - } - } - - String uri = req.getServletPath(); - Matcher m = URI_PATTERN.matcher(uri); - if (m.matches()) { - String path = m.group(1); - String cmd = m.group(2); - return cmd + " " + path + userName; - } else { - return req.getMethod() + " " + uri + userName; - } - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Browser.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Browser.java deleted file mode 100644 index ea1304374f..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Browser.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2009 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.init; - -import com.google.gerrit.server.config.GerritServerConfig; -import com.google.inject.Inject; - -import org.eclipse.jgit.lib.Config; - -import java.io.IOException; -import java.net.Socket; -import java.net.URI; -import java.net.URISyntaxException; - -/** Opens the user's web browser to the web UI. */ -public class Browser { - private final Config cfg; - - @Inject - Browser(final @GerritServerConfig Config cfg) { - this.cfg = cfg; - } - - public void open() throws Exception { - open(null /* root page */); - } - - public void open(final String link) throws Exception { - String url = cfg.getString("httpd", null, "listenUrl"); - if (url == null) { - return; - } - - if (url.startsWith("proxy-")) { - url = url.substring("proxy-".length()); - } - - final URI uri; - try { - uri = InitUtil.toURI(url); - } catch (URISyntaxException e) { - System.err.println("error: invalid httpd.listenUrl: " + url); - return; - } - final String hostname = uri.getHost(); - final int port = InitUtil.portOf(uri); - - System.err.print("Waiting for server to start ... "); - System.err.flush(); - for (;;) { - final Socket s; - try { - s = new Socket(hostname, port); - } catch (IOException e) { - try { - Thread.sleep(100); - } catch (InterruptedException ie) { - } - continue; - } - s.close(); - break; - } - System.err.println("OK"); - - url = cfg.getString("gerrit", null, "canonicalWebUrl"); - if (url == null || url.isEmpty()) { - url = uri.toString(); - } - if (!url.endsWith("/")) { - url += "/"; - } - if (link != null && !link.isEmpty()) { - url += "#" + link; - } - System.err.println("Opening browser ..."); - org.h2.tools.Server.openBrowser(url); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitAuth.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitAuth.java deleted file mode 100644 index a5c7d9b2d6..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitAuth.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.dnOf; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.reviewdb.AuthType; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -/** Initialize the {@code auth} configuration section. */ -@Singleton -class InitAuth implements InitStep { - private final ConsoleUI ui; - private final Section auth; - private final Section ldap; - - @Inject - InitAuth(final ConsoleUI ui, final Section.Factory sections) { - this.ui = ui; - this.auth = sections.get("auth"); - this.ldap = sections.get("ldap"); - } - - public void run() { - ui.header("User Authentication"); - - final AuthType auth_type = - auth.select("Authentication method", "type", AuthType.OPENID); - - switch (auth_type) { - case HTTP: - case HTTP_LDAP: { - String hdr = auth.get("httpHeader"); - if (ui.yesno(hdr != null, "Get username from custom HTTP header")) { - auth.string("Username HTTP header", "httpHeader", "SM_USER"); - } else if (hdr != null) { - auth.unset("httpHeader"); - } - auth.string("SSO logout URL", "logoutUrl", null); - break; - } - } - - switch (auth_type) { - case LDAP: - case LDAP_BIND: - case HTTP_LDAP: { - String server = - ldap.string("LDAP server", "server", "ldap://localhost"); - if (server != null // - && !server.startsWith("ldap://") // - && !server.startsWith("ldaps://")) { - if (ui.yesno(false, "Use SSL")) { - server = "ldaps://" + server; - } else { - server = "ldap://" + server; - } - ldap.set("server", server); - } - - ldap.string("LDAP username", "username", null); - ldap.password("username", "password"); - - String aBase = ldap.string("Account BaseDN", "accountBase", dnOf(server)); - ldap.string("Group BaseDN", "groupBase", aBase); - break; - } - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitCache.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitCache.java deleted file mode 100644 index fb1a924c8f..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitCache.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.die; - -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import java.io.File; - -/** Initialize the {@code cache} configuration section. */ -@Singleton -class InitCache implements InitStep { - private final SitePaths site; - private final Section cache; - - @Inject - InitCache(final SitePaths site, final Section.Factory sections) { - this.site = site; - this.cache = sections.get("cache"); - } - - public void run() { - String path = cache.get("directory"); - - if (path != null && path.isEmpty()) { - // Explicitly set to empty implies the administrator has - // disabled the on disk cache and doesn't want it enabled. - // - return; - } - - if (path == null) { - path = "cache"; - cache.set("directory", path); - } - - final File loc = site.resolve(path); - if (!loc.exists() && !loc.mkdirs()) { - throw die("cannot create cache.directory " + loc.getAbsolutePath()); - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitContainer.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitContainer.java deleted file mode 100644 index 7063f5440f..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitContainer.java +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.die; -import static com.google.gerrit.pgm.init.InitUtil.username; - -import com.google.gerrit.launcher.GerritLauncher; -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import org.eclipse.jgit.storage.file.LockFile; -import org.eclipse.jgit.util.FS; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; - -/** Initialize the {@code container} configuration section. */ -@Singleton -class InitContainer implements InitStep { - private final ConsoleUI ui; - private final SitePaths site; - private final Section container; - - @Inject - InitContainer(final ConsoleUI ui, final SitePaths site, - final Section.Factory sections) { - this.ui = ui; - this.site = site; - this.container = sections.get("container"); - } - - public void run() throws FileNotFoundException, IOException { - ui.header("Container Process"); - - container.string("Run as", "user", username()); - container.string("Java runtime", "javaHome", javaHome()); - - File myWar; - try { - myWar = GerritLauncher.getDistributionArchive(); - } catch (FileNotFoundException e) { - System.err.println("warn: Cannot find gerrit.war"); - myWar = null; - } - - String path = container.get("war"); - if (path != null) { - path = container.string("Gerrit runtime", "war", // - myWar != null ? myWar.getAbsolutePath() : null); - if (path == null || path.isEmpty()) { - throw die("container.war is required"); - } - - } else if (myWar != null) { - final boolean copy; - final File siteWar = site.gerrit_war; - if (siteWar.exists()) { - copy = ui.yesno(true, "Upgrade %s", siteWar.getPath()); - } else { - copy = ui.yesno(true, "Copy gerrit.war to %s", siteWar.getPath()); - if (copy) { - container.unset("war"); - } else { - container.set("war", myWar.getAbsolutePath()); - } - } - if (copy) { - if (!ui.isBatch()) { - System.err.format("Copying gerrit.war to %s", siteWar.getPath()); - System.err.println(); - } - - FileInputStream in = new FileInputStream(myWar); - try { - siteWar.getParentFile().mkdirs(); - - LockFile lf = new LockFile(siteWar, FS.DETECTED); - if (!lf.lock()) { - throw new IOException("Cannot lock " + siteWar); - } - - try { - final OutputStream out = lf.getOutputStream(); - try { - final byte[] tmp = new byte[4096]; - for (;;) { - int n = in.read(tmp); - if (n < 0) { - break; - } - out.write(tmp, 0, n); - } - } finally { - out.close(); - } - if (!lf.commit()) { - throw new IOException("Cannot commit " + siteWar); - } - } finally { - lf.unlock(); - } - } finally { - in.close(); - } - } - } - } - - private static String javaHome() { - return System.getProperty("java.home"); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitDatabase.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitDatabase.java deleted file mode 100644 index d501ea5348..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitDatabase.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.die; -import static com.google.gerrit.pgm.init.InitUtil.username; -import static com.google.gerrit.server.schema.DataSourceProvider.Type.H2; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.SitePaths; -import com.google.gerrit.server.schema.DataSourceProvider; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import java.io.File; - -/** Initialize the {@code database} configuration section. */ -@Singleton -class InitDatabase implements InitStep { - private final ConsoleUI ui; - private final SitePaths site; - private final Libraries libraries; - private final Section database; - - @Inject - InitDatabase(final ConsoleUI ui, final SitePaths site, final Libraries libraries, - final Section.Factory sections) { - this.ui = ui; - this.site = site; - this.libraries = libraries; - this.database = sections.get("database"); - } - - public void run() { - ui.header("SQL Database"); - - final DataSourceProvider.Type db_type = - database.select("Database server type", "type", H2); - - switch (db_type) { - case MYSQL: - libraries.mysqlDriver.downloadRequired(); - break; - } - - final boolean userPassAuth; - switch (db_type) { - case H2: { - userPassAuth = false; - String path = database.get("database"); - if (path == null) { - path = "db/ReviewDB"; - database.set("database", path); - } - File db = site.resolve(path); - if (db == null) { - throw die("database.database must be supplied for H2"); - } - db = db.getParentFile(); - if (!db.exists() && !db.mkdirs()) { - throw die("cannot create database.database " + db.getAbsolutePath()); - } - break; - } - - case JDBC: { - userPassAuth = true; - database.string("Driver class name", "driver", null); - database.string("URL", "url", null); - break; - } - - case POSTGRESQL: - case MYSQL: { - userPassAuth = true; - final String defPort = "(" + db_type.toString() + " default)"; - database.string("Server hostname", "hostname", "localhost"); - database.string("Server port", "port", defPort, true); - database.string("Database name", "database", "reviewdb"); - break; - } - - default: - throw die("internal bug, database " + db_type + " not supported"); - } - - if (userPassAuth) { - database.string("Database username", "username", username()); - database.password("username", "password"); - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitFlags.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitFlags.java deleted file mode 100644 index 5d71b48b61..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitFlags.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2009 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.init; - -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import org.eclipse.jgit.errors.ConfigInvalidException; -import org.eclipse.jgit.storage.file.FileBasedConfig; -import org.eclipse.jgit.util.FS; - -import java.io.IOException; - -/** Global variables used by the 'init' command. */ -@Singleton -public class InitFlags { - /** Recursively delete the site path if initialization fails. */ - public boolean deleteOnFailure; - - /** Run the daemon (and open the web UI in a browser) after initialization. */ - public boolean autoStart; - - public final FileBasedConfig cfg; - public final FileBasedConfig sec; - - @Inject - InitFlags(final SitePaths site) throws IOException, ConfigInvalidException { - cfg = new FileBasedConfig(site.gerrit_config, FS.DETECTED); - sec = new FileBasedConfig(site.secure_config, FS.DETECTED); - - cfg.load(); - sec.load(); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitGitManager.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitGitManager.java deleted file mode 100644 index f0cd31fcd9..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitGitManager.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.die; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import java.io.File; - -/** Initialize the GitRepositoryManager configuration section. */ -@Singleton -class InitGitManager implements InitStep { - private final ConsoleUI ui; - private final Section gerrit; - - @Inject - InitGitManager(final ConsoleUI ui, final Section.Factory sections) { - this.ui = ui; - this.gerrit = sections.get("gerrit"); - } - - public void run() { - ui.header("Git Repositories"); - - File d = gerrit.path("Location of Git repositories", "basePath", "git"); - if (d == null) { - throw die("gerrit.basePath is required"); - } - if (!d.exists() && !d.mkdirs()) { - throw die("Cannot create " + d); - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitHttpd.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitHttpd.java deleted file mode 100644 index 8b4803f7d1..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitHttpd.java +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.chmod; -import static com.google.gerrit.pgm.init.InitUtil.die; -import static com.google.gerrit.pgm.init.InitUtil.domainOf; -import static com.google.gerrit.pgm.init.InitUtil.isAnyAddress; -import static com.google.gerrit.pgm.init.InitUtil.toURI; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.reviewdb.AuthType; -import com.google.gerrit.server.config.ConfigUtil; -import com.google.gerrit.server.config.SitePaths; -import com.google.gwtjsonrpc.server.SignedToken; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -/** Initialize the {@code httpd} configuration section. */ -@Singleton -class InitHttpd implements InitStep { - private final ConsoleUI ui; - private final SitePaths site; - private final InitFlags flags; - private final Section httpd; - private final Section gerrit; - - @Inject - InitHttpd(final ConsoleUI ui, final SitePaths site, final InitFlags flags, - final Section.Factory sections) { - this.ui = ui; - this.site = site; - this.flags = flags; - this.httpd = sections.get("httpd"); - this.gerrit = sections.get("gerrit"); - } - - public void run() throws IOException, InterruptedException { - ui.header("HTTP Daemon"); - - boolean proxy = false, ssl = false; - String address = "*"; - int port = -1; - String context = "/"; - String listenUrl = httpd.get("listenUrl"); - if (listenUrl != null && !listenUrl.isEmpty()) { - try { - final URI uri = toURI(listenUrl); - proxy = uri.getScheme().startsWith("proxy-"); - ssl = uri.getScheme().endsWith("https"); - address = isAnyAddress(new URI(listenUrl)) ? "*" : uri.getHost(); - port = uri.getPort(); - context = uri.getPath(); - } catch (URISyntaxException e) { - System.err.println("warning: invalid httpd.listenUrl " + listenUrl); - } - } - - proxy = ui.yesno(proxy, "Behind reverse proxy"); - - if (proxy) { - ssl = ui.yesno(ssl, "Proxy uses SSL (https://)"); - context = ui.readString(context, "Subdirectory on proxy server"); - } else { - ssl = ui.yesno(ssl, "Use SSL (https://)"); - context = "/"; - } - - address = ui.readString(address, "Listen on address"); - - if (port < 0) { - if (proxy) { - port = 8081; - } else if (ssl) { - port = 8443; - } else { - port = 8080; - } - } - port = ui.readInt(port, "Listen on port"); - - final StringBuilder urlbuf = new StringBuilder(); - urlbuf.append(proxy ? "proxy-" : ""); - urlbuf.append(ssl ? "https" : "http"); - urlbuf.append("://"); - urlbuf.append(address); - if (0 <= port) { - urlbuf.append(":"); - urlbuf.append(port); - } - urlbuf.append(context); - httpd.set("listenUrl", urlbuf.toString()); - - URI uri; - try { - uri = toURI(httpd.get("listenUrl")); - if (uri.getScheme().startsWith("proxy-")) { - // If its a proxy URL, assume the reverse proxy is on our system - // at the protocol standard ports (so omit the ports from the URL). - // - String s = uri.getScheme().substring("proxy-".length()); - uri = new URI(s + "://" + uri.getHost() + uri.getPath()); - } - } catch (URISyntaxException e) { - throw die("invalid httpd.listenUrl"); - } - if (gerrit.get("canonicalWebUrl") != null // - || (!proxy && ssl) // - || getAuthType() == AuthType.OPENID) { - gerrit.string("Canonical URL", "canonicalWebUrl", uri.toString()); - } - - generateSslCertificate(); - } - - private void generateSslCertificate() throws IOException, - InterruptedException { - final String listenUrl = httpd.get("listenUrl"); - - if (!listenUrl.startsWith("https://")) { - // We aren't responsible for SSL processing. - // - return; - } - - String hostname; - try { - String url = gerrit.get("canonicalWebUrl"); - if (url == null || url.isEmpty()) { - url = listenUrl; - } - hostname = toURI(url).getHost(); - } catch (URISyntaxException e) { - System.err.println("Invalid httpd.listenUrl, not checking certificate"); - return; - } - - final File store = site.ssl_keystore; - if (!ui.yesno(!store.exists(), "Create new self-signed SSL certificate")) { - return; - } - - String ssl_pass = flags.sec.getString("http", null, "sslKeyPassword"); - if (ssl_pass == null || ssl_pass.isEmpty()) { - ssl_pass = SignedToken.generateRandomKey(); - flags.sec.setString("httpd", null, "sslKeyPassword", ssl_pass); - } - - hostname = ui.readString(hostname, "Certificate server name"); - final String validity = - ui.readString("365", "Certificate expires in (days)"); - - final String dname = - "CN=" + hostname + ",OU=Gerrit Code Review,O=" + domainOf(hostname); - - final File tmpdir = new File(site.etc_dir, "tmp.sslcertgen"); - if (!tmpdir.mkdir()) { - throw die("Cannot create directory " + tmpdir); - } - chmod(0600, tmpdir); - - final File tmpstore = new File(tmpdir, "keystore"); - Runtime.getRuntime().exec(new String[] {"keytool", // - "-keystore", tmpstore.getAbsolutePath(), // - "-storepass", ssl_pass, // - "-genkeypair", // - "-alias", hostname, // - "-keyalg", "RSA", // - "-validity", validity, // - "-dname", dname, // - "-keypass", ssl_pass, // - }).waitFor(); - chmod(0600, tmpstore); - - if (!tmpstore.renameTo(store)) { - throw die("Cannot rename " + tmpstore + " to " + store); - } - if (!tmpdir.delete()) { - throw die("Cannot delete " + tmpdir); - } - } - - private AuthType getAuthType() { - return ConfigUtil.getEnum(flags.cfg, "auth", null, "type", AuthType.OPENID); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitModule.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitModule.java deleted file mode 100644 index a55cea5124..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitModule.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2009 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.init; - -import com.google.gerrit.server.config.FactoryModule; -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.binder.LinkedBindingBuilder; -import com.google.inject.internal.UniqueAnnotations; - -import java.lang.annotation.Annotation; - -/** Injection configuration for the site initialization process. */ -public class InitModule extends FactoryModule { - @Override - protected void configure() { - bind(SitePaths.class); - bind(InitFlags.class); - bind(Libraries.class); - bind(LibraryDownloader.class); - factory(Section.Factory.class); - - // Steps are executed in the order listed here. - // - step().to(UpgradeFrom2_0_x.class); - - step().to(InitGitManager.class); - step().to(InitDatabase.class); - step().to(InitAuth.class); - step().to(InitSendEmail.class); - step().to(InitContainer.class); - step().to(InitSshd.class); - step().to(InitHttpd.class); - step().to(InitCache.class); - } - - protected LinkedBindingBuilder step() { - final Annotation id = UniqueAnnotations.create(); - return bind(InitStep.class).annotatedWith(id); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSendEmail.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSendEmail.java deleted file mode 100644 index 7a3556eb3e..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSendEmail.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.isLocal; -import static com.google.gerrit.pgm.init.InitUtil.username; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.SitePaths; -import com.google.gerrit.server.mail.SmtpEmailSender.Encryption; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -/** Initialize the {@code sendemail} configuration section. */ -@Singleton -class InitSendEmail implements InitStep { - private final ConsoleUI ui; - private final Section sendemail; - - @Inject - InitSendEmail(final ConsoleUI ui, final SitePaths site, - final Section.Factory sections) { - this.ui = ui; - this.sendemail = sections.get("sendemail"); - } - - public void run() { - ui.header("Email Delivery"); - - final String hostname = - sendemail.string("SMTP server hostname", "smtpServer", "localhost"); - - sendemail.string("SMTP server port", "smtpServerPort", "(default)", true); - - final Encryption enc = - sendemail.select("SMTP encryption", "smtpEncryption", Encryption.NONE, - true); - - String username = null; - if ((enc != null && enc != Encryption.NONE) || !isLocal(hostname)) { - username = username(); - } - sendemail.string("SMTP username", "smtpUser", username); - sendemail.password("smtpUser", "smtpPass"); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSshd.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSshd.java deleted file mode 100644 index 482405e9d6..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitSshd.java +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.chmod; -import static com.google.gerrit.pgm.init.InitUtil.die; -import static com.google.gerrit.pgm.init.InitUtil.hostname; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.SitePaths; -import com.google.gerrit.server.util.SocketUtil; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import org.apache.sshd.common.util.SecurityUtils; -import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; - -import java.io.File; -import java.io.IOException; -import java.net.InetSocketAddress; - -/** Initialize the {@code sshd} configuration section. */ -@Singleton -class InitSshd implements InitStep { - private final ConsoleUI ui; - private final SitePaths site; - private final Libraries libraries; - private final Section sshd; - - @Inject - InitSshd(final ConsoleUI ui, final SitePaths site, final Libraries libraries, - final Section.Factory sections) { - this.ui = ui; - this.site = site; - this.libraries = libraries; - this.sshd = sections.get("sshd"); - } - - public void run() throws Exception { - ui.header("SSH Daemon"); - - String hostname = "*"; - int port = 29418; - String listenAddress = sshd.get("listenAddress"); - if (listenAddress != null && !listenAddress.isEmpty()) { - final InetSocketAddress addr = SocketUtil.parse(listenAddress, port); - hostname = SocketUtil.hostname(addr); - port = addr.getPort(); - } - - hostname = ui.readString(hostname, "Listen on address"); - port = ui.readInt(port, "Listen on port"); - sshd.set("listenAddress", SocketUtil.format(hostname, port)); - - if (site.ssh_rsa.exists() || site.ssh_dsa.exists()) { - libraries.bouncyCastle.downloadRequired(); - } else if (!site.ssh_key.exists()) { - libraries.bouncyCastle.downloadOptional(); - } - - generateSshHostKeys(); - } - - private void generateSshHostKeys() throws InterruptedException, IOException { - if (!site.ssh_key.exists() // - && !site.ssh_rsa.exists() // - && !site.ssh_dsa.exists()) { - System.err.print("Generating SSH host key ..."); - System.err.flush(); - - if (SecurityUtils.isBouncyCastleRegistered()) { - // Generate the SSH daemon host key using ssh-keygen. - // - final String comment = "gerrit-code-review@" + hostname(); - - System.err.print(" rsa..."); - System.err.flush(); - Runtime.getRuntime().exec(new String[] {"ssh-keygen", // - "-q" /* quiet */, // - "-t", "rsa", // - "-P", "", // - "-C", comment, // - "-f", site.ssh_rsa.getAbsolutePath() // - }).waitFor(); - - System.err.print(" dsa..."); - System.err.flush(); - Runtime.getRuntime().exec(new String[] {"ssh-keygen", // - "-q" /* quiet */, // - "-t", "dsa", // - "-P", "", // - "-C", comment, // - "-f", site.ssh_dsa.getAbsolutePath() // - }).waitFor(); - - } else { - // Generate the SSH daemon host key ourselves. This is complex - // because SimpleGeneratorHostKeyProvider doesn't mark the data - // file as only readable by us, exposing the private key for a - // short period of time. We try to reduce that risk by creating - // the key within a temporary directory. - // - final File tmpdir = new File(site.etc_dir, "tmp.sshkeygen"); - if (!tmpdir.mkdir()) { - throw die("Cannot create directory " + tmpdir); - } - chmod(0600, tmpdir); - - final File tmpkey = new File(tmpdir, site.ssh_key.getName()); - final SimpleGeneratorHostKeyProvider p; - - System.err.print(" rsa(simple)..."); - System.err.flush(); - p = new SimpleGeneratorHostKeyProvider(); - p.setPath(tmpkey.getAbsolutePath()); - p.setAlgorithm("RSA"); - p.loadKeys(); // forces the key to generate. - chmod(0600, tmpkey); - - if (!tmpkey.renameTo(site.ssh_key)) { - throw die("Cannot rename " + tmpkey + " to " + site.ssh_key); - } - if (!tmpdir.delete()) { - throw die("Cannot delete " + tmpdir); - } - } - System.err.println(" done"); - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitStep.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitStep.java deleted file mode 100644 index 4fa3f906f1..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitStep.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2009 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.init; - -/** A single step in the site initialization process. */ -public interface InitStep { - public void run() throws Exception; -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitUtil.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitUtil.java deleted file mode 100644 index 1382f65067..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/InitUtil.java +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (C) 2009 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.init; - -import com.google.gerrit.pgm.util.Die; - -import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.storage.file.FileBasedConfig; -import org.eclipse.jgit.storage.file.LockFile; -import org.eclipse.jgit.util.FS; -import org.eclipse.jgit.util.IO; -import org.eclipse.jgit.util.SystemReader; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.UnknownHostException; -import java.nio.ByteBuffer; -import java.util.Arrays; - -/** Utility functions to help initialize a site. */ -class InitUtil { - static Die die(String why) { - return new Die(why); - } - - static Die die(String why, Throwable cause) { - return new Die(why, cause); - } - - static void savePublic(final FileBasedConfig sec) throws IOException { - if (modified(sec)) { - sec.save(); - } - } - - static void saveSecure(final FileBasedConfig sec) throws IOException { - if (modified(sec)) { - final byte[] out = Constants.encode(sec.toText()); - final File path = sec.getFile(); - final LockFile lf = new LockFile(path, FS.DETECTED); - if (!lf.lock()) { - throw new IOException("Cannot lock " + path); - } - try { - chmod(0600, new File(path.getParentFile(), path.getName() + ".lock")); - lf.write(out); - if (!lf.commit()) { - throw new IOException("Cannot commit write to " + path); - } - } finally { - lf.unlock(); - } - } - } - - private static boolean modified(FileBasedConfig cfg) throws IOException { - byte[] curVers; - try { - curVers = IO.readFully(cfg.getFile()); - } catch (FileNotFoundException notFound) { - return true; - } - - byte[] newVers = Constants.encode(cfg.toText()); - return !Arrays.equals(curVers, newVers); - } - - static void mkdir(final File path) { - if (!path.isDirectory() && !path.mkdir()) { - throw die("Cannot make directory " + path); - } - } - - static void chmod(final int mode, final File path) { - path.setReadable(false, false /* all */); - path.setWritable(false, false /* all */); - path.setExecutable(false, false /* all */); - - path.setReadable((mode & 0400) == 0400, true /* owner only */); - path.setWritable((mode & 0200) == 0200, true /* owner only */); - if (path.isDirectory() || (mode & 0100) == 0100) { - path.setExecutable(true, true /* owner only */); - } - - if ((mode & 0044) == 0044) { - path.setReadable(true, false /* all */); - } - if ((mode & 0011) == 0011) { - path.setExecutable(true, false /* all */); - } - } - - static String version() { - return com.google.gerrit.common.Version.getVersion(); - } - - static String username() { - return System.getProperty("user.name"); - } - - static String hostname() { - return SystemReader.getInstance().getHostname(); - } - - static boolean isLocal(final String hostname) { - try { - return InetAddress.getByName(hostname).isLoopbackAddress(); - } catch (UnknownHostException e) { - return false; - } - } - - static String dnOf(String name) { - if (name != null) { - int p = name.indexOf("://"); - if (0 < p) { - name = name.substring(p + 3); - } - - p = name.indexOf("."); - if (0 < p) { - name = name.substring(p + 1); - name = "DC=" + name.replaceAll("\\.", ",DC="); - } else { - name = null; - } - } - return name; - } - - static String domainOf(String name) { - if (name != null) { - int p = name.indexOf("://"); - if (0 < p) { - name = name.substring(p + 3); - } - p = name.indexOf("."); - if (0 < p) { - name = name.substring(p + 1); - } - } - return name; - } - - static void extract(final File dst, final Class sibling, - final String name) throws IOException { - final InputStream in = open(sibling, name); - if (in != null) { - ByteBuffer buf = IO.readWholeStream(in, 8192); - copy(dst, buf); - } - } - - private static InputStream open(final Class sibling, final String name) { - final InputStream in = sibling.getResourceAsStream(name); - if (in == null) { - String pkg = sibling.getName(); - int end = pkg.lastIndexOf('.'); - if (0 < end) { - pkg = pkg.substring(0, end + 1); - pkg = pkg.replace('.', '/'); - } else { - pkg = ""; - } - System.err.println("warn: Cannot read " + pkg + name); - return null; - } - return in; - } - - static void copy(final File dst, final ByteBuffer buf) - throws FileNotFoundException, IOException { - // If the file already has the content we want to put there, - // don't attempt to overwrite the file. - // - try { - if (buf.equals(ByteBuffer.wrap(IO.readFully(dst)))) { - return; - } - } catch (FileNotFoundException notFound) { - // Fall through and write the file. - } - - dst.getParentFile().mkdirs(); - LockFile lf = new LockFile(dst, FS.DETECTED); - if (!lf.lock()) { - throw new IOException("Cannot lock " + dst); - } - try { - final OutputStream out = lf.getOutputStream(); - try { - final byte[] tmp = new byte[4096]; - while (0 < buf.remaining()) { - int n = Math.min(buf.remaining(), tmp.length); - buf.get(tmp, 0, n); - out.write(tmp, 0, n); - } - } finally { - out.close(); - } - if (!lf.commit()) { - throw new IOException("Cannot commit " + dst); - } - } finally { - lf.unlock(); - } - } - - static URI toURI(String url) throws URISyntaxException { - final URI u = new URI(url); - if (isAnyAddress(u)) { - // If the URL uses * it means all addresses on this system, use the - // current hostname instead in the returned URI. - // - final int s = url.indexOf('*'); - url = url.substring(0, s) + hostname() + url.substring(s + 1); - } - return new URI(url); - } - - static boolean isAnyAddress(final URI u) { - return u.getHost() == null - && (u.getAuthority().equals("*") || u.getAuthority().startsWith("*:")); - } - - static int portOf(final URI uri) { - int port = uri.getPort(); - if (port < 0) { - port = "https".equals(uri.getScheme()) ? 443 : 80; - } - return port; - } - - private InitUtil() { - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Libraries.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Libraries.java deleted file mode 100644 index ff1eddfb49..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Libraries.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (C) 2009 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.init; - -import com.google.inject.Inject; -import com.google.inject.Provider; -import com.google.inject.Singleton; - -import org.eclipse.jgit.errors.ConfigInvalidException; -import org.eclipse.jgit.lib.Config; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -/** Standard {@link LibraryDownloader} instances derived from configuration. */ -@Singleton -class Libraries { - private static final String RESOURCE_FILE = - "com/google/gerrit/pgm/libraries.config"; - - private final Provider downloadProvider; - - /* final */LibraryDownloader bouncyCastle; - /* final */LibraryDownloader mysqlDriver; - - @Inject - Libraries(final Provider downloadProvider) { - this.downloadProvider = downloadProvider; - - init(); - } - - private void init() { - final Config cfg = new Config(); - try { - cfg.fromText(read(RESOURCE_FILE)); - } catch (IOException e) { - throw new RuntimeException(e.getMessage(), e); - } catch (ConfigInvalidException e) { - throw new RuntimeException(e.getMessage(), e); - } - - for (final Field f : Libraries.class.getDeclaredFields()) { - if ((f.getModifiers() & Modifier.STATIC) == 0 - && f.getType() == LibraryDownloader.class) { - try { - init(f, cfg); - } catch (IllegalArgumentException e) { - throw new IllegalStateException("Cannot initialize " + f.getName()); - } catch (IllegalAccessException e) { - throw new IllegalStateException("Cannot initialize " + f.getName()); - } - } - } - } - - private void init(final Field field, final Config cfg) - throws IllegalArgumentException, IllegalAccessException { - final String n = field.getName(); - final LibraryDownloader dl = downloadProvider.get(); - dl.setName(get(cfg, n, "name")); - dl.setJarUrl(get(cfg, n, "url")); - dl.setSHA1(get(cfg, n, "sha1")); - field.set(this, dl); - } - - private static String get(Config cfg, String name, String key) { - String val = cfg.getString("library", name, key); - if (val == null || val.isEmpty()) { - throw new IllegalStateException("Variable library." + name + "." + key - + " is required within " + RESOURCE_FILE); - } - return val; - } - - private static String read(final String p) throws IOException { - InputStream in = Libraries.class.getClassLoader().getResourceAsStream(p); - if (in == null) { - throw new FileNotFoundException("Cannot load resource " + p); - } - final Reader r = new InputStreamReader(in, "UTF-8"); - try { - final StringBuilder buf = new StringBuilder(); - final char[] tmp = new char[512]; - int n; - while (0 < (n = r.read(tmp))) { - buf.append(tmp, 0, n); - } - return buf.toString(); - } finally { - r.close(); - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/LibraryDownloader.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/LibraryDownloader.java deleted file mode 100644 index ea1b515fb3..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/LibraryDownloader.java +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (C) 2009 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.init; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.pgm.util.Die; -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.Inject; - -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.util.HttpSupport; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.Proxy; -import java.net.ProxySelector; -import java.net.URL; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** Get optional or required 3rd party library files into $site_path/lib. */ -class LibraryDownloader { - private final ConsoleUI ui; - private final File lib_dir; - private final ReloadSiteLibrary reload; - - private boolean required; - private String name; - private String jarUrl; - private String sha1; - private File dst; - - @Inject - LibraryDownloader(final ReloadSiteLibrary reload, final ConsoleUI ui, - final SitePaths site) { - this.ui = ui; - this.lib_dir = site.lib_dir; - this.reload = reload; - } - - void setName(final String name) { - this.name = name; - } - - void setJarUrl(final String url) { - this.jarUrl = url; - } - - void setSHA1(final String sha1) { - this.sha1 = sha1; - } - - void downloadRequired() { - this.required = true; - download(); - } - - void downloadOptional() { - this.required = false; - download(); - } - - private void download() { - if (jarUrl == null || !jarUrl.contains("/")) { - throw new IllegalStateException("Invalid JarUrl for " + name); - } - - final String jarName = jarUrl.substring(jarUrl.lastIndexOf('/') + 1); - if (jarName.contains("/") || jarName.contains("\\")) { - throw new IllegalStateException("Invalid JarUrl: " + jarUrl); - } - - if (name == null) { - name = jarName; - } - - dst = new File(lib_dir, jarName); - if (!dst.exists() && shouldGet()) { - doGet(); - } - } - - private boolean shouldGet() { - if (ui.isBatch()) { - return required; - - } else { - final StringBuilder msg = new StringBuilder(); - msg.append("\n"); - msg.append("Gerrit Code Review is not shipped with %s\n"); - if (required) { - msg.append("** This library is required for your configuration. **\n"); - } else { - msg.append(" If available, Gerrit can take advantage of features\n"); - msg.append(" in the library, but will also function without it.\n"); - } - msg.append("Download and install it now"); - return ui.yesno(true, msg.toString(), name); - } - } - - private void doGet() { - if (!lib_dir.exists() && !lib_dir.mkdirs()) { - throw new Die("Cannot create " + lib_dir); - } - - try { - doGetByHttp(); - verifyFileChecksum(); - } catch (IOException err) { - dst.delete(); - - if (ui.isBatch()) { - throw new Die("error: Cannot get " + jarUrl, err); - } - - System.err.println(); - System.err.println(); - System.err.println("error: " + err.getMessage()); - System.err.println("Please download:"); - System.err.println(); - System.err.println(" " + jarUrl); - System.err.println(); - System.err.println("and save as:"); - System.err.println(); - System.err.println(" " + dst.getAbsolutePath()); - System.err.println(); - System.err.flush(); - - ui.waitForUser(); - - if (dst.exists()) { - verifyFileChecksum(); - - } else if (!ui.yesno(!required, "Continue without this library")) { - throw new Die("aborted by user"); - } - } - - reload.reload(); - } - - private void doGetByHttp() throws IOException { - System.err.print("Downloading " + jarUrl + " ..."); - System.err.flush(); - try { - final ProxySelector proxySelector = ProxySelector.getDefault(); - final URL url = new URL(jarUrl); - final Proxy proxy = HttpSupport.proxyFor(proxySelector, url); - final HttpURLConnection c = (HttpURLConnection) url.openConnection(proxy); - final InputStream in; - - switch (HttpSupport.response(c)) { - case HttpURLConnection.HTTP_OK: - in = c.getInputStream(); - break; - - case HttpURLConnection.HTTP_NOT_FOUND: - throw new FileNotFoundException(url.toString()); - - default: - throw new IOException(url.toString() + ": " + HttpSupport.response(c) - + " " + c.getResponseMessage()); - } - - try { - final OutputStream out = new FileOutputStream(dst); - try { - final byte[] buf = new byte[8192]; - int n; - while ((n = in.read(buf)) > 0) { - out.write(buf, 0, n); - } - } finally { - out.close(); - } - } finally { - in.close(); - } - System.err.println(" OK"); - System.err.flush(); - } catch (IOException err) { - dst.delete(); - System.err.println(" !! FAIL !!"); - System.err.flush(); - throw err; - } - } - - private void verifyFileChecksum() { - if (sha1 != null) { - try { - final MessageDigest md = MessageDigest.getInstance("SHA-1"); - final FileInputStream in = new FileInputStream(dst); - try { - final byte[] buf = new byte[8192]; - int n; - while ((n = in.read(buf)) > 0) { - md.update(buf, 0, n); - } - } finally { - in.close(); - } - - if (sha1.equals(ObjectId.fromRaw(md.digest()).name())) { - System.err.println("Checksum " + dst.getName() + " OK"); - System.err.flush(); - - } else if (ui.isBatch()) { - dst.delete(); - throw new Die(dst + " SHA-1 checksum does not match"); - - } else if (!ui.yesno(null /* force an answer */, - "error: SHA-1 checksum does not match\n" + "Use %s anyway",// - dst.getName())) { - dst.delete(); - throw new Die("aborted by user"); - } - - } catch (IOException checksumError) { - dst.delete(); - throw new Die("cannot checksum " + dst, checksumError); - - } catch (NoSuchAlgorithmException checksumError) { - dst.delete(); - throw new Die("cannot checksum " + dst, checksumError); - } - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/ReloadSiteLibrary.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/ReloadSiteLibrary.java deleted file mode 100644 index b21d3c0a0b..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/ReloadSiteLibrary.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2009 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.init; - -/** Requests the site's {@code lib/} directory be scanned again. */ -public interface ReloadSiteLibrary { - public void reload(); -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Section.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Section.java deleted file mode 100644 index 005904c269..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/Section.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (C) 2009 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.init; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.ConfigUtil; -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.Inject; -import com.google.inject.assistedinject.Assisted; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; - -/** Helper to edit a section of the configuration files. */ -class Section { - interface Factory { - Section get(String name); - } - - private final InitFlags flags; - private final SitePaths site; - private final ConsoleUI ui; - private final String section; - - @Inject - Section(final InitFlags flags, final SitePaths site, final ConsoleUI ui, - @Assisted final String section) { - this.flags = flags; - this.site = site; - this.ui = ui; - this.section = section; - } - - String get(String name) { - return flags.cfg.getString(section, null, name); - } - - void set(final String name, final String value) { - final ArrayList all = new ArrayList(); - all.addAll(Arrays.asList(flags.cfg.getStringList(section, null, name))); - - if (value != null) { - if (all.size() == 0 || all.size() == 1) { - flags.cfg.setString(section, null, name, value); - } else { - all.set(0, value); - flags.cfg.setStringList(section, null, name, all); - } - - } else if (all.size() == 0) { - } else if (all.size() == 1) { - flags.cfg.unset(section, null, name); - } else { - all.remove(0); - flags.cfg.setStringList(section, null, name, all); - } - } - - > void set(final String name, final T value) { - if (value != null) { - set(name, value.name()); - } else { - unset(name); - } - } - - void unset(String name) { - set(name, (String) null); - } - - String string(final String title, final String name, final String dv) { - return string(title, name, dv, false); - } - - String string(final String title, final String name, final String dv, - final boolean nullIfDefault) { - final String ov = get(name); - String nv = ui.readString(ov != null ? ov : dv, "%s", title); - if (nullIfDefault && nv == dv) { - nv = null; - } - if (!eq(ov, nv)) { - set(name, nv); - } - return nv; - } - - File path(final String title, final String name, final String defValue) { - return site.resolve(string(title, name, defValue)); - } - - > T select(final String title, final String name, - final T defValue) { - return select(title, name, defValue, false); - } - - > T select(final String title, final String name, - final T defValue, final boolean nullIfDefault) { - final boolean set = get(name) != null; - T oldValue = ConfigUtil.getEnum(flags.cfg, section, null, name, defValue); - T newValue = ui.readEnum(oldValue, "%s", title); - if (nullIfDefault && newValue == defValue) { - newValue = null; - } - if (!set || oldValue != newValue) { - if (newValue != null) { - set(name, newValue); - } else { - unset(name); - } - } - return newValue; - } - - String password(final String username, final String password) { - final String ov = flags.sec.getString(section, null, password); - - String user = flags.sec.getString(section, null, username); - if (user == null) { - user = get(username); - } - - if (user == null) { - flags.sec.unset(section, null, password); - return null; - } - - if (ov != null) { - // If the user already has a password stored, try to reuse it - // rather than prompting for a whole new one. - // - if (ui.isBatch() || !ui.yesno(false, "Change %s's password", user)) { - return ov; - } - } - - final String nv = ui.password("%s's password", user); - if (!eq(ov, nv)) { - if (nv != null) { - flags.sec.setString(section, null, password, nv); - } else { - flags.sec.unset(section, null, password); - } - } - return nv; - } - - private static boolean eq(final String a, final String b) { - if (a == null && b == null) { - return true; - } - return a != null ? a.equals(b) : false; - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/SitePathInitializer.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/SitePathInitializer.java deleted file mode 100644 index dae08934ad..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/SitePathInitializer.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.chmod; -import static com.google.gerrit.pgm.init.InitUtil.die; -import static com.google.gerrit.pgm.init.InitUtil.extract; -import static com.google.gerrit.pgm.init.InitUtil.mkdir; -import static com.google.gerrit.pgm.init.InitUtil.savePublic; -import static com.google.gerrit.pgm.init.InitUtil.saveSecure; -import static com.google.gerrit.pgm.init.InitUtil.version; - -import com.google.gerrit.pgm.Init; -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.SitePaths; -import com.google.gerrit.server.mail.OutgoingEmail; -import com.google.inject.Binding; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.google.inject.TypeLiteral; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -/** Initialize (or upgrade) an existing site. */ -public class SitePathInitializer { - private final ConsoleUI ui; - private final InitFlags flags; - private final SitePaths site; - private final List steps; - - @Inject - public SitePathInitializer(final Injector injector, final ConsoleUI ui, - final InitFlags flags, final SitePaths site) { - this.ui = ui; - this.flags = flags; - this.site = site; - this.steps = stepsOf(injector); - } - - public void run() throws Exception { - ui.header("Gerrit Code Review %s", version()); - - if (site.isNew) { - if (!ui.yesno(true, "Create '%s'", site.site_path.getCanonicalPath())) { - throw die("aborted by user"); - } - if (!site.site_path.isDirectory() && !site.site_path.mkdirs()) { - throw die("Cannot make directory " + site.site_path); - } - flags.deleteOnFailure = true; - } - - mkdir(site.bin_dir); - mkdir(site.etc_dir); - mkdir(site.lib_dir); - mkdir(site.logs_dir); - mkdir(site.mail_dir); - mkdir(site.static_dir); - - for (InitStep step : steps) { - step.run(); - } - - savePublic(flags.cfg); - saveSecure(flags.sec); - - if (!site.replication_config.exists()) { - site.replication_config.createNewFile(); - } - - extract(site.gerrit_sh, Init.class, "gerrit.sh"); - chmod(0755, site.gerrit_sh); - - extractMailExample("Abandoned.vm"); - extractMailExample("ChangeFooter.vm"); - extractMailExample("ChangeSubject.vm"); - extractMailExample("Comment.vm"); - extractMailExample("Merged.vm"); - extractMailExample("MergeFail.vm"); - extractMailExample("NewChange.vm"); - extractMailExample("RegisterNewEmail.vm"); - extractMailExample("ReplacePatchSet.vm"); - - if (!ui.isBatch()) { - System.err.println(); - } - } - - private void extractMailExample(String orig) throws Exception { - File ex = new File(site.mail_dir, orig + ".example"); - extract(ex, OutgoingEmail.class, orig); - chmod(0444, ex); - } - - private static List stepsOf(final Injector injector) { - final ArrayList r = new ArrayList(); - for (Binding b : all(injector)) { - r.add(b.getProvider().get()); - } - return r; - } - - private static List> all(final Injector injector) { - return injector.findBindingsByType(new TypeLiteral() {}); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/UpgradeFrom2_0_x.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/UpgradeFrom2_0_x.java deleted file mode 100644 index 9f62fc5faa..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/init/UpgradeFrom2_0_x.java +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static com.google.gerrit.pgm.init.InitUtil.die; -import static com.google.gerrit.pgm.init.InitUtil.savePublic; -import static com.google.gerrit.pgm.init.InitUtil.saveSecure; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.SitePaths; -import com.google.gerrit.server.schema.DataSourceProvider; -import com.google.gerrit.server.util.SocketUtil; -import com.google.inject.Inject; -import com.google.inject.Singleton; - -import org.eclipse.jgit.errors.ConfigInvalidException; -import org.eclipse.jgit.storage.file.FileBasedConfig; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.InetSocketAddress; -import java.net.URLDecoder; -import java.util.Arrays; -import java.util.Map; -import java.util.Properties; - -/** Upgrade from a 2.0.x site to a 2.1 site. */ -@Singleton -class UpgradeFrom2_0_x implements InitStep { - static final String[] etcFiles = {"gerrit.config", // - "secure.config", // - "replication.config", // - "ssh_host_rsa_key", // - "ssh_host_rsa_key.pub", // - "ssh_host_dsa_key", // - "ssh_host_dsa_key.pub", // - "ssh_host_key", // - "contact_information.pub", // - "gitweb_config.perl", // - "keystore", // - "GerritSite.css", // - "GerritSiteFooter.html", // - "GerritSiteHeader.html", // - }; - - private final ConsoleUI ui; - - private final FileBasedConfig cfg; - private final FileBasedConfig sec; - private final File site_path; - private final File etc_dir; - private final Section.Factory sections; - - @Inject - UpgradeFrom2_0_x(final SitePaths site, final InitFlags flags, - final ConsoleUI ui, final Section.Factory sections) { - this.ui = ui; - this.sections = sections; - - this.cfg = flags.cfg; - this.sec = flags.sec; - this.site_path = site.site_path; - this.etc_dir = site.etc_dir; - } - - boolean isNeedUpgrade() { - for (String name : etcFiles) { - if (new File(site_path, name).exists()) { - return true; - } - } - return false; - } - - public void run() throws IOException, ConfigInvalidException { - if (!isNeedUpgrade()) { - return; - } - - if (!ui.yesno(true, "Upgrade '%s'", site_path.getCanonicalPath())) { - throw die("aborted by user"); - } - - for (String name : etcFiles) { - final File src = new File(site_path, name); - final File dst = new File(etc_dir, name); - if (src.exists()) { - if (dst.exists()) { - throw die("File " + src + " would overwrite " + dst); - } - if (!src.renameTo(dst)) { - throw die("Cannot rename " + src + " to " + dst); - } - } - } - - // We have to reload the configuration after the rename as - // the initial load pulled up an non-existent (and thus - // believed to be empty) file. - // - cfg.load(); - sec.load(); - - final Properties oldprop = readGerritServerProperties(); - if (oldprop != null) { - final Section database = sections.get("database"); - - String url = oldprop.getProperty("url"); - if (url != null && !convertUrl(database, url)) { - database.set("type", DataSourceProvider.Type.JDBC); - database.set("driver", oldprop.getProperty("driver")); - database.set("url", url); - } - - String username = oldprop.getProperty("user"); - if (username == null || username.isEmpty()) { - username = oldprop.getProperty("username"); - } - if (username != null && !username.isEmpty()) { - cfg.setString("database", null, "username", username); - } - - String password = oldprop.getProperty("password"); - if (password != null && !password.isEmpty()) { - sec.setString("database", null, "password", password); - } - } - - String[] values; - - values = cfg.getStringList("ldap", null, "password"); - cfg.unset("ldap", null, "password"); - sec.setStringList("ldap", null, "password", Arrays.asList(values)); - - values = cfg.getStringList("sendemail", null, "smtpPass"); - cfg.unset("sendemail", null, "smtpPass"); - sec.setStringList("sendemail", null, "smtpPass", Arrays.asList(values)); - - saveSecure(sec); - savePublic(cfg); - } - - private boolean convertUrl(final Section database, String url) - throws UnsupportedEncodingException { - String username = null; - String password = null; - - if (url.contains("?")) { - final int q = url.indexOf('?'); - for (String pair : url.substring(q + 1).split("&")) { - final int eq = pair.indexOf('='); - if (0 < eq) { - return false; - } - - String n = URLDecoder.decode(pair.substring(0, eq), "UTF-8"); - String v = URLDecoder.decode(pair.substring(eq + 1), "UTF-8"); - - if ("user".equals(n) || "username".equals(n)) { - username = v; - - } else if ("password".equals(n)) { - password = v; - - } else { - // There is a parameter setting we don't recognize, use the - // JDBC URL format instead to preserve the configuration. - // - return false; - } - } - url = url.substring(0, q); - } - - if (url.startsWith("jdbc:h2:file:")) { - url = url.substring("jdbc:h2:file:".length()); - database.set("type", DataSourceProvider.Type.H2); - database.set("database", url); - return true; - } - - if (url.startsWith("jdbc:postgresql://")) { - url = url.substring("jdbc:postgresql://".length()); - final int sl = url.indexOf('/'); - if (sl < 0) { - return false; - } - - final InetSocketAddress addr = SocketUtil.parse(url.substring(0, sl), 0); - database.set("type", DataSourceProvider.Type.POSTGRESQL); - sethost(database, addr); - database.set("database", url.substring(sl + 1)); - setuser(database, username, password); - return true; - } - - if (url.startsWith("jdbc:postgresql:")) { - url = url.substring("jdbc:postgresql:".length()); - database.set("type", DataSourceProvider.Type.POSTGRESQL); - database.set("hostname", "localhost"); - database.set("database", url); - setuser(database, username, password); - return true; - } - - if (url.startsWith("jdbc:mysql://")) { - url = url.substring("jdbc:mysql://".length()); - final int sl = url.indexOf('/'); - if (sl < 0) { - return false; - } - - final InetSocketAddress addr = SocketUtil.parse(url.substring(0, sl), 0); - database.set("type", DataSourceProvider.Type.MYSQL); - sethost(database, addr); - database.set("database", url.substring(sl + 1)); - setuser(database, username, password); - return true; - } - - return false; - } - - private void sethost(final Section database, final InetSocketAddress addr) { - database.set("hostname", SocketUtil.hostname(addr)); - if (0 < addr.getPort()) { - database.set("port", String.valueOf(addr.getPort())); - } - } - - private void setuser(final Section database, String username, String password) { - if (username != null && !username.isEmpty()) { - database.set("username", username); - } - if (password != null && !password.isEmpty()) { - sec.setString("database", null, "password", password); - } - } - - private Properties readGerritServerProperties() throws IOException { - final Properties srvprop = new Properties(); - final String name = System.getProperty("GerritServer"); - File path; - if (name != null) { - path = new File(name); - } else { - path = new File(site_path, "GerritServer.properties"); - if (!path.exists()) { - path = new File("GerritServer.properties"); - } - } - if (path.exists()) { - try { - final InputStream in = new FileInputStream(path); - try { - srvprop.load(in); - } finally { - in.close(); - } - } catch (IOException e) { - throw new IOException("Cannot read " + name, e); - } - final Properties dbprop = new Properties(); - for (final Map.Entry e : srvprop.entrySet()) { - final String key = (String) e.getKey(); - if (key.startsWith("database.")) { - dbprop.put(key.substring("database.".length()), e.getValue()); - } - } - return dbprop; - } else { - return null; - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/AbstractProgram.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/AbstractProgram.java deleted file mode 100644 index 5d40923cea..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/AbstractProgram.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (C) 2009 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.util; - - -import com.google.gerrit.util.cli.CmdLineParser; -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Module; - -import org.kohsuke.args4j.CmdLineException; -import org.kohsuke.args4j.Option; - -import java.io.StringWriter; -import java.util.Collections; - -/** Base class for command line invocations of Gerrit Code Review. */ -public abstract class AbstractProgram { - private final Object sleepLock = new Object(); - private boolean running = true; - - @Option(name = "--show-stack-trace", usage = "display stack trace on failure") - private boolean showStackTrace; - - @Option(name = "--help", usage = "display this help text", aliases = {"-h"}) - private boolean help; - - private String getName() { - String n = getClass().getName(); - int dot = n.lastIndexOf('.'); - if (0 < dot) { - n = n.substring(dot + 1); - } - return n.toLowerCase(); - } - - public final int main(final String[] argv) throws Exception { - final Injector empty = emptyInjector(); - final CmdLineParser clp = new CmdLineParser(empty, this); - try { - clp.parseArgument(argv); - } catch (CmdLineException err) { - if (!help) { - System.err.println("fatal: " + err.getMessage()); - return 1; - } - } - - if (help) { - final StringWriter msg = new StringWriter(); - msg.write(getName()); - clp.printSingleLineUsage(msg, null); - msg.write('\n'); - - msg.write('\n'); - clp.printUsage(msg, null); - msg.write('\n'); - System.err.println(msg.toString()); - return 1; - } - - try { - ProxyUtil.configureHttpProxy(); - return run(); - } catch (Die err) { - if (showStackTrace) { - err.printStackTrace(); - } else { - final Throwable cause = err.getCause(); - final String diemsg = err.getMessage(); - if (cause != null && !cause.getMessage().equals(diemsg)) { - System.err.println("fatal: " - + cause.getMessage().replaceAll("\n", "\nfatal: ")); - } - System.err.println("fatal: " + diemsg.replaceAll("\n", "\nfatal: ")); - } - return 128; - } - } - - private static Injector emptyInjector() { - return Guice.createInjector(Collections. emptyList()); - } - - /** Create a new exception to indicate we won't continue. */ - protected static Die die(String why) { - return new Die(why); - } - - /** Create a new exception to indicate we won't continue. */ - protected static Die die(String why, Throwable cause) { - return new Die(why, cause); - } - - /** Method that never returns, e.g. to keep a daemon running. */ - protected int never() { - synchronized (sleepLock) { - while (running) { - try { - sleepLock.wait(60 * 60 * 1000L); - } catch (InterruptedException e) { - continue; - } - } - return 0; - } - } - - /** - * Run this program's logic, returning the command exit status. - *

- * When this method completes, the JVM is terminated. To keep the JVM running, - * use {@code return never()}. - */ - public abstract int run() throws Exception; -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ConsoleUI.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ConsoleUI.java deleted file mode 100644 index 1e93651646..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ConsoleUI.java +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (C) 2009 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.util; - -import static org.eclipse.jgit.util.StringUtils.equalsIgnoreCase; - -import java.io.Console; -import java.lang.reflect.InvocationTargetException; - -/** Console based interaction with the invoking user. */ -public abstract class ConsoleUI { - /** Get a UI instance, assuming interactive mode. */ - public static ConsoleUI getInstance() { - return getInstance(false); - } - - /** Get a UI instance, possibly forcing batch mode. */ - public static ConsoleUI getInstance(final boolean batchMode) { - Console console = batchMode ? null : System.console(); - return console != null ? new Interactive(console) : new Batch(); - } - - /** Constructs an exception indicating the user aborted the operation. */ - protected static Die abort() { - return new Die("aborted by user"); - } - - /** Obtain all values from an enumeration. */ - @SuppressWarnings("unchecked") - protected static > T[] all(final T value) { - try { - return (T[]) value.getClass().getMethod("values").invoke(null); - } catch (IllegalArgumentException e) { - throw new IllegalArgumentException("Cannot obtain enumeration values", e); - } catch (SecurityException e) { - throw new IllegalArgumentException("Cannot obtain enumeration values", e); - } catch (IllegalAccessException e) { - throw new IllegalArgumentException("Cannot obtain enumeration values", e); - } catch (InvocationTargetException e) { - throw new IllegalArgumentException("Cannot obtain enumeration values", e); - } catch (NoSuchMethodException e) { - throw new IllegalArgumentException("Cannot obtain enumeration values", e); - } - } - - /** @return true if this is a batch UI that has no user interaction. */ - public abstract boolean isBatch(); - - /** Display a header message before a series of prompts. */ - public abstract void header(String fmt, Object... args); - - /** Request the user to answer a yes/no question. */ - public abstract boolean yesno(Boolean def, String fmt, Object... args); - - /** Prints a message asking the user to let us know when its safe to continue. */ - public abstract void waitForUser(); - - /** Prompt the user for a string, suggesting a default, and returning choice. */ - public abstract String readString(String def, String fmt, Object... args); - - /** Prompt the user for an integer value, suggesting a default. */ - public int readInt(int def, String fmt, Object... args) { - for (;;) { - String p = readString(String.valueOf(def), fmt, args); - try { - return Integer.parseInt(p.trim(), 10); - } catch (NumberFormatException e) { - System.err.println("error: Invalid integer format: " + p.trim()); - } - } - } - - /** Prompt the user for a password, returning the string; null if blank. */ - public abstract String password(String fmt, Object... args); - - /** Prompt the user to make a choice from an enumeration's values. */ - public abstract > T readEnum(T def, String fmt, - Object... args); - - private static class Interactive extends ConsoleUI { - private final Console console; - - Interactive(final Console console) { - this.console = console; - } - - @Override - public boolean isBatch() { - return false; - } - - @Override - public boolean yesno(Boolean def, String fmt, Object... args) { - final String prompt = String.format(fmt, args); - for (;;) { - String y = "y"; - String n = "n"; - if (def != null) { - if (def) { - y = "Y"; - } else { - n = "N"; - } - } - - String yn = console.readLine("%-30s [%s/%s]? ", prompt, y, n); - if (yn == null) { - throw abort(); - } - yn = yn.trim(); - if (def != null && yn.isEmpty()) { - return def; - } - if (yn.equalsIgnoreCase("y") || yn.equalsIgnoreCase("yes")) { - return true; - } - if (yn.equalsIgnoreCase("n") || yn.equalsIgnoreCase("no")) { - return false; - } - } - } - - @Override - public void waitForUser() { - if (console.readLine("Press enter to continue ") == null) { - throw abort(); - } - } - - @Override - public String readString(String def, String fmt, Object... args) { - final String prompt = String.format(fmt, args); - String r; - if (def != null) { - r = console.readLine("%-30s [%s]: ", prompt, def); - } else { - r = console.readLine("%-30s : ", prompt); - } - if (r == null) { - throw abort(); - } - r = r.trim(); - if (r.isEmpty()) { - return def; - } - return r; - } - - @Override - public String password(String fmt, Object... args) { - final String prompt = String.format(fmt, args); - for (;;) { - final char[] a1 = console.readPassword("%-30s : ", prompt); - if (a1 == null) { - throw abort(); - } - - final char[] a2 = console.readPassword("%30s : ", "confirm password"); - if (a2 == null) { - throw abort(); - } - - final String s1 = new String(a1); - final String s2 = new String(a2); - if (!s1.equals(s2)) { - console.printf("error: Passwords did not match; try again\n"); - continue; - } - return !s1.isEmpty() ? s1 : null; - } - } - - @Override - public > T readEnum(T def, String fmt, Object... args) { - final String prompt = String.format(fmt, args); - final T[] options = all(def); - for (;;) { - String r = console.readLine("%-30s [%s/?]: ", prompt, def.toString()); - if (r == null) { - throw abort(); - } - r = r.trim(); - if (r.isEmpty()) { - return def; - } - for (final T e : options) { - if (equalsIgnoreCase(e.toString(), r)) { - return e; - } - } - if (!"?".equals(r)) { - console.printf("error: '%s' is not a valid choice\n", r); - } - console.printf(" Supported options are:\n"); - for (final T e : options) { - console.printf(" %s\n", e.toString().toLowerCase()); - } - } - } - - @Override - public void header(String fmt, Object... args) { - fmt = fmt.replaceAll("\n", "\n*** "); - console.printf("\n*** " + fmt + "\n*** \n\n", args); - } - } - - private static class Batch extends ConsoleUI { - @Override - public boolean isBatch() { - return true; - } - - @Override - public boolean yesno(Boolean def, String fmt, Object... args) { - return def != null ? def : true; - } - - @Override - public String readString(String def, String fmt, Object... args) { - return def; - } - - @Override - public void waitForUser() { - } - - @Override - public String password(String fmt, Object... args) { - return null; - } - - @Override - public > T readEnum(T def, String fmt, Object... args) { - return def; - } - - @Override - public void header(String fmt, Object... args) { - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/Die.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/Die.java deleted file mode 100644 index 96e2ec8e51..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/Die.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2009 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.util; - -public class Die extends RuntimeException { - private static final long serialVersionUID = 1L; - - public Die(final String why) { - super(why); - } - - public Die(final String why, final Throwable cause) { - super(why, cause); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ErrorLogFile.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ErrorLogFile.java deleted file mode 100644 index 14c8d9f67e..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ErrorLogFile.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (C) 2009 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.util; - -import com.google.gerrit.lifecycle.LifecycleListener; -import com.google.gerrit.server.config.SitePaths; - -import org.apache.log4j.Appender; -import org.apache.log4j.ConsoleAppender; -import org.apache.log4j.DailyRollingFileAppender; -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.helpers.OnlyOnceErrorHandler; -import org.apache.log4j.spi.ErrorHandler; -import org.apache.log4j.spi.LoggingEvent; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; - -public class ErrorLogFile { - static final String LOG_NAME = "error_log"; - - public static void errorOnlyConsole() { - LogManager.resetConfiguration(); - - final PatternLayout layout = new PatternLayout(); - layout.setConversionPattern("%-5p %c %x: %m%n"); - - final ConsoleAppender dst = new ConsoleAppender(); - dst.setLayout(layout); - dst.setTarget("System.err"); - dst.setThreshold(Level.ERROR); - - final Logger root = LogManager.getRootLogger(); - root.removeAllAppenders(); - root.addAppender(dst); - } - - public static LifecycleListener start(final File sitePath) - throws FileNotFoundException { - final File logdir = new SitePaths(sitePath).logs_dir; - if (!logdir.exists() && !logdir.mkdirs()) { - throw new Die("Cannot create log directory: " + logdir); - } - - final PatternLayout layout = new PatternLayout(); - layout.setConversionPattern("[%d] %-5p %c %x: %m%n"); - - final DailyRollingFileAppender dst = new DailyRollingFileAppender(); - dst.setName(LOG_NAME); - dst.setLayout(layout); - dst.setEncoding("UTF-8"); - dst.setFile(new File(resolve(logdir), LOG_NAME).getPath()); - dst.setImmediateFlush(true); - dst.setAppend(true); - dst.setThreshold(Level.INFO); - dst.setErrorHandler(new DieErrorHandler()); - dst.activateOptions(); - dst.setErrorHandler(new OnlyOnceErrorHandler()); - - final Logger root = LogManager.getRootLogger(); - root.removeAllAppenders(); - root.addAppender(dst); - - return new LifecycleListener() { - @Override - public void start() { - } - - @Override - public void stop() { - LogManager.shutdown(); - } - }; - } - - private static File resolve(final File logs_dir) { - try { - return logs_dir.getCanonicalFile(); - } catch (IOException e) { - return logs_dir.getAbsoluteFile(); - } - } - - private ErrorLogFile() { - } - - private static final class DieErrorHandler implements ErrorHandler { - @Override - public void error(String message, Exception e, int errorCode, - LoggingEvent event) { - error(e != null ? e.getMessage() : message); - } - - @Override - public void error(String message, Exception e, int errorCode) { - error(e != null ? e.getMessage() : message); - } - - @Override - public void error(String message) { - throw new Die("Cannot open log file: " + message); - } - - @Override - public void activateOptions() { - } - - @Override - public void setAppender(Appender appender) { - } - - @Override - public void setBackupAppender(Appender appender) { - } - - @Override - public void setLogger(Logger logger) { - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/IoUtil.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/IoUtil.java deleted file mode 100644 index 939885165b..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/IoUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2009 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.util; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -public final class IoUtil { - public static void copyWithThread(final InputStream src, - final OutputStream dst) { - new Thread("IoUtil-Copy") { - @Override - public void run() { - try { - final byte[] buf = new byte[256]; - int n; - while (0 < (n = src.read(buf))) { - dst.write(buf, 0, n); - } - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - src.close(); - } catch (IOException e2) { - } - } - } - }.start(); - } - - private IoUtil() { - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/LogFileCompressor.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/LogFileCompressor.java deleted file mode 100644 index 23f36a1dc2..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/LogFileCompressor.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (C) 2009 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.util; - -import static java.util.concurrent.TimeUnit.HOURS; - -import com.google.gerrit.lifecycle.LifecycleListener; -import com.google.gerrit.lifecycle.LifecycleModule; -import com.google.gerrit.server.config.SitePaths; -import com.google.gerrit.server.git.WorkQueue; -import com.google.inject.Inject; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.zip.GZIPOutputStream; - -/** Compresses the old error logs. */ -public class LogFileCompressor implements Runnable { - private static final Logger log = - LoggerFactory.getLogger(LogFileCompressor.class); - - public static class Module extends LifecycleModule { - @Override - protected void configure() { - listener().to(Lifecycle.class); - } - } - - static class Lifecycle implements LifecycleListener { - private final WorkQueue queue; - private final LogFileCompressor compresser; - - @Inject - Lifecycle(final WorkQueue queue, final LogFileCompressor compressor) { - this.queue = queue; - this.compresser = compressor; - } - - @Override - public void start() { - queue.getDefaultQueue().scheduleWithFixedDelay(compresser, 1, 24, HOURS); - } - - @Override - public void stop() { - } - } - - private final File logs_dir; - - @Inject - LogFileCompressor(final SitePaths site) { - logs_dir = resolve(site.logs_dir); - } - - private static File resolve(final File logs_dir) { - try { - return logs_dir.getCanonicalFile(); - } catch (IOException e) { - return logs_dir.getAbsoluteFile(); - } - } - - @Override - public void run() { - final File[] list = logs_dir.listFiles(); - if (list == null) { - return; - } - - for (final File entry : list) { - if (!isLive(entry) && !isCompressed(entry) && isLogFile(entry)) { - compress(entry); - } - } - } - - private boolean isLive(final File entry) { - final String name = entry.getName(); - return ErrorLogFile.LOG_NAME.equals(name) // - || "sshd_log".equals(name) // - || "httpd_log".equals(name) // - || "gerrit.run".equals(name) // - || name.endsWith(".pid"); - } - - private boolean isCompressed(final File entry) { - final String name = entry.getName(); - return name.endsWith(".gz") // - || name.endsWith(".zip") // - || name.endsWith(".bz2"); - } - - private boolean isLogFile(final File entry) { - return entry.isFile(); - } - - private void compress(final File src) { - final File dir = src.getParentFile(); - final File dst = new File(dir, src.getName() + ".gz"); - final File tmp = new File(dir, ".tmp." + src.getName()); - try { - final InputStream in = new FileInputStream(src); - try { - OutputStream out = new GZIPOutputStream(new FileOutputStream(tmp)); - try { - final byte[] buf = new byte[2048]; - int n; - while (0 < (n = in.read(buf))) { - out.write(buf, 0, n); - } - } finally { - out.close(); - } - tmp.setReadOnly(); - } finally { - in.close(); - } - if (!tmp.renameTo(dst)) { - throw new IOException("Cannot rename " + tmp + " to " + dst); - } - src.delete(); - } catch (IOException e) { - log.error("Cannot compress " + src, e); - tmp.delete(); - } - } - - @Override - public String toString() { - return "Log File Compressor"; - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ProxyUtil.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ProxyUtil.java deleted file mode 100644 index cce15bf884..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/ProxyUtil.java +++ /dev/null @@ -1,90 +0,0 @@ -// (Copied from JGit org.eclipse.jgit.pgm.Main) -// Copyright (C) 2006, Robin Rosenberg -// Copyright (C) 2008, Shawn O. Pearce -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or -// without modification, are permitted provided that the following -// conditions are met: -// -// - Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// -// - Neither the name of the Eclipse Foundation, Inc. nor the -// names of its contributors may be used to endorse or promote -// products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -// CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package com.google.gerrit.pgm.util; - -import org.eclipse.jgit.util.CachedAuthenticator; - -import java.net.MalformedURLException; -import java.net.URL; - -final class ProxyUtil { - /** - * Configure the JRE's standard HTTP based on http_proxy. - *

- * The popular libcurl library honors the http_proxy environment - * variable as a means of specifying an HTTP proxy for requests made behind a - * firewall. This is not natively recognized by the JRE, so this method can be - * used by command line utilities to configure the JRE before the first - * request is sent. - * - * @throws MalformedURLException the value in http_proxy is - * unsupportable. - */ - static void configureHttpProxy() throws MalformedURLException { - final String s = System.getenv("http_proxy"); - if (s == null || s.equals("")) { - return; - } - - final URL u = new URL((s.indexOf("://") == -1) ? "http://" + s : s); - if (!"http".equals(u.getProtocol())) { - throw new MalformedURLException("Invalid http_proxy: " + s - + ": Only http supported."); - } - - final String proxyHost = u.getHost(); - final int proxyPort = u.getPort(); - - System.setProperty("http.proxyHost", proxyHost); - if (proxyPort > 0) { - System.setProperty("http.proxyPort", String.valueOf(proxyPort)); - } - - final String userpass = u.getUserInfo(); - if (userpass != null && userpass.contains(":")) { - final int c = userpass.indexOf(':'); - final String user = userpass.substring(0, c); - final String pass = userpass.substring(c + 1); - CachedAuthenticator.add(new CachedAuthenticator.CachedAuthentication( - proxyHost, proxyPort, user, pass)); - } - } - - ProxyUtil() { - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/RuntimeShutdown.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/RuntimeShutdown.java deleted file mode 100644 index 18b706442d..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/RuntimeShutdown.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (C) 2009 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.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; - -public class RuntimeShutdown { - private static final ShutdownCallback cb = new ShutdownCallback(); - - /** Add a task to be performed when graceful shutdown is requested. */ - public static void add(final Runnable task) { - if (!cb.add(task)) { - // If the shutdown has already begun we cannot enqueue a new - // task. Instead trigger the task in the caller, without any - // of our locks held. - // - task.run(); - } - } - - /** Wait for the JVM shutdown to occur. */ - public static void waitFor() { - cb.waitForShutdown(); - } - - private RuntimeShutdown() { - } - - private static class ShutdownCallback extends Thread { - private static final Logger log = - LoggerFactory.getLogger(ShutdownCallback.class); - - private final List tasks = new ArrayList(); - private boolean shutdownStarted; - private boolean shutdownComplete; - - ShutdownCallback() { - setName("ShutdownCallback"); - } - - boolean add(final Runnable newTask) { - synchronized (this) { - if (!shutdownStarted && !shutdownComplete) { - if (tasks.isEmpty()) { - Runtime.getRuntime().addShutdownHook(this); - } - tasks.add(newTask); - return true; - - } else { - // We don't permit adding a task once shutdown has started. - // - return false; - } - } - } - - @Override - public void run() { - log.debug("Graceful shutdown requested"); - - List taskList; - synchronized (this) { - shutdownStarted = true; - taskList = tasks; - } - - for (Runnable task : taskList) { - try { - task.run(); - } catch (Exception err) { - log.error("Cleanup task failed", err); - } - } - - log.debug("Shutdown complete"); - - synchronized (this) { - shutdownComplete = true; - notifyAll(); - } - } - - void waitForShutdown() { - synchronized (this) { - while (!shutdownComplete) { - try { - wait(); - } catch (InterruptedException e) { - log.warn("Thread " + Thread.currentThread().getName() - + " interrupted while waiting for graceful shutdown;" - + " ignoring interrupt request"); - } - } - } - } - } -} diff --git a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/SiteProgram.java b/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/SiteProgram.java deleted file mode 100644 index 340168c7a2..0000000000 --- a/gerrit-pgm/src/main/java/com/google/gerrit/pgm/util/SiteProgram.java +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright (C) 2009 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.util; - -import static com.google.inject.Scopes.SINGLETON; -import static com.google.inject.Stage.PRODUCTION; - -import com.google.gerrit.lifecycle.LifecycleModule; -import com.google.gerrit.server.config.GerritServerConfigModule; -import com.google.gerrit.server.config.SitePath; -import com.google.gerrit.server.schema.DataSourceProvider; -import com.google.gerrit.server.schema.DatabaseModule; -import com.google.gerrit.server.schema.SchemaModule; -import com.google.gwtorm.client.OrmException; -import com.google.inject.AbstractModule; -import com.google.inject.CreationException; -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.Module; -import com.google.inject.name.Names; -import com.google.inject.spi.Message; - -import org.kohsuke.args4j.Option; - -import java.io.File; -import java.io.FileFilter; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.sql.DataSource; - -public abstract class SiteProgram extends AbstractProgram { - @Option(name = "--site-path", aliases = {"-d"}, usage = "Local directory containing site data") - private File sitePath = new File("."); - - /** @return the site path specified on the command line. */ - protected File getSitePath() { - File path = sitePath.getAbsoluteFile(); - if (".".equals(path.getName())) { - path = path.getParentFile(); - } - return path; - } - - /** Ensures we are running inside of a valid site, otherwise throws a Die. */ - protected void mustHaveValidSite() throws Die { - if (!new File(new File(getSitePath(), "etc"), "gerrit.config").exists()) { - throw die("not a Gerrit site: '" + getSitePath() + "'\n" - + "Perhaps you need to run init first?"); - } - } - - /** Load extra JARs from {@code lib/} subdirectory of {@link #getSitePath()} */ - protected void loadSiteLib() { - final File libdir = new File(getSitePath(), "lib"); - final File[] list = libdir.listFiles(new FileFilter() { - @Override - public boolean accept(File path) { - if (!path.isFile()) { - return false; - } - return path.getName().endsWith(".jar") // - || path.getName().endsWith(".zip"); - } - }); - if (list != null && 0 < list.length) { - Arrays.sort(list, new Comparator() { - @Override - public int compare(File a, File b) { - return a.getName().compareTo(b.getName()); - } - }); - addToClassLoader(list); - } - } - - private void addToClassLoader(final File[] additionalLocations) { - final ClassLoader cl = getClass().getClassLoader(); - if (!(cl instanceof URLClassLoader)) { - throw noAddURL("Not loaded by URLClassLoader", null); - } - - final URLClassLoader ucl = (URLClassLoader) cl; - final Set have = new HashSet(); - have.addAll(Arrays.asList(ucl.getURLs())); - - final Method m; - try { - m = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); - m.setAccessible(true); - } catch (SecurityException e) { - throw noAddURL("Method addURL not available", e); - } catch (NoSuchMethodException e) { - throw noAddURL("Method addURL not available", e); - } - - for (final File path : additionalLocations) { - try { - final URL url = path.toURI().toURL(); - if (have.add(url)) { - m.invoke(cl, url); - } - } catch (MalformedURLException e) { - throw noAddURL("addURL " + path + " failed", e); - } catch (IllegalArgumentException e) { - throw noAddURL("addURL " + path + " failed", e); - } catch (IllegalAccessException e) { - throw noAddURL("addURL " + path + " failed", e); - } catch (InvocationTargetException e) { - throw noAddURL("addURL " + path + " failed", e.getCause()); - } - } - } - - private static UnsupportedOperationException noAddURL(String m, Throwable why) { - final String prefix = "Cannot extend classpath: "; - return new UnsupportedOperationException(prefix + m, why); - } - - /** @return provides database connectivity and site path. */ - protected Injector createDbInjector(final DataSourceProvider.Context context) { - loadSiteLib(); - - final File sitePath = getSitePath(); - final List modules = new ArrayList(); - modules.add(new AbstractModule() { - @Override - protected void configure() { - bind(File.class).annotatedWith(SitePath.class).toInstance(sitePath); - } - }); - modules.add(new LifecycleModule() { - @Override - protected void configure() { - bind(DataSourceProvider.Context.class).toInstance(context); - bind(Key.get(DataSource.class, Names.named("ReviewDb"))).toProvider( - DataSourceProvider.class).in(SINGLETON); - listener().to(DataSourceProvider.class); - } - }); - modules.add(new GerritServerConfigModule()); - modules.add(new DatabaseModule()); - modules.add(new SchemaModule()); - - try { - return Guice.createInjector(PRODUCTION, modules); - } catch (CreationException ce) { - final Message first = ce.getErrorMessages().iterator().next(); - Throwable why = first.getCause(); - - if (why instanceof SQLException) { - throw die("Cannot connect to SQL database", why); - } - if (why instanceof OrmException && why.getCause() != null - && "Unable to determine driver URL".equals(why.getMessage())) { - why = why.getCause(); - if (isCannotCreatePoolException(why)) { - throw die("Cannot connect to SQL database", why.getCause()); - } - throw die("Cannot connect to SQL database", why); - } - - final StringBuilder buf = new StringBuilder(); - if (why != null) { - buf.append(why.getMessage()); - why = why.getCause(); - } else { - buf.append(first.getMessage()); - } - while (why != null) { - buf.append("\n caused by "); - buf.append(why.toString()); - why = why.getCause(); - } - throw die(buf.toString(), new RuntimeException("DbInjector failed", ce)); - } - } - - @SuppressWarnings("deprecation") - private static boolean isCannotCreatePoolException(Throwable why) { - return why instanceof org.apache.commons.dbcp.SQLNestedException - && why.getCause() != null - && why.getMessage().startsWith( - "Cannot create PoolableConnectionFactory"); - } -} diff --git a/gerrit-pgm/src/main/java/com/google/inject/servlet/GuiceHelper.java b/gerrit-pgm/src/main/java/com/google/inject/servlet/GuiceHelper.java deleted file mode 100644 index 5b6cc0906f..0000000000 --- a/gerrit-pgm/src/main/java/com/google/inject/servlet/GuiceHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2010 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.inject.servlet; - -import com.google.inject.servlet.GuiceFilter.Context; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class GuiceHelper { - public static void runInContext(HttpServletRequest req, - HttpServletResponse rsp, Runnable thunk) { - Context previous = GuiceFilter.localContext.get(); - try { - GuiceFilter.localContext.set(new Context(req, rsp)); - thunk.run(); - } finally { - GuiceFilter.localContext.set(previous); - } - } - - private GuiceHelper() { - } -} diff --git a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/gerrit.sh b/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/gerrit.sh deleted file mode 100755 index 4538bce9d5..0000000000 --- a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/gerrit.sh +++ /dev/null @@ -1,518 +0,0 @@ -#!/bin/sh -# -# Launch Gerrit Code Review as a daemon process. - -# To get the service to restart correctly on reboot, uncomment below (3 lines): -# ======================== -# chkconfig: 3 99 99 -# description: Gerrit Code Review -# processname: gerrit -# ======================== - -# Configuration files: -# -# /etc/default/gerritcodereview -# If it exists, sourced at the start of this script. It may perform any -# sequence of shell commands, like setting relevant environment variables. -# -# The files will be checked for existence before being sourced. - -# Configuration variables. These may be set in /etc/default/gerritcodereview. -# -# GERRIT_SITE -# Path of the Gerrit site to run. $GERRIT_SITE/etc/gerrit.config -# will be used to configure the process. -# -# GERRIT_WAR -# Location of the gerrit.war download that we will execute. Defaults to -# container.war property in $GERRIT_SITE/etc/gerrit.config. -# -# NO_START -# If set to "1" disables Gerrit from starting. -# -# START_STOP_DAEMON -# If set to "0" disables using start-stop-daemon. This may need to -# be set on SuSE systems. - -usage() { - me=`basename "$0"` - echo >&2 "Usage: $me {start|stop|restart|check|run|supervise} [-d site]" - exit 1 -} - -test $# -gt 0 || usage - -################################################## -# Some utility functions -################################################## -running() { - test -f $1 || return 1 - PID=`cat $1` - ps -p $PID >/dev/null 2>/dev/null || return 1 - return 0 -} - -get_config() { - if test -f "$GERRIT_CONFIG" ; then - if test "x$1" = x--int ; then - # Git might not be able to expand "8g" properly. If it gives - # us 0 back retry for the raw string and expand ourselves. - # - n=`git config --file "$GERRIT_CONFIG" --int "$2"` - if test x0 = "x$n" ; then - n=`git config --file "$GERRIT_CONFIG" --get "$2"` - case "$n" in - *g) n=`expr ${n%%g} \* 1024`m ;; - *k) n=`expr ${n%%k} \* 1024` ;; - *) : ;; - esac - fi - echo "$n" - else - git config --file "$GERRIT_CONFIG" $1 "$2" - fi - fi -} - -################################################## -# Get the action and options -################################################## - -ACTION=$1 -shift - -while test $# -gt 0 ; do - case "$1" in - -d|--site-path) - shift - GERRIT_SITE=$1 - shift - ;; - -d=*) - GERRIT_SITE=${1##-d=} - shift - ;; - --site-path=*) - GERRIT_SITE=${1##--site-path=} - shift - ;; - - *) - usage - esac -done - -test -z "$NO_START" && NO_START=0 -test -z "$START_STOP_DAEMON" && START_STOP_DAEMON=1 - -################################################## -# See if there's a default configuration file -################################################## -if test -f /etc/default/gerritcodereview ; then - . /etc/default/gerritcodereview -fi - -################################################## -# Set tmp if not already set. -################################################## -if test -z "$TMP" ; then - TMP=/tmp -fi -TMPJ=$TMP/j$$ - -################################################## -# Reasonable guess marker for a Gerrit site path. -################################################## -GERRIT_INSTALL_TRACE_FILE=etc/gerrit.config - -################################################## -# No git in PATH? Needed for gerrit.confg parsing -################################################## -if type git >/dev/null 2>&1 ; then - : OK -else - echo >&2 "** ERROR: Cannot find git in PATH" - exit 1 -fi - -################################################## -# Try to determine GERRIT_SITE if not set -################################################## -if test -z "$GERRIT_SITE" ; then - GERRIT_SITE_1=`dirname "$0"` - GERRIT_SITE_1=`dirname "$GERRIT_SITE_1"` - if test -f "${GERRIT_SITE_1}/${GERRIT_INSTALL_TRACE_FILE}" ; then - GERRIT_SITE=${GERRIT_SITE_1} - fi -fi - -################################################## -# No GERRIT_SITE yet? We're out of luck! -################################################## -if test -z "$GERRIT_SITE" ; then - echo >&2 "** ERROR: GERRIT_SITE not set" - exit 1 -fi - -if cd "$GERRIT_SITE" ; then - GERRIT_SITE=`pwd` -else - echo >&2 "** ERROR: Gerrit site $GERRIT_SITE not found" - exit 1 -fi - -##################################################### -# Check that Gerrit is where we think it is -##################################################### -GERRIT_CONFIG="$GERRIT_SITE/$GERRIT_INSTALL_TRACE_FILE" -test -f "$GERRIT_CONFIG" || { - echo "** ERROR: Gerrit is not initialized in $GERRIT_SITE" - exit 1 -} -test -r "$GERRIT_CONFIG" || { - echo "** ERROR: $GERRIT_CONFIG is not readable!" - exit 1 -} - -GERRIT_PID="$GERRIT_SITE/logs/gerrit.pid" -GERRIT_RUN="$GERRIT_SITE/logs/gerrit.run" - -################################################## -# Check for JAVA_HOME -################################################## -JAVA_HOME_OLD="$JAVA_HOME" -JAVA_HOME=`get_config --get container.javaHome` -if test -z "$JAVA_HOME" ; then - JAVA_HOME="$JAVA_HOME_OLD" -fi -if test -z "$JAVA_HOME" ; then - # If a java runtime is not defined, search the following - # directories for a JVM and sort by version. Use the highest - # version number. - - JAVA_LOCATIONS="\ - /usr/java \ - /usr/bin \ - /usr/local/bin \ - /usr/local/java \ - /usr/local/jdk \ - /usr/local/jre \ - /usr/lib/jvm \ - /opt/java \ - /opt/jdk \ - /opt/jre \ - " - for N in java jdk jre ; do - for L in $JAVA_LOCATIONS ; do - test -d "$L" || continue - find $L -name "$N" ! -type d | grep -v threads | while read J ; do - test -x "$J" || continue - VERSION=`eval "$J" -version 2>&1` - test $? = 0 || continue - VERSION=`expr "$VERSION" : '.*"\(1.[0-9\.]*\)["_]'` - test -z "$VERSION" && continue - expr "$VERSION" \< 1.2 >/dev/null && continue - echo "$VERSION:$J" - done - done - done | sort | tail -1 >"$TMPJ" - JAVA=`cat "$TMPJ" | cut -d: -f2` - JVERSION=`cat "$TMPJ" | cut -d: -f1` - rm -f "$TMPJ" - - JAVA_HOME=`dirname "$JAVA"` - while test -n "$JAVA_HOME" \ - -a "$JAVA_HOME" != "/" \ - -a ! -f "$JAVA_HOME/lib/tools.jar" ; do - JAVA_HOME=`dirname "$JAVA_HOME"` - done - test -z "$JAVA_HOME" && JAVA_HOME= - - echo "** INFO: Using $JAVA" -fi - -if test -z "$JAVA" \ - -a -n "$JAVA_HOME" \ - -a -x "$JAVA_HOME/bin/java" \ - -a ! -d "$JAVA_HOME/bin/java" ; then - JAVA="$JAVA_HOME/bin/java" -fi - -if test -z "$JAVA" ; then - echo >&2 "Cannot find a JRE or JDK. Please set JAVA_HOME to a >=1.6 JRE" - exit 1 -fi - -##################################################### -# Add Gerrit properties to Java VM options. -##################################################### - -GERRIT_OPTIONS=`get_config --get-all container.javaOptions` -if test -n "$GERRIT_OPTIONS" ; then - JAVA_OPTIONS="$JAVA_OPTIONS $GERRIT_OPTIONS" -fi - -GERRIT_MEMORY=`get_config --get container.heapLimit` -if test -n "$GERRIT_MEMORY" ; then - JAVA_OPTIONS="$JAVA_OPTIONS -Xmx$GERRIT_MEMORY" -fi - -GERRIT_FDS=`get_config --int core.packedGitOpenFiles` -test -z "$GERRIT_FDS" && GERRIT_FDS=128 -GERRIT_FDS=`expr $GERRIT_FDS + $GERRIT_FDS` -test $GERRIT_FDS -lt 1024 && GERRIT_FDS=1024 - -GERRIT_USER=`get_config --get container.user` - -##################################################### -# Configure sane ulimits for a daemon of our size. -##################################################### - -ulimit -c 0 ; # core file size -ulimit -d unlimited ; # data seg size -ulimit -f unlimited ; # file size -ulimit -m >/dev/null 2>&1 && ulimit -m unlimited ; # max memory size -ulimit -n $GERRIT_FDS ; # open files -ulimit -t unlimited ; # cpu time -ulimit -v unlimited ; # virtual memory - -ulimit -x >/dev/null 2>&1 && ulimit -x unlimited ; # file locks - -##################################################### -# This is how the Gerrit server will be started -##################################################### - -if test -z "$GERRIT_WAR" ; then - GERRIT_WAR=`get_config --get container.war` -fi -if test -z "$GERRIT_WAR" ; then - GERRIT_WAR="$GERRIT_SITE/bin/gerrit.war" - test -f "$GERRIT_WAR" || GERRIT_WAR= -fi -if test -z "$GERRIT_WAR" -a -n "$GERRIT_USER" ; then - for homedirs in /home /Users ; do - if test -d "$homedirs/$GERRIT_USER" ; then - GERRIT_WAR="$homedirs/$GERRIT_USER/gerrit.war" - if test -f "$GERRIT_WAR" ; then - break - else - GERRIT_WAR= - fi - fi - done -fi -if test -z "$GERRIT_WAR" ; then - echo >&2 "** ERROR: Cannot find gerrit.war (try setting gerrit.war)" - exit 1 -fi - -test -z "$GERRIT_USER" && GERRIT_USER=`whoami` -RUN_ARGS="-jar $GERRIT_WAR daemon -d $GERRIT_SITE" -if test "`get_config --bool container.slave`" = "true" ; then - RUN_ARGS="$RUN_ARGS --slave" -fi -if test -n "$JAVA_OPTIONS" ; then - RUN_ARGS="$JAVA_OPTIONS $RUN_ARGS" -fi - -if test -x /usr/bin/perl ; then - # If possible, use Perl to mask the name of the process so its - # something specific to us rather than the generic 'java' name. - # - export JAVA - RUN_EXEC=/usr/bin/perl - RUN_Arg1=-e - RUN_Arg2='$x=$ENV{JAVA};exec $x @ARGV;die $!' - RUN_Arg3='-- GerritCodeReview' -else - RUN_EXEC=$JAVA - RUN_Arg1= - RUN_Arg2='-DGerritCodeReview=1' - RUN_Arg3= -fi - -################################################## -# Do the action -################################################## -case "$ACTION" in - start) - printf '%s' "Starting Gerrit Code Review: " - - if test 1 = "$NO_START" ; then - echo "Not starting gerrit - NO_START=1 in /etc/default/gerritcodereview" - exit 0 - fi - - test -z "$UID" && UID=`id | sed -e 's/^[^=]*=\([0-9]*\).*/\1/'` - - RUN_ID=`date +%s`.$$ - RUN_ARGS="$RUN_ARGS --run-id=$RUN_ID" - - if test 1 = "$START_STOP_DAEMON" && type start-stop-daemon >/dev/null 2>&1 - then - test $UID = 0 && CH_USER="-c $GERRIT_USER" - if start-stop-daemon -S -b $CH_USER \ - -p "$GERRIT_PID" -m \ - -d "$GERRIT_SITE" \ - -a "$RUN_EXEC" -- $RUN_Arg1 "$RUN_Arg2" $RUN_Arg3 $RUN_ARGS - then - : OK - else - rc=$? - if test $rc = 127; then - echo >&2 "fatal: start-stop-daemon failed" - rc=1 - fi - exit $rc - fi - else - if test -f "$GERRIT_PID" ; then - if running "$GERRIT_PID" ; then - echo "Already Running!!" - exit 1 - else - rm -f "$GERRIT_PID" "$GERRIT_RUN" - fi - fi - - if test $UID = 0 -a -n "$GERRIT_USER" ; then - touch "$GERRIT_PID" - chown $GERRIT_USER "$GERRIT_PID" - su - $GERRIT_USER -c " - JAVA='$JAVA' ; export JAVA ; - $RUN_EXEC $RUN_Arg1 '$RUN_Arg2' $RUN_Arg3 $RUN_ARGS & - PID=\$! ; - disown \$PID ; - echo \$PID >\"$GERRIT_PID\"" - else - $RUN_EXEC $RUN_Arg1 "$RUN_Arg2" $RUN_Arg3 $RUN_ARGS & - PID=$! - type disown >/dev/null 2>&1 && disown $PID - echo $PID >"$GERRIT_PID" - fi - fi - - if test $UID = 0; then - PID=`cat "$GERRIT_PID"` - if test -f "/proc/${PID}/oom_score_adj" ; then - echo -1000 > "/proc/${PID}/oom_score_adj" - else - if test -f "/proc/${PID}/oom_adj" ; then - echo -16 > "/proc/${PID}/oom_adj" - fi - fi - fi - - TIMEOUT=90 # seconds - sleep 1 - while running "$GERRIT_PID" && test $TIMEOUT -gt 0 ; do - if test "x$RUN_ID" = "x`cat $GERRIT_RUN 2>/dev/null`" ; then - echo OK - exit 0 - fi - - sleep 2 - TIMEOUT=`expr $TIMEOUT - 2` - done - - echo FAILED - exit 1 - ;; - - stop) - printf '%s' "Stopping Gerrit Code Review: " - - if test 1 = "$START_STOP_DAEMON" && type start-stop-daemon >/dev/null 2>&1 - then - start-stop-daemon -K -p "$GERRIT_PID" -s HUP - sleep 1 - if running "$GERRIT_PID" ; then - sleep 3 - if running "$GERRIT_PID" ; then - sleep 30 - if running "$GERRIT_PID" ; then - start-stop-daemon -K -p "$GERRIT_PID" -s KILL - fi - fi - fi - rm -f "$GERRIT_PID" "$GERRIT_RUN" - echo OK - else - PID=`cat "$GERRIT_PID" 2>/dev/null` - TIMEOUT=30 - while running "$GERRIT_PID" && test $TIMEOUT -gt 0 ; do - kill $PID 2>/dev/null - sleep 1 - TIMEOUT=`expr $TIMEOUT - 1` - done - test $TIMEOUT -gt 0 || kill -9 $PID 2>/dev/null - rm -f "$GERRIT_PID" "$GERRIT_RUN" - echo OK - fi - ;; - - restart) - GERRIT_SH=$0 - if test -f "$GERRIT_SH" ; then - : OK - else - echo >&2 "** ERROR: Cannot locate gerrit.sh" - exit 1 - fi - $GERRIT_SH stop $* - sleep 5 - $GERRIT_SH start $* - ;; - - supervise) - # - # Under control of daemontools supervise monitor which - # handles restarts and shutdowns via the svc program. - # - exec "$RUN_EXEC" $RUN_Arg1 "$RUN_Arg2" $RUN_Arg3 $RUN_ARGS - ;; - - run|daemon) - echo "Running Gerrit Code Review:" - - if test -f "$GERRIT_PID" ; then - if running "$GERRIT_PID" ; then - echo "Already Running!!" - exit 1 - else - rm -f "$GERRIT_PID" - fi - fi - - exec "$RUN_EXEC" $RUN_Arg1 "$RUN_Arg2" $RUN_Arg3 $RUN_ARGS --console-log - ;; - - check) - echo "Checking arguments to Gerrit Code Review:" - echo " GERRIT_SITE = $GERRIT_SITE" - echo " GERRIT_CONFIG = $GERRIT_CONFIG" - echo " GERRIT_PID = $GERRIT_PID" - echo " GERRIT_WAR = $GERRIT_WAR" - echo " GERRIT_FDS = $GERRIT_FDS" - echo " GERRIT_USER = $GERRIT_USER" - echo " JAVA = $JAVA" - echo " JAVA_OPTIONS = $JAVA_OPTIONS" - echo " RUN_EXEC = $RUN_EXEC $RUN_Arg1 '$RUN_Arg2' $RUN_Arg3" - echo " RUN_ARGS = $RUN_ARGS" - echo - - if test -f "$GERRIT_PID" ; then - if running "$GERRIT_PID" ; then - echo "Gerrit running pid="`cat "$GERRIT_PID"` - exit 0 - fi - fi - exit 1 - ;; - - *) - usage - ;; -esac - -exit 0 diff --git a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/libraries.config b/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/libraries.config deleted file mode 100644 index b99267cb18..0000000000 --- a/gerrit-pgm/src/main/resources/com/google/gerrit/pgm/libraries.config +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2009 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. - - -[library "bouncyCastle"] - name = Bouncy Castle Crypto v144 - url = http://www.bouncycastle.org/download/bcprov-jdk16-144.jar - sha1 = 6327a5f7a3dc45e0fd735adb5d08c5a74c05c20c - -[library "mysqlDriver"] - name = MySQL Connector/J 5.1.10 - url = http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.10/mysql-connector-java-5.1.10.jar - sha1 = b83574124f1a00d6f70d56ba64aa52b8e1588e6d diff --git a/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/InitTestCase.java b/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/InitTestCase.java deleted file mode 100644 index 4d7370bfb7..0000000000 --- a/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/InitTestCase.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2009 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.init; - -import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; - -import java.io.File; -import java.io.IOException; - -public abstract class InitTestCase extends LocalDiskRepositoryTestCase { - protected File newSitePath() throws IOException { - return new File(createWorkRepository().getWorkTree(), "test_site"); - } -} diff --git a/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/LibrariesTest.java b/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/LibrariesTest.java deleted file mode 100644 index e7234630a6..0000000000 --- a/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/LibrariesTest.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static org.easymock.EasyMock.createStrictMock; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.SitePaths; -import com.google.inject.Provider; - -import junit.framework.TestCase; - -import java.io.File; -import java.io.FileNotFoundException; - -public class LibrariesTest extends TestCase { - public void testCreate() throws FileNotFoundException { - final SitePaths site = new SitePaths(new File(".")); - final ReloadSiteLibrary reload = createStrictMock(ReloadSiteLibrary.class); - final ConsoleUI ui = createStrictMock(ConsoleUI.class); - - replay(ui); - replay(reload); - - Libraries lib = new Libraries(new Provider() { - @Override - public LibraryDownloader get() { - return new LibraryDownloader(reload, ui, site); - } - }); - - assertNotNull(lib.bouncyCastle); - assertNotNull(lib.mysqlDriver); - - verify(ui); - verify(reload); - } -} diff --git a/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/UpgradeFrom2_0_xTest.java b/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/UpgradeFrom2_0_xTest.java deleted file mode 100644 index 493a440092..0000000000 --- a/gerrit-pgm/src/test/java/com/google/gerrit/pgm/init/UpgradeFrom2_0_xTest.java +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (C) 2009 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.init; - -import static org.easymock.EasyMock.createStrictMock; -import static org.easymock.EasyMock.eq; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import com.google.gerrit.pgm.util.ConsoleUI; -import com.google.gerrit.server.config.SitePaths; - -import org.eclipse.jgit.errors.ConfigInvalidException; -import org.eclipse.jgit.storage.file.FileBasedConfig; -import org.eclipse.jgit.util.FS; -import org.eclipse.jgit.util.IO; -import org.junit.Test; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; - - -public class UpgradeFrom2_0_xTest extends InitTestCase { - - @Test - public void testUpgrade() throws IOException, ConfigInvalidException { - final File p = newSitePath(); - final SitePaths site = new SitePaths(p); - assertTrue(site.isNew); - assertTrue(site.site_path.mkdir()); - assertTrue(site.etc_dir.mkdir()); - - for (String n : UpgradeFrom2_0_x.etcFiles) { - Writer w = new FileWriter(new File(p, n)); - try { - w.write("# " + n + "\n"); - } finally { - w.close(); - } - } - - FileBasedConfig old = - new FileBasedConfig(new File(p, "gerrit.config"), FS.DETECTED); - - old.setString("ldap", null, "username", "ldap.user"); - old.setString("ldap", null, "password", "ldap.s3kr3t"); - - old.setString("sendemail", null, "smtpUser", "email.user"); - old.setString("sendemail", null, "smtpPass", "email.s3kr3t"); - old.save(); - - final InitFlags flags = new InitFlags(site); - final ConsoleUI ui = createStrictMock(ConsoleUI.class); - Section.Factory sections = new Section.Factory() { - @Override - public Section get(String name) { - return new Section(flags, site, ui, name); - } - }; - - expect(ui.yesno(eq(true), eq("Upgrade '%s'"), eq(p.getCanonicalPath()))) - .andReturn(true); - replay(ui); - - UpgradeFrom2_0_x u = new UpgradeFrom2_0_x(site, flags, ui, sections); - assertTrue(u.isNeedUpgrade()); - u.run(); - assertFalse(u.isNeedUpgrade()); - verify(ui); - - for (String n : UpgradeFrom2_0_x.etcFiles) { - if ("gerrit.config".equals(n)) continue; - if ("secure.config".equals(n)) continue; - assertEquals("# " + n + "\n",// - new String(IO.readFully(new File(site.etc_dir, n)), "UTF-8")); - } - - FileBasedConfig cfg = new FileBasedConfig(site.gerrit_config, FS.DETECTED); - FileBasedConfig sec = new FileBasedConfig(site.secure_config, FS.DETECTED); - cfg.load(); - sec.load(); - - assertEquals("email.user", cfg.getString("sendemail", null, "smtpUser")); - assertNull(cfg.getString("sendemail", null, "smtpPass")); - assertEquals("email.s3kr3t", sec.getString("sendemail", null, "smtpPass")); - - assertEquals("ldap.user", cfg.getString("ldap", null, "username")); - assertNull(cfg.getString("ldap", null, "password")); - assertEquals("ldap.s3kr3t", sec.getString("ldap", null, "password")); - - u.run(); - } -} diff --git a/gerrit-prettify/.gitignore b/gerrit-prettify/.gitignore deleted file mode 100644 index 903c6c80f5..0000000000 --- a/gerrit-prettify/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target -/.classpath -/.project -/.settings/org.maven.ide.eclipse.prefs diff --git a/gerrit-prettify/.settings/org.eclipse.core.resources.prefs b/gerrit-prettify/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 82eb859e3b..0000000000 --- a/gerrit-prettify/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/gerrit-prettify/.settings/org.eclipse.core.runtime.prefs b/gerrit-prettify/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 8667cfd4a3..0000000000 --- a/gerrit-prettify/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Sep 02 16:59:24 PDT 2008 -eclipse.preferences.version=1 -line.separator=\n diff --git a/gerrit-prettify/.settings/org.eclipse.jdt.core.prefs b/gerrit-prettify/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 04afc7fac5..0000000000 --- a/gerrit-prettify/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,268 +0,0 @@ -#Tue May 12 17:44:13 PDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=16 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=0 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=80 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/gerrit-prettify/.settings/org.eclipse.jdt.ui.prefs b/gerrit-prettify/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index d4218a5fc0..0000000000 --- a/gerrit-prettify/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -#Wed Jul 29 11:31:38 PDT 2009 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Google Format -formatter_settings_version=11 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax; -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates= -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=true -sp_cleanup.make_parameters_final=true -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/gerrit-prettify/pom.xml b/gerrit-prettify/pom.xml deleted file mode 100644 index 3ac4deb9c9..0000000000 --- a/gerrit-prettify/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - 4.0.0 - - - com.google.gerrit - gerrit-parent - 2.2-SNAPSHOT - - - gerrit-prettify - Gerrit Code Review - Prettify - - - Prettify based syntax highlighting - - - - - gwtexpui - gwtexpui - - - - com.google.gerrit - gerrit-patch-jgit - ${project.version} - - - - com.google.gerrit - gerrit-reviewdb - ${project.version} - - - - com.google.gwt - gwt-user - provided - - - - - - - org.apache.maven.plugins - maven-source-plugin - - - - jar - - - - - - - diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/PrettyFormatter.gwt.xml b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/PrettyFormatter.gwt.xml deleted file mode 100644 index 48591f8239..0000000000 --- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/PrettyFormatter.gwt.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/ClientSideFormatter.java b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/ClientSideFormatter.java deleted file mode 100644 index 4bce954e35..0000000000 --- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/ClientSideFormatter.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2010 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.prettify.client; - -import com.google.gerrit.prettify.common.PrettyFactory; -import com.google.gerrit.prettify.common.PrettyFormatter; -import com.google.gwt.core.client.GWT; -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.user.client.ui.RootPanel; - -/** Evaluates prettify using the host browser's JavaScript engine. */ -public class ClientSideFormatter extends PrettyFormatter { - public static final PrettyFactory FACTORY = new PrettyFactory() { - @Override - public PrettyFormatter get() { - return new ClientSideFormatter(); - } - }; - - private static final PrivateScopeImpl prettify; - - static { - Resources.I.prettify_css().ensureInjected(); - Resources.I.gerrit_css().ensureInjected(); - - prettify = GWT.create(PrivateScopeImpl.class); - RootPanel.get().add(prettify); - - prettify.compile(Resources.I.core()); - prettify.compile(Resources.I.lang_css()); - prettify.compile(Resources.I.lang_hs()); - prettify.compile(Resources.I.lang_lisp()); - prettify.compile(Resources.I.lang_lua()); - prettify.compile(Resources.I.lang_ml()); - prettify.compile(Resources.I.lang_proto()); - prettify.compile(Resources.I.lang_sql()); - prettify.compile(Resources.I.lang_vb()); - prettify.compile(Resources.I.lang_wiki()); - } - - @Override - protected String prettify(String html, String type) { - return go(prettify.getContext(), html, type, diffPrefs.getTabSize()); - } - - private static native String go(JavaScriptObject ctx, String srcText, - String srcType, int tabSize) - /*-{ - ctx.PR_TAB_WIDTH = tabSize; - return ctx.prettyPrintOne(srcText, srcType); - }-*/; -} diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/PrivateScopeImpl.java b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/PrivateScopeImpl.java deleted file mode 100644 index 65ee2127cc..0000000000 --- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/PrivateScopeImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2010 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.prettify.client; - -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.resources.client.TextResource; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.NamedFrame; - -/** - * Creates a private JavaScript environment, typically inside an IFrame. - *

- * Instances must be created through {@code GWT.create(PrivateScopeImpl.class)}. - * A scope must remain attached to the primary document for its entire life. - * Behavior is undefined if a scope is detached and attached again later. It is - * best to attach the scope with {@code RootPanel.get().add(scope)} as soon as - * it has been created. - */ -public class PrivateScopeImpl extends Composite { - private static int scopeId; - - protected final String scopeName; - - public PrivateScopeImpl() { - scopeName = nextScopeName(); - - NamedFrame frame = new NamedFrame(scopeName); - frame.setUrl("javascript:''"); - initWidget(frame); - - setVisible(false); - } - - public void compile(TextResource js) { - eval(js.getText()); - } - - public void eval(String js) { - nativeEval(getContext(), js); - } - - public JavaScriptObject getContext() { - return nativeGetContext(scopeName); - } - - private static String nextScopeName() { - return "_PrivateScope" + (++scopeId); - } - - private static native void nativeEval(JavaScriptObject ctx, String js) - /*-{ ctx.eval(js); }-*/; - - private static native JavaScriptObject nativeGetContext(String scopeName) - /*-{ return $wnd[scopeName]; }-*/; -} diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/PrivateScopeImplIE6.java b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/PrivateScopeImplIE6.java deleted file mode 100644 index abb4e15812..0000000000 --- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/PrivateScopeImplIE6.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2010 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.prettify.client; - -import com.google.gwt.core.client.JavaScriptObject; - -/** IE6 requires us to initialize the document before we can use it. */ -public class PrivateScopeImplIE6 extends PrivateScopeImpl { - private JavaScriptObject context; - - @Override - protected void onAttach() { - super.onAttach(); - context = nativeInitContext(scopeName); - } - - @Override - public JavaScriptObject getContext() { - return context; - } - - private static native JavaScriptObject nativeInitContext(String scopeName) - /*-{ - var fe = $wnd[scopeName]; - fe.document.write( - '