Merge "documentation: update links from kernel.org to code.google.com"
diff --git a/Documentation/access-control.txt b/Documentation/access-control.txt
index b737ea8..42a6eae 100644
--- a/Documentation/access-control.txt
+++ b/Documentation/access-control.txt
@@ -158,13 +158,13 @@
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
+(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
+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]
@@ -175,7 +175,7 @@
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
+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
@@ -298,7 +298,7 @@
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
+for reference `refs/heads/qa/*`. Members of the QA group can
further refine access, but only for references that begin with
`refs/heads/qa/`.
@@ -314,14 +314,14 @@
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
+`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.
+`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.
@@ -349,8 +349,8 @@
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
+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]]
@@ -519,7 +519,7 @@
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
+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
@@ -594,7 +594,7 @@
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
+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`
@@ -637,7 +637,7 @@
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'`
+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.
diff --git a/Documentation/cmd-index.txt b/Documentation/cmd-index.txt
index dc4e72e..a6296b4 100644
--- a/Documentation/cmd-index.txt
+++ b/Documentation/cmd-index.txt
@@ -57,6 +57,9 @@
link:cmd-ls-projects.html[gerrit ls-projects]::
List projects visible to the caller.
+link:cmd-ls-projects.html[gerrit rename-group]::
+ Rename an account group.
+
link:cmd-set-reviewers.html[gerrit set-reviewers]::
Add or remove reviewers on a change.
@@ -64,13 +67,13 @@
Query the change database.
'gerrit receive-pack'::
- 'Depreated alias for `git receive-pack`.'
+ 'Deprecated alias for `git receive-pack`.'
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.
+ Monitor events occurring in real time.
git upload-pack::
Standard Git server side command for client side `git fetch`.
@@ -81,7 +84,7 @@
Also implements the magic associated with uploading commits for
review. See link:user-upload.html#push_create[Creating Changes].
-[[admin_commands]]Adminstrator Commands
+[[admin_commands]]Administrator Commands
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
link:cmd-create-account.html[gerrit create-account]::
diff --git a/Documentation/cmd-ls-projects.txt b/Documentation/cmd-ls-projects.txt
index 0332c69..e6ef00c 100644
--- a/Documentation/cmd-ls-projects.txt
+++ b/Documentation/cmd-ls-projects.txt
@@ -41,6 +41,14 @@
If the user does not have access to any branch in the project then the
whole project is not shown.
+--description::
+--d::
+ Allows listing of projects together with their respective
+ description.
+
+ Line-feeds are escaped to allow ls-project to keep the
+ "one project per line"-style.
+
--tree::
-t::
Displays project inheritance in a tree-like format.
diff --git a/Documentation/cmd-rename-group.txt b/Documentation/cmd-rename-group.txt
new file mode 100644
index 0000000..e810727
--- /dev/null
+++ b/Documentation/cmd-rename-group.txt
@@ -0,0 +1,46 @@
+gerrit rename-group
+===================
+
+NAME
+----
+gerrit rename-group - Rename an account group.
+
+SYNOPSIS
+--------
+[verse]
+'ssh' -p <port> <host> 'gerrit rename-group'
+ <GROUP>
+ <NEWNAME>
+
+DESCRIPTION
+-----------
+Renames an account group.
+
+ACCESS
+------
+Caller must be a member of the group owning the group to be renamed
+or be a member of the privileged 'Administrators' group.
+
+SCRIPTING
+---------
+This command is intended to be used in scripts.
+
+OPTIONS
+-------
+<GROUP>::
+ Required; name of the group to be renamed.
+
+<NEWNAME>::
+ Required; new name of the group.
+
+EXAMPLES
+--------
+Rename the group "MyGroup" to "MyCommitters".
+
+====
+ $ ssh -p 29418 user@review.example.com gerrit rename-group MyGroup MyCommitters
+====
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/cmd-show-queue.txt b/Documentation/cmd-show-queue.txt
index 1e97f48..98a954e 100644
--- a/Documentation/cmd-show-queue.txt
+++ b/Documentation/cmd-show-queue.txt
@@ -41,7 +41,7 @@
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
+ Task identifiers have a period of 2^32-1, and start from
a random value.
State::
diff --git a/Documentation/cmd-stream-events.txt b/Documentation/cmd-stream-events.txt
index bd23baa..bf78051 100644
--- a/Documentation/cmd-stream-events.txt
+++ b/Documentation/cmd-stream-events.txt
@@ -3,7 +3,7 @@
NAME
----
-gerrit stream-events - Monitor events occuring in real time
+gerrit stream-events - Monitor events occurring in real time
SYNOPSIS
--------
@@ -13,7 +13,7 @@
DESCRIPTION
-----------
-Provides a portal into the major events occuring on the server,
+Provides a portal into the major events occurring 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
diff --git a/Documentation/config-contact.txt b/Documentation/config-contact.txt
index d84a499..5c633cf 100644
--- a/Documentation/config-contact.txt
+++ b/Documentation/config-contact.txt
@@ -69,7 +69,7 @@
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.
+ships the data to another HTTP server, preferably over HTTPS.
Existing open-source server implementations can be found in the
gerrit-contactstore project.
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index 66c8863..d2a7fbc 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -70,7 +70,7 @@
* `HTTP`
+
Gerrit relies upon data presented in the HTTP request. This includes
-HTTP basic authentication, or some types of commerical single-sign-on
+HTTP basic authentication, or some types of commercial 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.
@@ -985,7 +985,7 @@
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"`.
+the path string `"${basePath}/${project_name}.git"`.
+
If relative, the path is resolved relative to `'$site_path'`.
@@ -1063,23 +1063,23 @@
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.
+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.
+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.
+Valid replacements are `${project}` for the project name in Gerrit
+and `${branch}` for the name of the branch.
[[hooks]]Section hooks
@@ -1141,7 +1141,7 @@
[[httpd.listenUrl]]httpd.listenUrl::
+
Specifies the URLs the internal HTTP daemon should listen for
-connections on. The special hostname '\*' may be used to listen
+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.
@@ -1391,17 +1391,17 @@
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
+`${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 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
+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,
+Default is `(uid=${username})` for RFC 2307 servers,
and `(&(objectClass=user)(sAMAccountName=${username}))`
for Active Directory.
@@ -1414,7 +1414,7 @@
+
Attribute values may be concatenated with literal strings, for
example to join given name and surname together use the pattern
-`$\{givenName\} $\{SN\}`.
+`${givenName} ${SN}`.
+
If set, users will be unable to modify their full name field, as
Gerrit will populate it only from the LDAP data.
@@ -1431,7 +1431,7 @@
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`.
+`${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,
@@ -1449,12 +1449,12 @@
SSH clients will default to.
+
Attribute values may also be forced to lowercase, or to uppercase in
-an expression. For example, `$\{sAMAccountName.toLowerCase\}` will
+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'.
+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.
@@ -1492,11 +1492,11 @@
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
+`${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.
+Default is `(cn=${groupname})` for RFC 2307,
+and `(&(objectClass=group)(cn=${groupname}))` for Active Directory.
[[ldap.groupMemberPattern]]ldap.groupMemberPattern::
+
@@ -1504,15 +1504,15 @@
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
+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
+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.
+Attributes such as `${dn}` or `${uidNumber}` may be useful.
+
-Default is `(memberUid=$\{username\})` for RFC 2307,
+Default is `(memberUid=${username})` for RFC 2307,
and unset (disabled) for Active Directory.
@@ -1524,8 +1524,8 @@
If set to true, files with the MIME type `<name>` 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.
+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.
@@ -1638,7 +1638,7 @@
+
* `MIXED`
+
-Shorthand for `$\{user\} (Code Review) <review@example.com>` where
+Shorthand for `${user} (Code Review) <review@example.com>` where
`review@example.com` is the same as <<user.email,user.email>>.
See below for a description of how the replacement is handled.
+
@@ -1654,7 +1654,7 @@
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\}`,
+Optionally, the name portion may contain the placeholder `${user}`,
which is replaced by the Full Name of the current user.
+
@@ -1737,7 +1737,7 @@
* '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`)
+* *:'port' (for example `*:29418`)
+
If multiple values are supplied, the daemon will listen on all
@@ -1812,7 +1812,7 @@
+
By default, 1 plus the number of CPUs available to the JVM.
-[sshd.commandStartThreads]]sshd.commandStartThreads::
+[[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
@@ -2068,6 +2068,13 @@
+
By default, not set, generating the value at startup.
+[[user.anonymousCoward]]user.anonymousCoward::
++
+Username that this displayed in the Gerrit WebUI and in e-mail
+notifications if the full name of the user is not set.
++
+By default "Anonymous Coward" is used.
+
File `etc/secure.config`
-------------------------
diff --git a/Documentation/config-hooks.txt b/Documentation/config-hooks.txt
index 963b628..ceb7c78 100644
--- a/Documentation/config-hooks.txt
+++ b/Documentation/config-hooks.txt
@@ -11,7 +11,7 @@
Make sure your hook scripts are executable if running on *nix.
-Hooks are run in the background after the relevent change has
+Hooks are run in the background after the relevant change has
taken place so are unable to affect the outcome of any given
change. Because of the fact the hooks are run in the background
after the activity, a hook might not be notified about an event if
@@ -100,7 +100,7 @@
-------------------
If link:config-gerrit.html#gerrit.canonicalWebUrl[gerrit.canonicalWebUrl]
-is not set in `gerrit.config` the `\--change-url` flag may not be
+is not set in `gerrit.config` the `--change-url` flag may not be
passed to all hooks. Hooks started out of an SSH context (for example
the patchset-created hook) don't know the server's web URL, unless
this variable is configured.
diff --git a/Documentation/config-replication.txt b/Documentation/config-replication.txt
index 3768b6d..3390a4f 100644
--- a/Documentation/config-replication.txt
+++ b/Documentation/config-replication.txt
@@ -84,7 +84,7 @@
threads in the thread pool, Gerrit pushes to all URLs in parallel,
using one thread per URL.
+
-Within each URL value the magic placeholder `$\{name}` is replaced
+Within each URL value the magic placeholder `${name}` is replaced
with the Gerrit project name. This is a Gerrit specific extension
to the otherwise standard Git URL syntax and it must be included
in each URL so that Gerrit can figure out where each project needs
@@ -123,16 +123,16 @@
[[remote.name.push]]remote.<name>.push::
+
Standard Git refspec denoting what should be replicated. Setting this
-to `+refs/heads/\*:refs/heads/\*` would mirror only the active
+to `+refs/heads/*:refs/heads/*` would mirror only the active
branches, but not the change refs under `refs/changes/`, or the tags
under `refs/tags/`.
+
Multiple push keys can be supplied, to specify multiple patterns
to match against. In the example file above, remote "pubmirror"
-uses two push keys to match both `refs/heads/\*` and `refs/tags/*`,
+uses two push keys to match both `refs/heads/*` and `refs/tags/*`,
but excludes all others, including `refs/changes/*`.
+
-Defaults to `+refs/\*:refs/*` (all refs) if not specified.
+Defaults to `+refs/*:refs/*` (all refs) if not specified.
[[remote.name.timeout]]remote.<name>.timeout::
+
diff --git a/Documentation/config-sso.txt b/Documentation/config-sso.txt
index 37f5b05..9aa06be 100644
--- a/Documentation/config-sso.txt
+++ b/Documentation/config-sso.txt
@@ -88,7 +88,7 @@
standard `Authorization` HTTP header.
The auth.emailFormat field ('optional') sets the preferred email
-address during first login. Gerrit will replace `\{0\}` with the
+address during first login. Gerrit will replace `{0}` with the
username, as obtained from the Authorization header. A format such
as shown in the example would be typical, to add the domain name
of the organization.
@@ -152,7 +152,7 @@
single sign-on or security group to ensure the setting is correct.
The auth.emailFormat field ('optional') sets the user's preferred
-email address when they first login. Gerrit will replace `\{0\}`
+email address when they first login. Gerrit will replace `{0}`
with the username, as supplied by Siteminder. A format such as
shown in the example would be typical, to add the domain name of
the organization.
diff --git a/Documentation/dev-design.txt b/Documentation/dev-design.txt
index 30826d8..7bb0b8c 100644
--- a/Documentation/dev-design.txt
+++ b/Documentation/dev-design.txt
@@ -113,7 +113,7 @@
After a change has been scored positively by reviewers, Gerrit
enables a submit button on the web interface. Authorized users
can push the submit button to have the change enter the project
-repository. The equivilant in Subversion or Perforce would be
+repository. The equivalent in Subversion or Perforce would be
that Gerrit is invoking `svn commit` or `p4 submit` on behalf of
the web user pressing the button. Due to the way Git audit trails
are maintained, the user pressing the submit button does not need
diff --git a/Documentation/error-you-are-not-author.txt b/Documentation/error-you-are-not-author.txt
index 47a7652..5613a10 100644
--- a/Documentation/error-you-are-not-author.txt
+++ b/Documentation/error-you-are-not-author.txt
@@ -95,7 +95,7 @@
you have to amend the commit with explicitly setting the author
before continuing the rebase.
-Here is an exmaple that shows how the interactive rebase is used to
+Here is an example that shows how the interactive rebase is used to
update the author for the last 3 commits:
----
diff --git a/Documentation/i18n-readme.txt b/Documentation/i18n-readme.txt
index 74a8e49..080ecb6 100644
--- a/Documentation/i18n-readme.txt
+++ b/Documentation/i18n-readme.txt
@@ -12,7 +12,7 @@
The getName() function produces only a single translation of the
description string. This name is set by the Gerrit administrator,
which may cause problems if the site is translated into multiple
-langauges and different users want different translations.
+languages and different users want different translations.
ApprovalCategoryValue
---------------------
@@ -20,7 +20,7 @@
The getName() function produces only a single translation of the
description string. This name is set by the Gerrit administrator,
which may cause problems if the site is translated into multiple
-langauges and different users want different translations.
+languages and different users want different translations.
/Gerrit Gerrit.html
-------------------
diff --git a/Documentation/install-j2ee.txt b/Documentation/install-j2ee.txt
index d51ba68..507d6c5 100644
--- a/Documentation/install-j2ee.txt
+++ b/Documentation/install-j2ee.txt
@@ -11,7 +11,7 @@
Gerrit Code Review can be installed into any J2EE servlet container,
including popular open source containers such as Jetty or Tomcat, or
-any commerical server which supports the J2EE servlet specification.
+any commercial server which supports the J2EE servlet specification.
Installation
diff --git a/Documentation/pgm-ExportReviewNotes.txt b/Documentation/pgm-ExportReviewNotes.txt
index 602c245..17cc862 100644
--- a/Documentation/pgm-ExportReviewNotes.txt
+++ b/Documentation/pgm-ExportReviewNotes.txt
@@ -26,7 +26,7 @@
-d::
\--site-path::
Location of the gerrit.config file, and all other per-site
- configuration data, supporting libaries and log files.
+ configuration data, supporting libraries and log files.
\--threads::
Number of threads to perform the scan work with. Default: 2.
diff --git a/Documentation/pgm-ScanTrackingIds.txt b/Documentation/pgm-ScanTrackingIds.txt
index 4ab4a02..ea5d72e 100644
--- a/Documentation/pgm-ScanTrackingIds.txt
+++ b/Documentation/pgm-ScanTrackingIds.txt
@@ -26,7 +26,7 @@
-d::
\--site-path::
Location of the gerrit.config file, and all other per-site
- configuration data, supporting libaries and log files.
+ configuration data, supporting libraries and log files.
\--threads::
Number of threads to perform the scan work with. Defaults to
diff --git a/Documentation/pgm-daemon.txt b/Documentation/pgm-daemon.txt
index 0b2e72f..1c1d343 100644
--- a/Documentation/pgm-daemon.txt
+++ b/Documentation/pgm-daemon.txt
@@ -33,7 +33,7 @@
-d::
\--site-path::
Location of the gerrit.config file, and all other per-site
- configuration data, supporting libaries and log files.
+ configuration data, supporting libraries and log files.
\--enable-httpd::
\--disable-httpd::
@@ -48,7 +48,7 @@
\--slave::
Run in slave mode, permitting only read operations
by clients. Commands which modify state such as
- link:cmd-receive-pack.html[recieve-pack] (creates new changes
+ link:cmd-receive-pack.html[receive-pack] (creates new changes
or updates existing ones) or link:cmd-review.html[review]
(sets approve marks) are disabled.
+
diff --git a/Documentation/pgm-gsql.txt b/Documentation/pgm-gsql.txt
index 938aafd..c3a492a 100644
--- a/Documentation/pgm-gsql.txt
+++ b/Documentation/pgm-gsql.txt
@@ -26,7 +26,7 @@
-d::
\--site-path::
Location of the gerrit.config file, and all other per-site
- configuration data, supporting libaries and log files.
+ configuration data, supporting libraries and log files.
CONTEXT
-------
diff --git a/Documentation/pgm-init.txt b/Documentation/pgm-init.txt
index d3094fd..c53c57d 100644
--- a/Documentation/pgm-init.txt
+++ b/Documentation/pgm-init.txt
@@ -31,14 +31,14 @@
\--no-auto-start::
Don't automatically start the daemon after initializing a
- newly created site path. This permits the administartor
+ newly created site path. This permits the administrator
to inspect and modify the configuration before the daemon
is started.
-d::
\--site-path::
Location of the gerrit.config file, and all other per-site
- configuration data, supporting libaries and log files.
+ configuration data, supporting libraries and log files.
CONTEXT
-------
diff --git a/Documentation/pgm-rulec.txt b/Documentation/pgm-rulec.txt
index 40aad2d..6d0a632 100644
--- a/Documentation/pgm-rulec.txt
+++ b/Documentation/pgm-rulec.txt
@@ -21,7 +21,7 @@
-d::
--site-path::
Location of the gerrit.config file, and all other per-site
- configuration data, supporting libaries and log files.
+ configuration data, supporting libraries and log files.
--all::
Compile rules for all projects.
diff --git a/Documentation/project-setup.txt b/Documentation/project-setup.txt
index 9e4f556..8eb1ae4 100644
--- a/Documentation/project-setup.txt
+++ b/Documentation/project-setup.txt
@@ -68,20 +68,19 @@
* Merge If Necessary
+
-This is the default for a new project (and why `\'M'` is suggested
-above in the insert statement).
+This is the default for a new project.
+
If the change being submitted is a strict superset of the destination
branch, then the branch is fast-forwarded to the change. If not,
then a merge commit is automatically created. This is identical
-to the classical `git merge` behavior, or `git merge \--ff`.
+to the classical `git merge` behavior, or `git merge --ff`.
* Always Merge
+
Always produce a merge commit, even if the change is a strict
superset of the destination branch. This is identical to the
-behavior of `git merge \--no-ff`, and may be useful if the
-project needs to follow submits with `git log \--first-parent`.
+behavior of `git merge --no-ff`, and may be useful if the
+project needs to follow submits with `git log --first-parent`.
* Cherry Pick
+
@@ -100,6 +99,11 @@
the right order since inter-change dependencies will not be
enforced for them.
+When Gerrit tries to do a merge, by default the merge will only
+succeed if there is no path conflict. By selecting the checkbox
+`Automatically resolve conflicts` Gerrit will try do a content merge
+if a path conflict occurs.
+
Registering Additional Branches
-------------------------------
diff --git a/Documentation/user-changeid.txt b/Documentation/user-changeid.txt
index 1fa627c..124ec31 100644
--- a/Documentation/user-changeid.txt
+++ b/Documentation/user-changeid.txt
@@ -57,7 +57,7 @@
Change Upload
--------------
-During upload by pushing to a `refs/for/\*` or `refs/heads/\*`
+During upload by pushing to a `refs/for/*` or `refs/heads/*`
branch, Gerrit will use the Change-Id line to:
* Create a new change
@@ -103,7 +103,7 @@
Amending a commit
~~~~~~~~~~~~~~~~~
-When amending a commit with `git commit \--amend`, leave the
+When amending a commit with `git commit --amend`, leave the
Change-Id line unmodified in the commit message. This will allow
Gerrit to automatically update the change with the amended commit.
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index ba031db..6a6ce16 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -100,7 +100,7 @@
[[project]]
project:'PROJECT'::
+
-Changes occuring in 'PROJECT'. If 'PROJECT' starts with `^` it
+Changes occurring in 'PROJECT'. If 'PROJECT' starts with `^` it
matches project names by regular expression. The
link:http://www.brics.dk/automaton/[dk.brics.automaton
library] is used for evaluation of such patterns.
@@ -181,11 +181,11 @@
anchoring the match to the start of the string. To match all Java
files, use `file:^.*\.java`.
+
-The entire regular expression pattern, including the `\^` character,
+The entire regular expression pattern, including the `^` character,
should be double quoted when using more complex construction (like
ones using a bracket expression). For example, to match all XML
files named like 'name1.xml', 'name2.xml', and 'name3.xml' use
-`\file:"\^name[1-3].xml"`.
+`file:"^name[1-3].xml"`.
+
Currently this operator is only available on a watched project
and may not be used in the search bar.
@@ -314,8 +314,8 @@
`label:CodeReview=+2`::
`label:CodeReview+2`::
+
-Matches changes where there is at least one \+2 score for Code Review.
-The \+ prefix is optional for positive score values. If the + is used,
+Matches changes where there is at least one +2 score for Code Review.
+The + prefix is optional for positive score values. If the + is used,
the = operator is optional.
`label:CodeReview=-2`::
diff --git a/Documentation/user-upload.txt b/Documentation/user-upload.txt
index 8a08317..eb79d94 100644
--- a/Documentation/user-upload.txt
+++ b/Documentation/user-upload.txt
@@ -15,7 +15,8 @@
Each user uploading changes to Gerrit must configure one or more SSH
public keys. The per-user SSH key list can be accessed over the web
-within Gerrit by `Settings`, and then accessing the `SSH Keys` tab.
+within Gerrit by `Settings`, and then accessing the `SSH Public Keys`
+tab.
[[configure_ssh]]
Configuration
@@ -60,14 +61,25 @@
port 29418, using the same hostname as the web server:
====
+..................................................................
$ ssh -p 29418 sshusername@hostname
- gerrit: no shell available
+
+ **** Welcome to Gerrit Code Review ****
+
+ Hi John Doe, you have successfully connected over SSH.
+
+ Unfortunately, interactive shells are disabled.
+ To clone a hosted Git repository, use:
+
+ git clone ssh://sshusername@hostname:29418/REPOSITORY_NAME.git
+
Connection to hostname closed.
+..................................................................
====
-In the command above, `sshusername` was configured on the `SSH Keys`
-tab of the `Settings` screen. If it is not set, propose a name
-and use `Change Username` to select the name.
+In the command above, `sshusername` was configured as `Username` on
+the `Profile` tab of the `Settings` screen. If it is not set,
+propose a name and use `Select Username` to select the name.
To determine the port number Gerrit is running on, visit the special
information URL `http://'hostname'/ssh_info`, and copy the port
@@ -142,15 +154,15 @@
$ git push tr:kernel/common HEAD:refs/for/experimental
====
-Specific reviewers can be requested and/or additional ``carbon
-copies'' of the notification message may be sent by including these
+Specific reviewers can be requested and/or additional 'carbon
+copies' of the notification message may be sent by including these
as arguments to `git receive-pack`:
====
git push --receive-pack='git receive-pack --reviewer=a@a.com --cc=b@o.com' tr:kernel/common HEAD:refs/for/experimental
====
-The `\--reviewer='email'` and `\--cc='email'` options may be
+The `--reviewer='email'` and `--cc='email'` options may be
specified as many times as necessary to cover all interested
parties. Gerrit will automatically avoid sending duplicate email
notifications, such as if one of the specified reviewers or CC
@@ -323,7 +335,7 @@
~~~~~~~~~~~~~~~
To replace changes, ensure Change-Id lines were created in the
-commit messages, and just use `repo upload` without the `\--replace`
+commit messages, and just use `repo upload` without the `--replace`
command line flag. Gerrit Code Review will automatically match
the commits back to their original changes by taking advantage of
their Change-Id lines.
@@ -333,7 +345,7 @@
on the web.
If Change-Id lines are not available, then the user must use the much
-more manual mapping technique offered by `repo upload \--replace`.
+more manual mapping technique offered by `repo upload --replace`.
For more about Change-Ids, see link:user-changeid.html[Change-Id Lines].
@@ -345,8 +357,8 @@
own process space, Gerrit maintains complete control over how the
repository is updated, and what responses are sent to the `git push`
client invoked by the end-user, or by `repo upload`. This allows
-Gerrit to provide magical refs, such as `refs/for/\*` for new
-change submission and `refs/changes/\*` for change replacement.
+Gerrit to provide magical refs, such as `refs/for/*` for new
+change submission and `refs/changes/*` for change replacement.
When a push request is received to create a ref in one of these
namespaces Gerrit performs its own logic to update the database,
and then lies to the client about the result of the operation.
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java
index 0ef68df..38f8fdd 100644
--- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java
+++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java
@@ -42,6 +42,7 @@
protected List<RegexFindReplace> commentLinks;
protected boolean documentationAvailable;
protected boolean testChangeMerge;
+ protected String anonymousCowardName;
public String getRegisterUrl() {
return registerUrl;
@@ -169,4 +170,12 @@
public void setTestChangeMerge(final boolean test) {
testChangeMerge = test;
}
+
+ public String getAnonymousCowardName() {
+ return anonymousCowardName;
+ }
+
+ public void setAnonymousCowardName(final String anonymousCowardName) {
+ this.anonymousCowardName = anonymousCowardName;
+ }
}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java
index c915d1e..16a2d35 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java
@@ -109,7 +109,7 @@
public static String nameEmail(final AccountInfo acct) {
String name = acct.getFullName();
if (name == null) {
- name = Gerrit.C.anonymousCoward();
+ name = Gerrit.getConfig().getAnonymousCowardName();
}
final StringBuilder b = new StringBuilder();
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.java
index b4293dc..f2a3d3e 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.java
@@ -82,7 +82,6 @@
String searchButton();
String rpcStatusLoading();
- String anonymousCoward();
String sectionNavigation();
String sectionActions();
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.properties
index 7b06788..3880f59 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.properties
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.properties
@@ -65,7 +65,6 @@
searchButton = Search
rpcStatusLoading = Loading ...
-anonymousCoward = Anonymous Coward
sectionNavigation = Navigation
sectionActions = Actions
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupInfoScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupInfoScreen.java
index ab4ab7f..5ce90e7 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupInfoScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupInfoScreen.java
@@ -130,6 +130,7 @@
new GerritCallback<GroupDetail>() {
public void onSuccess(final GroupDetail groupDetail) {
saveName.setEnabled(false);
+ setPageTitle(Util.M.group(groupDetail.group.getName()));
display(groupDetail);
}
});
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java
index 406333b..dbbaf33 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java
@@ -44,8 +44,6 @@
import com.google.gwt.user.client.ui.Label;
import com.google.gwtjsonrpc.client.RemoteJsonException;
-import org.eclipse.jgit.lib.Constants;
-
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -318,7 +316,7 @@
String iconCellStyle = Gerrit.RESOURCES.css().iconCell();
String dataCellStyle = Gerrit.RESOURCES.css().dataCell();
if ("refs/meta/config".equals(k.getShortName())
- || Constants.HEAD.equals(k.getShortName())) {
+ || "HEAD".equals(k.getShortName())) {
iconCellStyle = Gerrit.RESOURCES.css().specialBranchIconCell();
dataCellStyle = Gerrit.RESOURCES.css().specialBranchDataCell();
fmt.setStyleName(row, 0, iconCellStyle);
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
index 60486ac..fe2ace1 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java
@@ -20,6 +20,7 @@
import com.google.gerrit.reviewdb.Account;
import com.google.gerrit.server.account.Realm;
import com.google.gerrit.server.config.AllProjectsName;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.config.AuthConfig;
import com.google.gerrit.server.config.DownloadSchemeConfig;
import com.google.gerrit.server.config.GerritServerConfig;
@@ -56,13 +57,14 @@
private EmailSender emailSender;
private final ContactStore contactStore;
private final ServletContext servletContext;
+ private final String anonymousCowardName;
@Inject
GerritConfigProvider(final Realm r, @GerritServerConfig final Config gsc,
- final AuthConfig ac, final GitWebConfig gwc,
- final AllProjectsName wp, final SshInfo si,
- final ApprovalTypes at, final ContactStore cs, final ServletContext sc,
- final DownloadSchemeConfig dc) {
+ final AuthConfig ac, final GitWebConfig gwc, final AllProjectsName wp,
+ final SshInfo si, final ApprovalTypes at, final ContactStore cs,
+ final ServletContext sc, final DownloadSchemeConfig dc,
+ final @AnonymousCowardName String acn) {
realm = r;
cfg = gsc;
authConfig = ac;
@@ -73,6 +75,7 @@
approvalTypes = at;
contactStore = cs;
servletContext = sc;
+ anonymousCowardName = acn;
}
@Inject(optional = true)
@@ -104,6 +107,7 @@
.getResource("/Documentation/index.html") != null);
config.setTestChangeMerge(cfg.getBoolean("changeMerge",
"test", false));
+ config.setAnonymousCowardName(anonymousCowardName);
final Set<Account.FieldName> fields = new HashSet<Account.FieldName>();
for (final Account.FieldName n : Account.FieldName.values()) {
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/RenameGroup.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/RenameGroup.java
index d7cd195..2d7770e 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/RenameGroup.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/account/RenameGroup.java
@@ -19,51 +19,25 @@
import com.google.gerrit.common.errors.NoSuchGroupException;
import com.google.gerrit.httpd.rpc.Handler;
import com.google.gerrit.reviewdb.AccountGroup;
-import com.google.gerrit.reviewdb.AccountGroupName;
-import com.google.gerrit.reviewdb.ReviewDb;
-import com.google.gerrit.server.IdentifiedUser;
-import com.google.gerrit.server.account.GroupCache;
-import com.google.gerrit.server.account.GroupControl;
-import com.google.gerrit.server.account.GroupDetailFactory;
-import com.google.gerrit.server.git.RenameGroupOp;
-import com.google.gwtorm.client.OrmDuplicateKeyException;
+import com.google.gerrit.server.account.PerformRenameGroup;
import com.google.gwtorm.client.OrmException;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
-import java.util.Collections;
-import java.util.Date;
-import java.util.TimeZone;
-import java.util.concurrent.TimeUnit;
-
class RenameGroup extends Handler<GroupDetail> {
interface Factory {
RenameGroup create(AccountGroup.Id id, String newName);
}
- private final ReviewDb db;
- private final GroupCache groupCache;
- private final GroupControl.Factory groupControlFactory;
- private final GroupDetailFactory.Factory groupDetailFactory;
- private final RenameGroupOp.Factory renameGroupOpFactory;
- private final IdentifiedUser currentUser;
+ private final PerformRenameGroup.Factory performRenameGroupFactory;
private final AccountGroup.Id groupId;
private final String newName;
@Inject
- RenameGroup(final ReviewDb db, final GroupCache groupCache,
- final GroupControl.Factory groupControlFactory,
- final GroupDetailFactory.Factory groupDetailFactory,
- final RenameGroupOp.Factory renameGroupOpFactory,
- final IdentifiedUser currentUser,
+ RenameGroup(final PerformRenameGroup.Factory performRenameGroupFactory,
@Assisted final AccountGroup.Id groupId, @Assisted final String newName) {
- this.db = db;
- this.groupCache = groupCache;
- this.groupControlFactory = groupControlFactory;
- this.groupDetailFactory = groupDetailFactory;
- this.renameGroupOpFactory = renameGroupOpFactory;
- this.currentUser = currentUser;
+ this.performRenameGroupFactory = performRenameGroupFactory;
this.groupId = groupId;
this.newName = newName;
}
@@ -71,46 +45,6 @@
@Override
public GroupDetail call() throws OrmException, NameAlreadyUsedException,
NoSuchGroupException {
- final GroupControl ctl = groupControlFactory.validateFor(groupId);
- final AccountGroup group = db.accountGroups().get(groupId);
- if (group == null || !ctl.isOwner()) {
- throw new NoSuchGroupException(groupId);
- }
-
- final AccountGroup.NameKey old = group.getNameKey();
- final AccountGroup.NameKey key = new AccountGroup.NameKey(newName);
-
- try {
- final AccountGroupName id = new AccountGroupName(key, groupId);
- db.accountGroupNames().insert(Collections.singleton(id));
- } catch (OrmDuplicateKeyException dupeErr) {
- // If we are using this identity, don't report the exception.
- //
- AccountGroupName other = db.accountGroupNames().get(key);
- if (other != null && other.getId().equals(groupId)) {
- return groupDetailFactory.create(groupId).call();
- }
-
- // Otherwise, someone else has this identity.
- //
- throw new NameAlreadyUsedException();
- }
-
- group.setNameKey(key);
- db.accountGroups().update(Collections.singleton(group));
-
- AccountGroupName priorName = db.accountGroupNames().get(old);
- if (priorName != null) {
- db.accountGroupNames().delete(Collections.singleton(priorName));
- }
-
- groupCache.evict(group);
- groupCache.evictAfterRename(old);
- renameGroupOpFactory.create( //
- currentUser.newCommitterIdent(new Date(), TimeZone.getDefault()), //
- group.getGroupUUID(), //
- old.get(), newName).start(0, TimeUnit.MILLISECONDS);
-
- return groupDetailFactory.create(groupId).call();
+ return performRenameGroupFactory.create().renameGroup(groupId, newName);
}
}
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Project.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Project.java
index b9a6967..b0e7fa5 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Project.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/Project.java
@@ -180,4 +180,8 @@
public void setParentName(String n) {
parent = n != null ? new NameKey(n) : null;
}
+
+ public void setParentName(NameKey n) {
+ parent = n;
+ }
}
diff --git a/gerrit-reviewdb/src/main/resources/com/google/gerrit/reviewdb/mysql_nextval.sql b/gerrit-reviewdb/src/main/resources/com/google/gerrit/reviewdb/mysql_nextval.sql
index aee1021..2479010 100644
--- a/gerrit-reviewdb/src/main/resources/com/google/gerrit/reviewdb/mysql_nextval.sql
+++ b/gerrit-reviewdb/src/main/resources/com/google/gerrit/reviewdb/mysql_nextval.sql
@@ -9,7 +9,6 @@
MODIFIES SQL DATA
BEGIN
INSERT INTO account_id (s) VALUES (NULL);
- DELETE FROM account_id WHERE s = LAST_INSERT_ID();
RETURN LAST_INSERT_ID();
END;
//
diff --git a/gerrit-server/src/main/java/com/google/gerrit/common/ChangeHookRunner.java b/gerrit-server/src/main/java/com/google/gerrit/common/ChangeHookRunner.java
index 0a7337a..b146d2f 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/common/ChangeHookRunner.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/common/ChangeHookRunner.java
@@ -27,6 +27,7 @@
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.AccountCache;
import com.google.gerrit.server.account.AccountState;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.events.ApprovalAttribute;
@@ -107,6 +108,8 @@
/** Filename of the cla signed hook. */
private final File claSignedHook;
+ private final String anonymousCowardName;
+
/** Repository Manager. */
private final GitRepositoryManager repoManager;
@@ -133,11 +136,12 @@
@Inject
public ChangeHookRunner(final WorkQueue queue,
final GitRepositoryManager repoManager,
- @GerritServerConfig final Config config, final SitePaths sitePath,
- final ProjectCache projectCache,
- final AccountCache accountCache,
- final ApprovalTypes approvalTypes,
+ final @GerritServerConfig Config config,
+ final @AnonymousCowardName String anonymousCowardName,
+ final SitePaths sitePath, final ProjectCache projectCache,
+ final AccountCache accountCache, final ApprovalTypes approvalTypes,
final EventFactory eventFactory) {
+ this.anonymousCowardName = anonymousCowardName;
this.repoManager = repoManager;
this.hookQueue = queue.createQueue(1, "hook");
this.projectCache = projectCache;
@@ -465,14 +469,14 @@
*/
private String getDisplayName(final Account account) {
if (account != null) {
- String result = (account.getFullName() == null) ? "Anonymous Coward" : account.getFullName();
+ String result = (account.getFullName() == null) ? anonymousCowardName : account.getFullName();
if (account.getPreferredEmail() != null) {
result += " (" + account.getPreferredEmail() + ")";
}
return result;
}
- return "Anonymous Coward";
+ return anonymousCowardName;
}
/**
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/IdentifiedUser.java b/gerrit-server/src/main/java/com/google/gerrit/server/IdentifiedUser.java
index 722e3d7..6828e18 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/IdentifiedUser.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/IdentifiedUser.java
@@ -26,6 +26,7 @@
import com.google.gerrit.server.account.CapabilityControl;
import com.google.gerrit.server.account.GroupIncludeCache;
import com.google.gerrit.server.account.Realm;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.config.AuthConfig;
import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.gwtorm.client.OrmException;
@@ -66,6 +67,7 @@
public static class GenericFactory {
private final CapabilityControl.Factory capabilityControlFactory;
private final AuthConfig authConfig;
+ private final String anonymousCowardName;
private final Provider<String> canonicalUrl;
private final Realm realm;
private final AccountCache accountCache;
@@ -75,11 +77,13 @@
GenericFactory(
CapabilityControl.Factory capabilityControlFactory,
final AuthConfig authConfig,
+ final @AnonymousCowardName String anonymousCowardName,
final @CanonicalWebUrl Provider<String> canonicalUrl,
final Realm realm, final AccountCache accountCache,
final GroupIncludeCache groupIncludeCache) {
this.capabilityControlFactory = capabilityControlFactory;
this.authConfig = authConfig;
+ this.anonymousCowardName = anonymousCowardName;
this.canonicalUrl = canonicalUrl;
this.realm = realm;
this.accountCache = accountCache;
@@ -92,15 +96,15 @@
public IdentifiedUser create(Provider<ReviewDb> db, Account.Id id) {
return new IdentifiedUser(capabilityControlFactory, AccessPath.UNKNOWN,
- authConfig, canonicalUrl, realm, accountCache, groupIncludeCache,
- null, db, id);
+ authConfig, anonymousCowardName, canonicalUrl, realm, accountCache,
+ groupIncludeCache, null, db, id);
}
public IdentifiedUser create(AccessPath accessPath,
Provider<SocketAddress> remotePeerProvider, Account.Id id) {
return new IdentifiedUser(capabilityControlFactory, accessPath,
- authConfig, canonicalUrl, realm, accountCache, groupIncludeCache,
- remotePeerProvider, null, id);
+ authConfig, anonymousCowardName, canonicalUrl, realm, accountCache,
+ groupIncludeCache, remotePeerProvider, null, id);
}
}
@@ -114,6 +118,7 @@
public static class RequestFactory {
private final CapabilityControl.Factory capabilityControlFactory;
private final AuthConfig authConfig;
+ private final String anonymousCowardName;
private final Provider<String> canonicalUrl;
private final Realm realm;
private final AccountCache accountCache;
@@ -126,6 +131,7 @@
RequestFactory(
CapabilityControl.Factory capabilityControlFactory,
final AuthConfig authConfig,
+ final @AnonymousCowardName String anonymousCowardName,
final @CanonicalWebUrl Provider<String> canonicalUrl,
final Realm realm, final AccountCache accountCache,
final GroupIncludeCache groupIncludeCache,
@@ -134,6 +140,7 @@
final Provider<ReviewDb> dbProvider) {
this.capabilityControlFactory = capabilityControlFactory;
this.authConfig = authConfig;
+ this.anonymousCowardName = anonymousCowardName;
this.canonicalUrl = canonicalUrl;
this.realm = realm;
this.accountCache = accountCache;
@@ -146,8 +153,8 @@
public IdentifiedUser create(final AccessPath accessPath,
final Account.Id id) {
return new IdentifiedUser(capabilityControlFactory, accessPath,
- authConfig, canonicalUrl, realm, accountCache, groupIncludeCache,
- remotePeerProvider, dbProvider, id);
+ authConfig, anonymousCowardName, canonicalUrl, realm, accountCache,
+ groupIncludeCache, remotePeerProvider, dbProvider, id);
}
}
@@ -181,6 +188,7 @@
private final AccountCache accountCache;
private final GroupIncludeCache groupIncludeCache;
private final AuthConfig authConfig;
+ private final String anonymousCowardName;
@Nullable
private final Provider<SocketAddress> remotePeerProvider;
@@ -199,7 +207,9 @@
private IdentifiedUser(
CapabilityControl.Factory capabilityControlFactory,
final AccessPath accessPath,
- final AuthConfig authConfig, final Provider<String> canonicalUrl,
+ final AuthConfig authConfig,
+ final String anonymousCowardName,
+ final Provider<String> canonicalUrl,
final Realm realm, final AccountCache accountCache,
final GroupIncludeCache groupIncludeCache,
@Nullable final Provider<SocketAddress> remotePeerProvider,
@@ -210,6 +220,7 @@
this.accountCache = accountCache;
this.groupIncludeCache = groupIncludeCache;
this.authConfig = authConfig;
+ this.anonymousCowardName = anonymousCowardName;
this.remotePeerProvider = remotePeerProvider;
this.dbProvider = dbProvider;
this.accountId = id;
@@ -343,7 +354,7 @@
name = ua.getPreferredEmail();
}
if (name == null || name.isEmpty()) {
- name = "Anonymous Coward";
+ name = anonymousCowardName;
}
String user = getUserName();
@@ -403,7 +414,7 @@
if (0 < at) {
name = email.substring(0, at);
} else {
- name = "Anonymous Coward";
+ name = anonymousCowardName;
}
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/PerformRenameGroup.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/PerformRenameGroup.java
new file mode 100644
index 0000000..92f5fbf
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/PerformRenameGroup.java
@@ -0,0 +1,118 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License
+
+package com.google.gerrit.server.account;
+
+import com.google.gerrit.common.data.GroupDetail;
+import com.google.gerrit.common.errors.NameAlreadyUsedException;
+import com.google.gerrit.common.errors.NoSuchGroupException;
+import com.google.gerrit.reviewdb.AccountGroup;
+import com.google.gerrit.reviewdb.AccountGroupName;
+import com.google.gerrit.reviewdb.ReviewDb;
+import com.google.gerrit.server.IdentifiedUser;
+import com.google.gerrit.server.git.RenameGroupOp;
+import com.google.gwtorm.client.OrmDuplicateKeyException;
+import com.google.gwtorm.client.OrmException;
+import com.google.inject.Inject;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.concurrent.TimeUnit;
+
+public class PerformRenameGroup {
+
+ public interface Factory {
+ PerformRenameGroup create();
+ }
+
+ private final ReviewDb db;
+ private final GroupCache groupCache;
+ private final GroupControl.Factory groupControlFactory;
+ private final GroupDetailFactory.Factory groupDetailFactory;
+ private final RenameGroupOp.Factory renameGroupOpFactory;
+ private final IdentifiedUser currentUser;
+
+ @Inject
+ PerformRenameGroup(final ReviewDb db, final GroupCache groupCache,
+ final GroupControl.Factory groupControlFactory,
+ final GroupDetailFactory.Factory groupDetailFactory,
+ final RenameGroupOp.Factory renameGroupOpFactory,
+ final IdentifiedUser currentUser) {
+ this.db = db;
+ this.groupCache = groupCache;
+ this.groupControlFactory = groupControlFactory;
+ this.groupDetailFactory = groupDetailFactory;
+ this.renameGroupOpFactory = renameGroupOpFactory;
+ this.currentUser = currentUser;
+ }
+
+ public GroupDetail renameGroup(final String groupName,
+ final String newGroupName) throws OrmException, NameAlreadyUsedException,
+ NoSuchGroupException {
+ final AccountGroup.NameKey groupNameKey =
+ new AccountGroup.NameKey(groupName);
+ final AccountGroup group = groupCache.get(groupNameKey);
+ if (group == null) {
+ throw new NoSuchGroupException(groupNameKey);
+ }
+ return renameGroup(group.getId(), newGroupName);
+ }
+
+ public GroupDetail renameGroup(final AccountGroup.Id groupId,
+ final String newName) throws OrmException, NameAlreadyUsedException,
+ NoSuchGroupException {
+ final GroupControl ctl = groupControlFactory.validateFor(groupId);
+ final AccountGroup group = db.accountGroups().get(groupId);
+ if (group == null || !ctl.isOwner()) {
+ throw new NoSuchGroupException(groupId);
+ }
+
+ final AccountGroup.NameKey old = group.getNameKey();
+ final AccountGroup.NameKey key = new AccountGroup.NameKey(newName);
+
+ try {
+ final AccountGroupName id = new AccountGroupName(key, groupId);
+ db.accountGroupNames().insert(Collections.singleton(id));
+ } catch (OrmDuplicateKeyException dupeErr) {
+ // If we are using this identity, don't report the exception.
+ //
+ AccountGroupName other = db.accountGroupNames().get(key);
+ if (other != null && other.getId().equals(groupId)) {
+ return groupDetailFactory.create(groupId).call();
+ }
+
+ // Otherwise, someone else has this identity.
+ //
+ throw new NameAlreadyUsedException();
+ }
+
+ group.setNameKey(key);
+ db.accountGroups().update(Collections.singleton(group));
+
+ AccountGroupName priorName = db.accountGroupNames().get(old);
+ if (priorName != null) {
+ db.accountGroupNames().delete(Collections.singleton(priorName));
+ }
+
+ groupCache.evict(group);
+ groupCache.evictAfterRename(old);
+ renameGroupOpFactory.create( //
+ currentUser.newCommitterIdent(new Date(), TimeZone.getDefault()), //
+ group.getGroupUUID(), //
+ old.get(), newName).start(0, TimeUnit.MILLISECONDS);
+
+ return groupDetailFactory.create(groupId).call();
+ }
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/AnonymousCowardName.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/AnonymousCowardName.java
new file mode 100644
index 0000000..197d64e
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/AnonymousCowardName.java
@@ -0,0 +1,27 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.server.config;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import com.google.inject.BindingAnnotation;
+
+import java.lang.annotation.Retention;
+
+/** Special name for a user that hasn't set a name. */
+@Retention(RUNTIME)
+@BindingAnnotation
+public @interface AnonymousCowardName {
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/AnonymousCowardNameProvider.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/AnonymousCowardNameProvider.java
new file mode 100644
index 0000000..ffa90b6
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/AnonymousCowardNameProvider.java
@@ -0,0 +1,39 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.server.config;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+import org.eclipse.jgit.lib.Config;
+
+public class AnonymousCowardNameProvider implements Provider<String> {
+
+ private final String anonymousCoward;
+
+ @Inject
+ public AnonymousCowardNameProvider(@GerritServerConfig final Config cfg) {
+ String anonymousCoward = cfg.getString("user", null, "anonymousCoward");
+ if (anonymousCoward == null) {
+ anonymousCoward = "Anonymous Coward";
+ }
+ this.anonymousCoward = anonymousCoward;
+ }
+
+ @Override
+ public String get() {
+ return anonymousCoward;
+ }
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritRequestModule.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritRequestModule.java
index 3ba9aab..42c2531 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritRequestModule.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritRequestModule.java
@@ -25,6 +25,7 @@
import com.google.gerrit.server.account.GroupDetailFactory;
import com.google.gerrit.server.account.GroupMembersFactory;
import com.google.gerrit.server.account.PerformCreateGroup;
+import com.google.gerrit.server.account.PerformRenameGroup;
import com.google.gerrit.server.git.CreateCodeReviewNotes;
import com.google.gerrit.server.git.MergeOp;
import com.google.gerrit.server.git.MetaDataUpdate;
@@ -89,6 +90,7 @@
factory(MergeFailSender.Factory.class);
factory(RegisterNewEmailSender.Factory.class);
factory(PerformCreateGroup.Factory.class);
+ factory(PerformRenameGroup.Factory.class);
factory(GroupDetailFactory.Factory.class);
factory(GroupMembersFactory.Factory.class);
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/CreateCodeReviewNotes.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/CreateCodeReviewNotes.java
index fb88ad6..129dfa9 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/CreateCodeReviewNotes.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/CreateCodeReviewNotes.java
@@ -24,6 +24,7 @@
import com.google.gerrit.reviewdb.ReviewDb;
import com.google.gerrit.server.GerritPersonIdent;
import com.google.gerrit.server.account.AccountCache;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.gwtorm.client.OrmException;
import com.google.gwtorm.client.ResultSet;
@@ -76,6 +77,7 @@
private final AccountCache accountCache;
private final ApprovalTypes approvalTypes;
private final String canonicalWebUrl;
+ private final String anonymousCowardName;
private final Repository db;
private final RevWalk revWalk;
private final ObjectInserter inserter;
@@ -95,15 +97,17 @@
@GerritPersonIdent final PersonIdent gerritIdent,
final AccountCache accountCache,
final ApprovalTypes approvalTypes,
- @Nullable @CanonicalWebUrl final String canonicalWebUrl,
- @Assisted ReviewDb reviewDb,
- @Assisted final Repository db) {
+ final @Nullable @CanonicalWebUrl String canonicalWebUrl,
+ final @AnonymousCowardName String anonymousCowardName,
+ final @Assisted ReviewDb reviewDb,
+ final @Assisted Repository db) {
schema = reviewDb;
this.author = gerritIdent;
this.gerritIdent = gerritIdent;
this.accountCache = accountCache;
this.approvalTypes = approvalTypes;
this.canonicalWebUrl = canonicalWebUrl;
+ this.anonymousCowardName = anonymousCowardName;
this.db = db;
revWalk = new RevWalk(db);
@@ -185,7 +189,8 @@
throws CodeReviewNoteCreationException, IOException {
try {
ReviewNoteHeaderFormatter formatter =
- new ReviewNoteHeaderFormatter(author.getTimeZone());
+ new ReviewNoteHeaderFormatter(author.getTimeZone(),
+ anonymousCowardName);
final List<String> idList = commit.getFooterLines(CHANGE_ID);
if (idList.isEmpty())
formatter.appendChangeId(change.getKey());
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/LocalDiskRepositoryManager.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/LocalDiskRepositoryManager.java
index 268eed3..4506e3d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/LocalDiskRepositoryManager.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/LocalDiskRepositoryManager.java
@@ -100,8 +100,13 @@
throw new RepositoryNotFoundException("Invalid name: " + name);
}
+ final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED);
+
+ if (!getProjectName(loc.getFile()).equals(name)) {
+ throw new RepositoryNotFoundException(gitDirOf(name));
+ }
+
try {
- final FileKey loc = FileKey.lenient(gitDirOf(name), FS.DETECTED);
return RepositoryCache.open(loc);
} catch (IOException e1) {
final RepositoryNotFoundException e2;
@@ -117,24 +122,30 @@
throw new RepositoryNotFoundException("Invalid name: " + name);
}
- try {
- File dir = FileKey.resolve(gitDirOf(name), FS.DETECTED);
- FileKey loc;
- if (dir != null) {
- // Already exists on disk, use the repository we found.
- //
- loc = FileKey.exact(dir, FS.DETECTED);
- } else {
- // It doesn't exist under any of the standard permutations
- // of the repository name, so prefer the standard bare name.
- //
- String n = name.get();
- if (!n.endsWith(Constants.DOT_GIT_EXT)) {
- n = n + Constants.DOT_GIT_EXT;
- }
- loc = FileKey.exact(new File(basePath, n), FS.DETECTED);
- }
+ File dir = FileKey.resolve(gitDirOf(name), FS.DETECTED);
+ FileKey loc;
+ if (dir != null) {
+ // Already exists on disk, use the repository we found.
+ //
+ loc = FileKey.exact(dir, FS.DETECTED);
+ final Project.NameKey nameOfExistingProject =
+ getProjectName(loc.getFile());
+ if (!nameOfExistingProject.equals(name)) {
+ throw new RepositoryCaseMismatchException(name, nameOfExistingProject);
+ }
+ } else {
+ // It doesn't exist under any of the standard permutations
+ // of the repository name, so prefer the standard bare name.
+ //
+ String n = name.get();
+ if (!n.endsWith(Constants.DOT_GIT_EXT)) {
+ n = n + Constants.DOT_GIT_EXT;
+ }
+ loc = FileKey.exact(new File(basePath, n), FS.DETECTED);
+ }
+
+ try {
Repository db = RepositoryCache.open(loc, false);
db.create(true /* bare */);
@@ -256,19 +267,7 @@
for (File f : ls) {
String fileName = f.getName();
if (FileKey.isGitRepository(f, FS.DETECTED)) {
- String projectName;
- if (fileName.equals(Constants.DOT_GIT)) {
- projectName = prefix.substring(0, prefix.length() - 1);
-
- } else if (fileName.endsWith(Constants.DOT_GIT_EXT)) {
- int newLen = fileName.length() - Constants.DOT_GIT_EXT.length();
- projectName = prefix + fileName.substring(0, newLen);
-
- } else {
- projectName = prefix + fileName;
- }
-
- Project.NameKey nameKey = new Project.NameKey(projectName);
+ Project.NameKey nameKey = getProjectName(prefix, fileName);
if (isUnreasonableName(nameKey)) {
log.warn("Ignoring unreasonably named repository " + f.getAbsolutePath());
} else {
@@ -280,4 +279,30 @@
}
}
}
+
+ private Project.NameKey getProjectName(final String prefix,
+ final String fileName) {
+ final String projectName;
+ if (fileName.equals(Constants.DOT_GIT)) {
+ projectName = prefix.substring(0, prefix.length() - 1);
+
+ } else if (fileName.endsWith(Constants.DOT_GIT_EXT)) {
+ int newLen = fileName.length() - Constants.DOT_GIT_EXT.length();
+ projectName = prefix + fileName.substring(0, newLen);
+
+ } else {
+ projectName = prefix + fileName;
+ }
+
+ return new Project.NameKey(projectName);
+ }
+
+ private Project.NameKey getProjectName(final File gitDir) {
+ final String relativeGitPath =
+ getBasePath().toURI().relativize(gitDir.toURI()).getPath();
+ final String prefix =
+ relativeGitPath.substring(0, relativeGitPath.length() - 1
+ - gitDir.getName().length());
+ return getProjectName(prefix, gitDir.getName());
+ }
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java
index fd6f94b..f233bf1 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/MergeOp.java
@@ -27,6 +27,7 @@
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.ChangeMessage;
import com.google.gerrit.reviewdb.PatchSet;
+import com.google.gerrit.reviewdb.PatchSetAncestor;
import com.google.gerrit.reviewdb.PatchSetApproval;
import com.google.gerrit.reviewdb.Project;
import com.google.gerrit.reviewdb.RevId;
@@ -282,7 +283,7 @@
}
}
- private void preMerge() throws MergeException {
+ private void preMerge() throws MergeException, OrmException {
openBranch();
validateChangeList();
mergeTip = branchTip;
@@ -674,7 +675,7 @@
}
}
- private void cherryPickChanges() throws MergeException {
+ private void cherryPickChanges() throws MergeException, OrmException {
while (!toMerge.isEmpty()) {
final CodeReviewCommit n = toMerge.remove(0);
final ThreeWayMerger m;
@@ -758,7 +759,7 @@
}
private void writeCherryPickCommit(final Merger m, final CodeReviewCommit n)
- throws IOException {
+ throws IOException, OrmException {
rw.parseBody(n);
final List<FooterLine> footers = n.getFooterLines();
@@ -885,14 +886,65 @@
final ObjectId id = commit(m, mergeCommit);
final CodeReviewCommit newCommit = (CodeReviewCommit) rw.parseCommit(id);
+
+ n.change =
+ schema.changes().atomicUpdate(n.change.getId(),
+ new AtomicUpdate<Change>() {
+ @Override
+ public Change update(Change change) {
+ change.nextPatchSetId();
+ return change;
+ }
+ });
+
+ final PatchSet ps = new PatchSet(n.change.currPatchSetId());
+ ps.setCreatedOn(new Timestamp(System.currentTimeMillis()));
+ ps.setUploader(submitAudit.getAccountId());
+ ps.setRevision(new RevId(id.getName()));
+ insertAncestors(ps.getId(), newCommit);
+ schema.patchSets().insert(Collections.singleton(ps));
+
+ n.change =
+ schema.changes().atomicUpdate(n.change.getId(),
+ new AtomicUpdate<Change>() {
+ @Override
+ public Change update(Change change) {
+ change.setCurrentPatchSet(patchSetInfoFactory.get(newCommit,
+ ps.getId()));
+ return change;
+ }
+ });
+
+ for (PatchSetApproval a : schema.patchSetApprovals().byChange(
+ n.change.getId())) {
+ // ApprovalCategory.SUBMIT is still in db but not relevant in git-store
+ if (!ApprovalCategory.SUBMIT.equals(a.getCategoryId())) {
+ schema.patchSetApprovals().insert(
+ Collections.singleton(new PatchSetApproval(ps.getId(), a)));
+ }
+ }
+
newCommit.copyFrom(n);
newCommit.statusCode = CommitMergeStatus.CLEAN_PICK;
commits.put(newCommit.patchsetId.getParentKey(), newCommit);
-
mergeTip = newCommit;
setRefLogIdent(submitAudit);
}
+ private void insertAncestors(PatchSet.Id id, RevCommit src)
+ throws OrmException {
+ final int cnt = src.getParentCount();
+ List<PatchSetAncestor> toInsert = new ArrayList<PatchSetAncestor>(cnt);
+ for (int p = 0; p < cnt; p++) {
+ PatchSetAncestor a;
+
+ a = new PatchSetAncestor(new PatchSetAncestor.Id(id, p + 1));
+ a.setAncestorRevision(new RevId(src.getParent(p).getId().name()));
+ toInsert.add(a);
+ }
+ schema.patchSetAncestors().insert(toInsert);
+ }
+
private ObjectId commit(final Merger m, final CommitBuilder mergeCommit)
throws IOException, UnsupportedEncodingException {
ObjectInserter oi = m.getObjectInserter();
@@ -1238,7 +1290,10 @@
private void setMerged(Change c, ChangeMessage msg) {
final Change.Id changeId = c.getId();
- final PatchSet.Id merged = c.currentPatchSetId();
+ // We must pull the patchset out of commits, because the patchset ID is
+ // modified when using the cherry-pick merge strategy.
+ final CodeReviewCommit commit = commits.get(c.getId());
+ final PatchSet.Id merged = commit.change.currentPatchSetId();
try {
schema.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
index 7e130a5..7886ec8 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
@@ -1192,9 +1192,11 @@
final Ref mergedInto = findMergedInto(change.getDest().get(), c);
result.mergedIntoRef = mergedInto != null ? mergedInto.getName() : null;
}
+ final PatchSetInfo info = patchSetInfoFactory.get(c, ps.getId());
+ change.setCurrentPatchSet(info);
result.change = change;
result.patchSet = ps;
- result.info = patchSetInfoFactory.get(c, ps.getId());
+ result.info = info;
final Account.Id authorId =
result.info.getAuthor() != null ? result.info.getAuthor().getAccount()
@@ -1533,24 +1535,26 @@
}
final List<String> idList = c.getFooterLines(CHANGE_ID);
- if (idList.isEmpty()) {
- if (project.isRequireChangeID() && (cmd.getRefName().startsWith(NEW_CHANGE)
- || NEW_PATCHSET.matcher(cmd.getRefName()).matches())) {
- String errMsg = "missing Change-Id in commit message";
- reject(cmd, errMsg);
- rp.sendMessage(getFixedCommitMsgWithChangeId(errMsg, c));
+ if ((cmd.getRefName().startsWith(NEW_CHANGE) || NEW_PATCHSET.matcher(cmd.getRefName()).matches())) {
+ if (idList.isEmpty()) {
+ if (project.isRequireChangeID()) {
+ String errMsg = "missing Change-Id in commit message";
+ reject(cmd, errMsg);
+ rp.sendMessage(getFixedCommitMsgWithChangeId(errMsg, c));
+ return false;
+ }
+ } else if (idList.size() > 1) {
+ reject(cmd, "multiple Change-Id lines in commit message");
return false;
- }
- } else if (idList.size() > 1) {
- reject(cmd, "multiple Change-Id lines in commit message");
- return false;
- } else {
- final String v = idList.get(idList.size() - 1).trim();
- if (!v.matches("^I[0-9a-f]{8,}.*$")) {
- final String errMsg = "missing or invalid Change-Id line format in commit message";
- reject(cmd, errMsg);
- rp.sendMessage(getFixedCommitMsgWithChangeId(errMsg, c));
- return false;
+ } else {
+ final String v = idList.get(idList.size() - 1).trim();
+ if (!v.matches("^I[0-9a-f]{8,}.*$")) {
+ final String errMsg =
+ "missing or invalid Change-Id line format in commit message";
+ reject(cmd, errMsg);
+ rp.sendMessage(getFixedCommitMsgWithChangeId(errMsg, c));
+ return false;
+ }
}
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/RepositoryCaseMismatchException.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/RepositoryCaseMismatchException.java
new file mode 100644
index 0000000..3c8a1a5
--- /dev/null
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/RepositoryCaseMismatchException.java
@@ -0,0 +1,51 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.server.git;
+
+import com.google.gerrit.reviewdb.Project;
+import com.google.gerrit.reviewdb.Project.NameKey;
+
+import org.eclipse.jgit.errors.RepositoryNotFoundException;
+
+/**
+ * This exception is thrown if a project cannot be created because a project
+ * with the same name in a different case already exists. This can only happen
+ * if the OS has a case insensitive file system (e.g. Windows), because in this
+ * case the name for the git repository in the file system is already occupied
+ * by the existing project.
+ */
+public class RepositoryCaseMismatchException extends
+ RepositoryNotFoundException {
+
+ private static final long serialVersionUID = 1L;
+
+ private final NameKey nameOfExistingProject;
+
+ /**
+ * @param projectName name of the project that cannot be created
+ * @param nameOfExistingProject name of the project that already exists and
+ * occupies the name for the git repository in the file system
+ */
+ public RepositoryCaseMismatchException(final Project.NameKey projectName,
+ final Project.NameKey nameOfExistingProject) {
+ super("Name occupied in other case: " + projectName.get() + "; project "
+ + nameOfExistingProject.get() + " exists");
+ this.nameOfExistingProject = nameOfExistingProject;
+ }
+
+ public NameKey getNameOfExistingProject() {
+ return nameOfExistingProject;
+ }
+}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReviewNoteHeaderFormatter.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReviewNoteHeaderFormatter.java
index 8997e2b..39ae9b3 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReviewNoteHeaderFormatter.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReviewNoteHeaderFormatter.java
@@ -37,12 +37,14 @@
class ReviewNoteHeaderFormatter {
private final DateFormat rfc2822DateFormatter;
+ private final String anonymousCowardName;
private final StringBuilder sb = new StringBuilder();
- ReviewNoteHeaderFormatter(TimeZone tz) {
+ ReviewNoteHeaderFormatter(TimeZone tz, String anonymousCowardName) {
rfc2822DateFormatter =
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
rfc2822DateFormatter.setCalendar(Calendar.getInstance(tz, Locale.US));
+ this.anonymousCowardName = anonymousCowardName;
}
void appendChangeId(Change.Key changeKey) {
@@ -76,7 +78,7 @@
}
if (!wroteData) {
- sb.append("Anonymous Coward #").append(user.getId());
+ sb.append(anonymousCowardName).append(" #").append(user.getId());
}
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/TagSet.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/TagSet.java
index ba63847..cfa5420 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/TagSet.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/TagSet.java
@@ -320,6 +320,11 @@
int flag = refs.size();
commit.refFlags.set(flag);
refs.put(ref.getName(), new CachedRef(ref, flag));
+ } catch (IncorrectObjectTypeException notCommit) {
+ // No need to spam the logs.
+ // Quite many refs will point to non-commits.
+ // For instance, refs from refs/cache-automerge
+ // will often end up here.
} catch (IOException e) {
log.warn("Error on " + ref.getName() + " of " + projectName, e);
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/AbandonedSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/AbandonedSender.java
index bb28a84..ac62bd0 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/AbandonedSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/AbandonedSender.java
@@ -15,6 +15,7 @@
package com.google.gerrit.server.mail;
import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -26,8 +27,9 @@
}
@Inject
- public AbandonedSender(EmailArguments ea, @Assisted Change c) {
- super(ea, c, "abandon");
+ public AbandonedSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
+ super(ea, anonymousCowardName, c, "abandon");
}
@Override
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/AddReviewerSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/AddReviewerSender.java
index e5437cf..02f8fb7 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/AddReviewerSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/AddReviewerSender.java
@@ -15,6 +15,7 @@
package com.google.gerrit.server.mail;
import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.ssh.SshInfo;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -26,9 +27,10 @@
}
@Inject
- public AddReviewerSender(EmailArguments ea, SshInfo sshInfo,
+ public AddReviewerSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, SshInfo sshInfo,
@Assisted Change c) {
- super(ea, sshInfo, c);
+ super(ea, anonymousCowardName, sshInfo, c);
}
@Override
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java
index 4b5d279..a064891 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/ChangeEmail.java
@@ -57,8 +57,9 @@
protected Set<Account.Id> authors;
protected boolean emailOnlyAuthors;
- protected ChangeEmail(EmailArguments ea, final Change c, final String mc) {
- super(ea, mc);
+ protected ChangeEmail(EmailArguments ea, final String anonymousCowardName,
+ final Change c, final String mc) {
+ super(ea, anonymousCowardName, mc);
change = c;
changeData = change != null ? new ChangeData(change) : null;
emailOnlyAuthors = false;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/CommentSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/CommentSender.java
index 062d14b..e887221 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/CommentSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/CommentSender.java
@@ -17,6 +17,7 @@
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.Patch;
import com.google.gerrit.reviewdb.PatchLineComment;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.patch.PatchFile;
import com.google.gerrit.server.patch.PatchList;
import com.google.inject.Inject;
@@ -41,8 +42,9 @@
private List<PatchLineComment> inlineComments = Collections.emptyList();
@Inject
- public CommentSender(EmailArguments ea, @Assisted Change c) {
- super(ea, c, "comment");
+ public CommentSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
+ super(ea, anonymousCowardName, c, "comment");
}
public void setPatchLineComments(final List<PatchLineComment> plc) {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java
index 8bb68df..dabb6f3 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/CreateChangeSender.java
@@ -21,6 +21,7 @@
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.AccountProjectWatch.NotifyType;
import com.google.gerrit.server.account.GroupCache;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.ssh.SshInfo;
import com.google.gwtorm.client.OrmException;
import com.google.inject.Inject;
@@ -38,9 +39,10 @@
private final GroupCache groupCache;
@Inject
- public CreateChangeSender(EmailArguments ea, SshInfo sshInfo,
+ public CreateChangeSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, SshInfo sshInfo,
GroupCache groupCache, @Assisted Change c) {
- super(ea, sshInfo, c);
+ super(ea, anonymousCowardName, sshInfo, c);
this.groupCache = groupCache;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/FromAddressGeneratorProvider.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/FromAddressGeneratorProvider.java
index 05a419e..0abf96f 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/FromAddressGeneratorProvider.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/FromAddressGeneratorProvider.java
@@ -18,6 +18,7 @@
import com.google.gerrit.reviewdb.Account;
import com.google.gerrit.server.GerritPersonIdent;
import com.google.gerrit.server.account.AccountCache;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -34,6 +35,7 @@
@Inject
FromAddressGeneratorProvider(@GerritServerConfig final Config cfg,
+ final @AnonymousCowardName String anonymousCowardName,
@GerritPersonIdent final PersonIdent myIdent,
final AccountCache accountCache) {
@@ -42,7 +44,9 @@
if (from == null || "MIXED".equalsIgnoreCase(from)) {
ParameterizedString name = new ParameterizedString("${user} (Code Review)");
- generator = new PatternGen(srvAddr, accountCache, name, srvAddr.email);
+ generator =
+ new PatternGen(srvAddr, accountCache, anonymousCowardName, name,
+ srvAddr.email);
} else if ("USER".equalsIgnoreCase(from)) {
generator = new UserGen(accountCache, srvAddr);
@@ -56,7 +60,9 @@
if (name == null || name.getParameterNames().isEmpty()) {
generator = new ServerGen(a);
} else {
- generator = new PatternGen(srvAddr, accountCache, name, a.email);
+ generator =
+ new PatternGen(srvAddr, accountCache, anonymousCowardName, name,
+ a.email);
}
}
}
@@ -118,13 +124,16 @@
private final String senderEmail;
private final Address serverAddress;
private final AccountCache accountCache;
+ private final String anonymousCowardName;
private final ParameterizedString namePattern;
PatternGen(final Address serverAddress, final AccountCache accountCache,
+ final String anonymousCowardName,
final ParameterizedString namePattern, final String senderEmail) {
this.senderEmail = senderEmail;
this.serverAddress = serverAddress;
this.accountCache = accountCache;
+ this.anonymousCowardName = anonymousCowardName;
this.namePattern = namePattern;
}
@@ -141,7 +150,7 @@
final Account account = accountCache.get(fromId).getAccount();
String fullName = account.getFullName();
if (fullName == null || "".equals(fullName)) {
- fullName = "Anonymous Coward";
+ fullName = anonymousCowardName;
}
senderName = namePattern.replace("user", fullName).toString();
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/MergeFailSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/MergeFailSender.java
index 19fb48b..f11b7c4 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/MergeFailSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/MergeFailSender.java
@@ -15,6 +15,7 @@
package com.google.gerrit.server.mail;
import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -25,8 +26,9 @@
}
@Inject
- public MergeFailSender(EmailArguments ea, @Assisted Change c) {
- super(ea, c, "merge-failed");
+ public MergeFailSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
+ super(ea, anonymousCowardName, c, "merge-failed");
}
@Override
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/MergedSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/MergedSender.java
index 9dbabe6..54efb02 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/MergedSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/MergedSender.java
@@ -23,6 +23,7 @@
import com.google.gerrit.reviewdb.ApprovalCategoryValue;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.PatchSetApproval;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gwtorm.client.OrmException;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -39,8 +40,10 @@
private final ApprovalTypes approvalTypes;
@Inject
- public MergedSender(EmailArguments ea, ApprovalTypes at, @Assisted Change c) {
- super(ea, c, "merged");
+ public MergedSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, ApprovalTypes at,
+ @Assisted Change c) {
+ super(ea, anonymousCowardName, c, "merged");
approvalTypes = at;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/NewChangeSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/NewChangeSender.java
index 186f57a..fb9ba60 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/NewChangeSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/NewChangeSender.java
@@ -32,8 +32,9 @@
private final Set<Account.Id> reviewers = new HashSet<Account.Id>();
private final Set<Account.Id> extraCC = new HashSet<Account.Id>();
- protected NewChangeSender(EmailArguments ea, SshInfo sshInfo, Change c) {
- super(ea, c, "newchange");
+ protected NewChangeSender(EmailArguments ea, String anonymousCowardName,
+ SshInfo sshInfo, Change c) {
+ super(ea, anonymousCowardName, c, "newchange");
this.sshInfo = sshInfo;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/OutgoingEmail.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/OutgoingEmail.java
index e6a1ebc..e01891a 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/OutgoingEmail.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/OutgoingEmail.java
@@ -54,10 +54,14 @@
protected VelocityContext velocityContext;
protected final EmailArguments args;
+ private final String anonymousCowardName;
protected Account.Id fromId;
- protected OutgoingEmail(EmailArguments ea, final String mc) {
+
+ protected OutgoingEmail(EmailArguments ea, final String anonymousCowardName,
+ final String mc) {
args = ea;
+ this.anonymousCowardName = anonymousCowardName;
messageClass = mc;
headers = new LinkedHashMap<String, EmailHeader>();
}
@@ -226,7 +230,7 @@
/** Lookup a human readable name for an account, usually the "full name". */
protected String getNameFor(final Account.Id accountId) {
if (accountId == null) {
- return "Anonymous Coward";
+ return anonymousCowardName;
}
final Account userAccount = args.accountCache.get(accountId).getAccount();
@@ -235,7 +239,7 @@
name = userAccount.getPreferredEmail();
}
if (name == null) {
- name = "Anonymous Coward #" + accountId;
+ name = anonymousCowardName + " #" + accountId;
}
return name;
}
@@ -254,7 +258,7 @@
return email;
} else /* (name == null && email == null) */{
- return "Anonymous Coward #" + accountId;
+ return anonymousCowardName + " #" + accountId;
}
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/RegisterNewEmailSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/RegisterNewEmailSender.java
index 2c77999..bc967da 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/RegisterNewEmailSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/RegisterNewEmailSender.java
@@ -14,6 +14,7 @@
package com.google.gerrit.server.mail;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.config.AuthConfig;
import com.google.gwtjsonrpc.server.XsrfException;
import com.google.inject.Inject;
@@ -33,8 +34,9 @@
@Inject
public RegisterNewEmailSender(EmailArguments ea, AuthConfig ac,
+ @AnonymousCowardName String anonymousCowardName,
@Assisted final String address) {
- super(ea, "registernewemail");
+ super(ea, anonymousCowardName, "registernewemail");
authConfig = ac;
addr = address;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/ReplacePatchSetSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/ReplacePatchSetSender.java
index 2ae27fa..b09cb27 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/ReplacePatchSetSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/ReplacePatchSetSender.java
@@ -16,6 +16,7 @@
import com.google.gerrit.reviewdb.Account;
import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.gerrit.server.ssh.SshInfo;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -39,8 +40,10 @@
private final SshInfo sshInfo;
@Inject
- public ReplacePatchSetSender(EmailArguments ea, SshInfo si, @Assisted Change c) {
- super(ea, c, "newpatchset");
+ public ReplacePatchSetSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, SshInfo si,
+ @Assisted Change c) {
+ super(ea, anonymousCowardName, c, "newpatchset");
sshInfo = si;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/ReplyToChangeSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/ReplyToChangeSender.java
index 401a0b8..6b0ed4d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/ReplyToChangeSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/ReplyToChangeSender.java
@@ -22,8 +22,9 @@
public T create(Change change);
}
- protected ReplyToChangeSender(EmailArguments ea, Change c, String mc) {
- super(ea, c, mc);
+ protected ReplyToChangeSender(EmailArguments ea, String anonymousCowardName,
+ Change c, String mc) {
+ super(ea, anonymousCowardName, c, mc);
}
@Override
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/RestoredSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/RestoredSender.java
index fee73d6..b9df397 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/RestoredSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/RestoredSender.java
@@ -15,6 +15,7 @@
package com.google.gerrit.server.mail;
import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -26,8 +27,9 @@
}
@Inject
- public RestoredSender(EmailArguments ea, @Assisted Change c) {
- super(ea, c, "restore");
+ public RestoredSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
+ super(ea, anonymousCowardName, c, "restore");
}
@Override
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/RevertedSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/RevertedSender.java
index 8ad993b..e6f88ea 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/RevertedSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/RevertedSender.java
@@ -15,6 +15,7 @@
package com.google.gerrit.server.mail;
import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.server.config.AnonymousCowardName;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -25,8 +26,9 @@
}
@Inject
- public RevertedSender(EmailArguments ea, @Assisted Change c) {
- super(ea, c, "revert");
+ public RevertedSender(EmailArguments ea,
+ @AnonymousCowardName String anonymousCowardName, @Assisted Change c) {
+ super(ea, anonymousCowardName, c, "revert");
}
@Override
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/AddReviewer.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/AddReviewer.java
index be0ddac..b7f0a81 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/AddReviewer.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/AddReviewer.java
@@ -198,7 +198,8 @@
if (!exists(psid, reviewer)) {
// This reviewer has not entered an approval for this change yet.
//
- final PatchSetApproval myca = dummyApproval(psid, reviewer);
+ final PatchSetApproval myca =
+ dummyApproval(control.getChange(), psid, reviewer);
toInsert.add(myca);
added.add(reviewer);
}
@@ -235,10 +236,13 @@
.iterator().hasNext();
}
- private PatchSetApproval dummyApproval(final PatchSet.Id patchSetId,
- final Account.Id reviewerId) {
- return new PatchSetApproval(new PatchSetApproval.Key(patchSetId,
- reviewerId, addReviewerCategoryId), (short) 0);
+ private PatchSetApproval dummyApproval(final Change change,
+ final PatchSet.Id patchSetId, final Account.Id reviewerId) {
+ final PatchSetApproval dummyApproval =
+ new PatchSetApproval(new PatchSetApproval.Key(patchSetId, reviewerId,
+ addReviewerCategoryId), (short) 0);
+ dummyApproval.cache(change);
+ return dummyApproval;
}
public static boolean isLegalReviewerGroup(final AccountGroup.UUID groupUUID) {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
index 2986a72..0bb4bcc 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListLoader.java
@@ -256,7 +256,14 @@
DirCache dc = DirCache.newInCore();
m.setDirCache(dc);
- if (m.merge(b.getParents())) {
+ boolean couldMerge = false;
+ try {
+ couldMerge = m.merge(b.getParents());
+ } catch (IOException e) {
+ //
+ }
+
+ if (couldMerge) {
treeId = m.getResultTreeId();
} else {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/DataSourceProvider.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/DataSourceProvider.java
index 701e97a..65f5820 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/DataSourceProvider.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/DataSourceProvider.java
@@ -87,11 +87,7 @@
if (url == null || url.isEmpty()) {
if (type == null) {
- if (url != null && !url.isEmpty()) {
- type = Type.JDBC;
- } else {
- type = Type.H2;
- }
+ type = Type.H2;
}
switch (type) {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaModule.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaModule.java
index ea277d7..9696993 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaModule.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaModule.java
@@ -21,6 +21,8 @@
import com.google.gerrit.server.GerritPersonIdentProvider;
import com.google.gerrit.server.config.AllProjectsName;
import com.google.gerrit.server.config.AllProjectsNameProvider;
+import com.google.gerrit.server.config.AnonymousCowardName;
+import com.google.gerrit.server.config.AnonymousCowardNameProvider;
import com.google.gerrit.server.config.FactoryModule;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.LocalDiskRepositoryManager;
@@ -40,6 +42,9 @@
.toProvider(AllProjectsNameProvider.class)
.in(SINGLETON);
+ bind(String.class).annotatedWith(AnonymousCowardName.class).toProvider(
+ AnonymousCowardNameProvider.class);
+
bind(GitRepositoryManager.class).to(LocalDiskRepositoryManager.class);
install(new LifecycleModule() {
@Override
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Abandoned.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Abandoned.vm
index 20529b2..57f4f63 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Abandoned.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Abandoned.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ChangeFooter.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ChangeFooter.vm
index 5b74453..f2f0fc76 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ChangeFooter.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ChangeFooter.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ChangeSubject.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ChangeSubject.vm
index 24cc23c..a67c38c 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ChangeSubject.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ChangeSubject.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Comment.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Comment.vm
index 4ad355b8..547c1b4 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Comment.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Comment.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/MergeFail.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/MergeFail.vm
index dfe3d92f..6ded252 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/MergeFail.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/MergeFail.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Merged.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Merged.vm
index 296a37a..bcbc7bd 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Merged.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Merged.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/NewChange.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/NewChange.vm
index ec7028b..5ab1860 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/NewChange.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/NewChange.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/RegisterNewEmail.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/RegisterNewEmail.vm
index 34682f2..0e42e01 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/RegisterNewEmail.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/RegisterNewEmail.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ReplacePatchSet.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ReplacePatchSet.vm
index 4575965..cdc5bfc 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ReplacePatchSet.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/ReplacePatchSet.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Restored.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Restored.vm
index c0e6b91..afcbcc5 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Restored.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Restored.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Reverted.vm b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Reverted.vm
index a2350d8..a0aedd6 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Reverted.vm
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mail/Reverted.vm
@@ -23,7 +23,7 @@
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
-## want to override the default template, copy the .vm.exmaple file to a .vm
+## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/mail/FromAddressGeneratorProviderTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/mail/FromAddressGeneratorProviderTest.java
index 6d56b4a..2332eb6 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/mail/FromAddressGeneratorProviderTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/mail/FromAddressGeneratorProviderTest.java
@@ -47,7 +47,8 @@
}
private FromAddressGenerator create() {
- return new FromAddressGeneratorProvider(config, ident, accountCache).get();
+ return new FromAddressGeneratorProvider(config, "Anonymous Coward", ident,
+ accountCache).get();
}
private void setFrom(final String newFrom) {
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/AdminSetParent.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/AdminSetParent.java
index 95bc563..85b6614 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/AdminSetParent.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/AdminSetParent.java
@@ -117,8 +117,9 @@
MetaDataUpdate md = metaDataUpdateFactory.create(key);
try {
ProjectConfig config = ProjectConfig.read(md);
- config.getProject().setParentName(newParentKey.get());
- md.setMessage("Inherit access from " + newParentKey.get() + "\n");
+ config.getProject().setParentName(newParentKey);
+ md.setMessage("Inherit access from "
+ + (newParentKey != null ? newParentKey.get() : allProjectsName.get()) + "\n");
if (!config.commit(md)) {
err.append("error: Could not update project " + name + "\n");
}
@@ -132,6 +133,8 @@
} catch (ConfigInvalidException e) {
throw new Failure(1, "Cannot update project " + name, e);
}
+
+ projectCache.evict(pc.getProject());
}
if (err.length() > 0) {
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/CreateProject.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/CreateProject.java
index 7a0c1a9..7d07a7a 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/CreateProject.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/CreateProject.java
@@ -29,6 +29,7 @@
import com.google.gerrit.server.git.MetaDataUpdate;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gerrit.server.git.ReplicationQueue;
+import com.google.gerrit.server.git.RepositoryCaseMismatchException;
import com.google.gerrit.server.project.ProjectCache;
import com.google.gerrit.server.project.ProjectControl;
import com.google.gerrit.sshd.BaseCommand;
@@ -178,18 +179,9 @@
repo.close();
}
} catch (IllegalStateException err) {
- try {
- Repository repo = repoManager.openRepository(nameKey);
- try {
- if (repo.getObjectDatabase().exists()) {
- throw new UnloggedFailure(1, "fatal: project \"" + projectName + "\" exists");
- }
- } finally {
- repo.close();
- }
- } catch (RepositoryNotFoundException doesNotExist) {
- throw new Failure(1, "fatal: Cannot create " + projectName, err);
- }
+ handleRepositoryExistsException(nameKey);
+ } catch (RepositoryCaseMismatchException err) {
+ handleRepositoryExistsException(err.getNameOfExistingProject());
} catch (RepositoryNotFoundException badName) {
throw new UnloggedFailure(1, "fatal: " + badName.getMessage());
} catch (Exception err) {
@@ -297,4 +289,21 @@
throw new Failure(1, "--branch \"" + branch + "\" is not a valid name");
}
}
+
+ private void handleRepositoryExistsException(final Project.NameKey projectName)
+ throws Failure {
+ try {
+ Repository repo = repoManager.openRepository(projectName);
+ try {
+ if (repo.getObjectDatabase().exists()) {
+ throw new UnloggedFailure(1, "fatal: project \"" + projectName
+ + "\" exists");
+ }
+ } finally {
+ repo.close();
+ }
+ } catch (RepositoryNotFoundException err) {
+ throw new Failure(1, "fatal: Cannot create " + projectName, err);
+ }
+ }
}
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListProjects.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListProjects.java
index 1ee3cfb..a240b3d 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListProjects.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListProjects.java
@@ -97,6 +97,9 @@
@Option(name = "--type", usage = "type of project")
private FilterType type = FilterType.CODE;
+ @Option(name = "--description", aliases = {"-d"}, usage = "include description of project in list")
+ private boolean showDescription;
+
private String currentTabSeparator = DEFAULT_TAB_SEPARATOR;
@Override
@@ -115,6 +118,10 @@
throw new UnloggedFailure(1, "fatal: --tree and --show-branch options are not compatible.");
}
+ if (showTree && showDescription) {
+ throw new UnloggedFailure(1, "fatal: --tree and --description options are not compatible.");
+ }
+
final PrintWriter stdout = toPrintWriter(out);
final TreeMap<String, TreeNode> treeMap = new TreeMap<String, TreeNode>();
try {
@@ -184,7 +191,15 @@
continue;
}
- stdout.print(projectName.get() + "\n");
+ stdout.print(projectName.get());
+
+ String desc;
+ if (showDescription && !(desc = e.getProject().getDescription()).isEmpty()) {
+ // We still want to list every project as one-liners, hence escaping \n.
+ stdout.print(" - " + desc.replace("\n", "\\n"));
+ }
+
+ stdout.print("\n");
}
if (showTree && treeMap.size() > 0) {
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/MasterCommandModule.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/MasterCommandModule.java
index 6a69791..da04196 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/MasterCommandModule.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/MasterCommandModule.java
@@ -28,6 +28,7 @@
command(gerrit, "approve").to(ReviewCommand.class);
command(gerrit, "create-account").to(CreateAccountCommand.class);
command(gerrit, "create-group").to(CreateGroupCommand.class);
+ command(gerrit, "rename-group").to(RenameGroupCommand.class);
command(gerrit, "create-project").to(CreateProject.class);
command(gerrit, "gsql").to(AdminQueryShell.class);
command(gerrit, "set-reviewers").to(SetReviewersCommand.class);
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/RenameGroupCommand.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/RenameGroupCommand.java
new file mode 100644
index 0000000..b6d5bf5
--- /dev/null
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/RenameGroupCommand.java
@@ -0,0 +1,58 @@
+// Copyright (C) 2011 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.sshd.commands;
+
+import com.google.gerrit.common.errors.NameAlreadyUsedException;
+import com.google.gerrit.common.errors.NoSuchGroupException;
+import com.google.gerrit.server.account.PerformRenameGroup;
+import com.google.gerrit.sshd.BaseCommand;
+import com.google.gwtorm.client.OrmException;
+import com.google.inject.Inject;
+
+import org.apache.sshd.server.Environment;
+import org.kohsuke.args4j.Argument;
+
+import java.io.IOException;
+
+public class RenameGroupCommand extends BaseCommand {
+
+ @Argument(index = 0, required = true, metaVar = "GROUP", usage = "name of the group to be renamed")
+ private String groupName;
+
+ @Argument(index = 1, required = true, metaVar = "NEWNAME", usage = "new name of the group")
+ private String newGroupName;
+
+ @Inject
+ private PerformRenameGroup.Factory performRenameGroupFactory;
+
+ @Override
+ public void start(final Environment env) throws IOException {
+ startThread(new CommandRunnable() {
+ @Override
+ public void run() throws Exception {
+ parseCommandLine();
+ try {
+ performRenameGroupFactory.create().renameGroup(groupName, newGroupName);
+ } catch (OrmException e) {
+ throw die(e);
+ } catch (NameAlreadyUsedException e) {
+ throw die(e);
+ } catch (NoSuchGroupException e) {
+ throw die(e);
+ }
+ }
+ });
+ }
+}
diff --git a/pom.xml b/pom.xml
index a984a83..6a04b28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -790,7 +790,7 @@
<dependency>
<groupId>dk.brics.automaton</groupId>
<artifactId>automaton</artifactId>
- <version>1.11.2</version>
+ <version>1.11.8</version>
</dependency>
<dependency>