Merge branch 'stable-2.7'

* stable-2.7:
  Check that patch set is current before doing a rebase
  Add trailing period on "This reverts commit ..." line
  Release notes for Gerrit 2.7
  Documentation: Reverse Proxy Configuration
  Fix: push bypass review cannot close change from UI
  Fix: 'change_key' of current patchset pushed by 'refs/changes' is still old one.
  Update the release notes for 2.6

Conflicts:
	gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.properties

Change-Id: I3f8d7ab5bafd0274cd5d29afe7b746c2e1951674
This commit is contained in:
Shawn Pearce
2013-06-08 18:55:23 -07:00
9 changed files with 349 additions and 41 deletions

View File

@@ -28,37 +28,40 @@ during 'init'.
Apache 2 Configuration
----------------------
To run Gerrit behind an Apache server we cannot use 'mod_proxy'
directly, as Gerrit relies on getting unmodified escaped forward
slashes. Depending on the setting of 'AllowEncodedSlashes',
'mod_proxy' would either decode encoded slashes, or encode them once
again. Hence, we resort to using 'mod_rewrite'. To enable the
To run Gerrit behind an Apache server using 'mod_proxy', enable the
necessary Apache2 modules:
----
a2enmod rewrite
a2enmod proxy_http
a2enmod ssl ; # optional, needed for HTTPS / SSL
----
Configure an Apache VirtualHost to proxy to the Gerrit daemon, setting
the 'RewriteRule' line to use the 'http://' URL configured above.
Ensure the path of 'RewriteRule' (the part before '$1') and
httpd.listenUrl match, or links will redirect to incorrect locations.
Note that this configuration allows to pass encoded characters to the
virtual host, which is potentially dangerous. Be sure to read up on
this topic and that you understand the risks.
Configure an Apache VirtualHost to proxy to the Gerrit daemon,
setting the 'ProxyPass' line to use the 'http://' URL configured
above. Ensure the path of ProxyPass and httpd.listenUrl match,
or links will redirect to incorrect locations.
----
<VirtualHost *>
ServerName review.example.com
AllowEncodedSlashes NoDecode
RewriteEngine On
RewriteRule ^/r/(.*) http://localhost:8081/r/$1 [NE,P]
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
AllowEncodedSlashes On
ProxyPass /r/ http://127.0.0.1:8081/r/ nocanon
</VirtualHost>
----
The two options 'AllowEncodedSlashes On' and 'ProxyPass .. nocanon' are required
since Gerrit 2.6.
SSL
~~~
@@ -80,6 +83,15 @@ See the Apache 'mod_ssl' documentation for more details on how to
configure SSL within the server, like controlling how strong of an
encryption algorithm is required.
Troubleshooting
~~~~~~~~~~~~~~~
If you are encountering 'Page Not Found' errors when opening the change
screen, your Apache proxy is very likely decoding the passed URL.
Make sure to either use 'AllowEncodedSlashes On' together with
'ProxyPass .. nodecode' or alternatively a 'mod_rewrite' configuration with
'AllowEncodedSlashes NoDecode' set.
Nginx Configuration
-------------------
@@ -124,6 +136,14 @@ See the Nginx 'http ssl module' documentation for more details on
how to configure SSL within the server, like controlling how strong
of an encryption algorithm is required.
Troubleshooting
~~~~~~~~~~~~~~~
If you are encountering 'Page Not Found' errors when opening the change
screen, your Nginx proxy is very likely decoding the passed URL.
Make sure to use a 'proxy_pass' URL without any path (esp. no trailing
'/' after the 'host:port').
GERRIT
------
Part of link:index.html[Gerrit Code Review]

View File

@@ -23,6 +23,17 @@ Schema Change
a later 2.1.x version), and then to 2.6.x. If you are upgrading from 2.2.x.x or
newer, you may ignore this warning and upgrade directly to 2.6.x.
Reverse Proxy Configuration Changes
-----------------------------------
If you are running a reverse proxy in front of Gerrit (e.g. Apache or Nginx),
make sure to check your configuration, especially if you are encountering
'Page Not Found' errors when opening the change screen.
See the link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/config-reverseproxy.html[
Reverse Proxy Configuration] for details.
Gerrit now requires passed URLs to be unchanged by the proxy.
Release Highlights
------------------
* 42x improvement on `git clone` and `git fetch`
@@ -437,13 +448,6 @@ responses are protected from accidential sniffing and treatment as
HTML thanks to Gson encoding HTML control characters using Unicode
character escapes within JSON strings.
* Apache reverse proxies must switch to mod_rewrite
+
When Apache is used as a reverse proxy the server must be reconfigured
to use mod_rewrite and AllowEncodedSlashes. For updated information
link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/config-reverseproxy.html#_apache_2_configuration[
review the Apache 2 Configuration documentation].
Project Dashboards
~~~~~~~~~~~~~~~~~~
* link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/user-dashboards.html#project-dashboards[
@@ -1222,6 +1226,13 @@ confusing.
* Prevent account's full name from being set to empty string. Set it to
null instead.
* link:https://code.google.com/p/gerrit/issues/detail?id=1682[Issue 1682]:
Correctly handle paths with URL-escaped characters
+
URL-unescape the path portion of a change history token to correctly
handle paths with URL-escapable characters, i.e. '+', ' ', etc.
REST API
~~~~~~~~
* Fix returning of 'Email Reviewers' capability via REST

View File

@@ -0,0 +1,249 @@
Release notes for Gerrit 2.7
============================
Gerrit 2.7 is now available:
link:http://code.google.com/p/gerrit/downloads/detail?name=gerrit-2.7.war[
http://code.google.com/p/gerrit/downloads/detail?name=gerrit-2.7.war]
Schema Change
-------------
*WARNING:* This release contains schema changes. To upgrade:
----
java -jar gerrit.war init -d site_path
----
*WARNING:* Upgrading to 2.7.x requires the server be first upgraded to 2.1.7 (or
a later 2.1.x version), and then to 2.7.x. If you are upgrading from 2.2.x.x or
newer, you may ignore this warning and upgrade directly to 2.7.x.
Release Highlights
------------------
* New `copyMaxScore` setting for labels.
* Comment links configurable per project.
* Themes configurable per project.
* Better support for binary files and images in diff screens.
* User avatars.
* Several new REST APIs.
New Features
------------
General
~~~~~~~
* New `copyMaxScore` setting for labels.
+
Labels can be link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/config-labels.html#label_copyMaxScore[
configured] to copy approvals forward to the next patch set.
* Comment links can be link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/config-gerrit.html#commentlink[
defined per project in the project configuration].
* Gerrit administrators can define project-specific themes.
+
Themes can be link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/config-themes.html[
configured site-wide or per project].
* New '/a/tools' URL.
+
This allows users to download the `commit-msg` hook via the command line if the
Gerrit server requires authentication globally.
* New 'Stream Events' global capability.
+
The link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/access-control.txt#capability_streamEvents[
Stream Events capability] controls access to the `stream-events` ssh command.
+
Only administrators and users having this capability are allowed to use `stream-events`.
* Allow opening new changes on existing commits.
+
The %base argument can be used with refs/for/ to identify a specific revision the server should
start to look for new commits at. Any commits in the range $base..$tip will be opened as a new
change, even if the commit already has another change on a different branch.
* New setting `gitweb.linkDrafts` to control if gitweb links are shown on drafts.
+
By default, Gerrit will show links to gitweb on all patch sets. If the
link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/config-gerrit.html#gitweb.linkDrafts[
gitweb.linkDrafts setting] is set to 'false', links will not be shown on
draft patch sets.
* Allow changes to be automatically submitted on push.
+
Teams that want to use Gerrit's submit strategies to handle contention on busy
branches can use %submit to create a change and have it
link:link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/user-upload.html#auto_merge[
immediately submitted], if the caller has Submit permission on refs/for/<ref>.
Web UI
~~~~~~
Global
^^^^^^
* The search box no longer automatically resizes. Its width is fixed at 70 pixels.
* User avatars are displayed in several places in the Web UI. "Diffy" is used as
avatar for the Gerrit server itself.
Change Screens
^^^^^^^^^^^^^^
* link:https://code.google.com/p/gerrit/issues/detail?id=667[Issue 667]:
Highlight patch sets that have drafts.
+
Patch sets having unpublished draft comments are higlighted with an icon.
* Option to show relative times in change tables.
+
A new preference setting allows the user to decide if absolute or relative dates
should be shown in change tables.
* Option to set default visibility of change comments.
+
A new preference setting allows the user to set the default visibility of
change comments.
Diff Screens
^^^^^^^^^^^^
* Show images in side-by-side and unified diffs
* Show diffed images above/below each other in unified diffs.
* Harmonize unified diff's styling of images with that of text
REST API
~~~~~~~~
Several new link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/rest-api.html[
REST API endpoints] are added.
Accounts
^^^^^^^^
* link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/rest-api-accounts.html#get-diff-preferences[
Get account diff preferences]
* link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/rest-api-accounts.html#set-diff-preferences[
Set account diff preferences]
Changes
^^^^^^^
* link:https://code.google.com/p/gerrit/issues/detail?id=1820[Issue 1820]:
link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/rest-api-changes.html#list-comments[
List comments]
* link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/rest-api-changes.html#get-comment[
Get comment]
Projects
^^^^^^^^
* link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/rest-api-projects.html#get-config[
Get project configuration]
ssh
~~~
* link:https://code.google.com/p/gerrit/issues/detail?id=1088[Issue 1088]:
Support link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/config-gerrit.html#sshd.kerberosKeytab[
Kerberos authentication for ssh interaction].
Bug Fixes
---------
General
~~~~~~~
* Postpone check for first account until adding an account.
Web UI
~~~~~~
* link:https://code.google.com/p/gerrit/issues/detail?id=1848[Issue 1848]:
Don't discard inline comments when escape key is pressed.
* link:https://code.google.com/p/gerrit/issues/detail?id=1863[Issue 1863]:
Drop Arial Unicode MS font and request only sans-serif.
+
Arial Unicode MS does not have a bold version. Selecting this font prevents
correct display of bold text on Mac OS X. Simplify the selector to sans-serif
and allow the browser to use the user's preferred font in this family.
REST API
~~~~~~~~
* link:https://code.google.com/p/gerrit/issues/detail?id=1819[Issue 1819]:
Include change-level messages to the payload returned from
the link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/rest-api-changes#get-change-detail[
Get Change Detail REST API endpoint].
Email
~~~~~
* Log failure to access reviewer list for notification emails
* Log when appropriate if email delivery is skipped.
Tools
~~~~~
* The release build now builds for all browser configurations.
Upgrades
--------
* `gwtexpui` is now built in the gerrit tree rather than linking a separate module.
Documentation
-------------
* Update the access control documentation to clarify how to set
link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/access-control.html#global_capabilities[
global capabilities].
* Clarify the
link:http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/config-gerrit.html#cache_names[
change cache configuration]

View File

@@ -1,6 +1,11 @@
Gerrit Code Review - Release Notes
==================================
[[2_7]]
Version 2.7.x
-------------
* link:ReleaseNotes-2.7.html[2.7]
[[2_6]]
Version 2.6.x
-------------

View File

@@ -5,7 +5,7 @@ changesOpenInProject = Open Changes In {0}
changesMergedInProject = Merged Changes In {0}
changesAbandonedInProject = Abandoned Changes In {0}
revertChangeDefaultMessage = Revert \"{0}\"\n\nThis reverts commit {1}
revertChangeDefaultMessage = Revert \"{0}\"\n\nThis reverts commit {1}.
cherryPickedChangeDefaultMessage = {0}\n(cherry picked from commit {1})
changeScreenTitleId = Change {0}

View File

@@ -49,6 +49,15 @@
&lt;VirtualHost <span class='ServerName'>review.example.com</span><span class='ServerPort'>:80</span>&gt;
ServerName <span class='ServerName'>review.example.com</span>
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
&lt;Proxy *&gt;
Order deny,allow
Allow from all
&lt;/Proxy&gt;
<div class='apache_auth'> &lt;Location <span class='ContextPath'>/r</span>/login/&gt;
AuthType Basic
AuthName "Gerrit Code Review"
@@ -56,9 +65,8 @@
...
&lt;/Location&gt;</div>
AllowEncodedSlashes NoDecode
RewriteEngine On
RewriteRule ^<span class='ContextPath'>/r</span>/(.*) http://...<span class='ContextPath'>/r</span>/$1 [NE,P]
AllowEncodedSlashes On
ProxyPass <span class='ContextPath'>/r</span>/ http://...<span class='ContextPath'>/r</span>/ nodecode
&lt;/VirtualHost&gt;
</pre>
</body>

View File

@@ -321,6 +321,9 @@ public class RebaseChange {
OrmException, IOException, InvalidChangeOperationException,
PathConflictException {
Change change = chg;
if (!chg.currentPatchSetId().equals(patchSetId)) {
throw new InvalidChangeOperationException("patch set is not current");
}
final PatchSet originalPatchSet = db.patchSets().get(patchSetId);
final RevCommit rebasedCommit;

View File

@@ -32,10 +32,12 @@ import com.google.common.base.Strings;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
@@ -285,7 +287,7 @@ public class ReceiveCommits {
private final Set<RevCommit> validCommits = new HashSet<RevCommit>();
private ListMultimap<Change.Id, Ref> refsByChange;
private Map<ObjectId, Ref> refsById;
private SetMultimap<ObjectId, Ref> refsById;
private Map<String, Ref> allRefs;
private final SubmoduleOp.Factory subOpFactory;
@@ -1886,6 +1888,14 @@ public class ReceiveCommits {
}
change.setLastSha1MergeTested(null);
change.setCurrentPatchSet(info);
final List<String> idList = newCommit.getFooterLines(CHANGE_ID);
if (idList.isEmpty()) {
change.setKey(new Change.Key("I" + newCommit.name()));
} else {
change.setKey(new Change.Key(idList.get(idList.size() - 1).trim()));
}
ChangeUtil.updated(change);
return change;
}
@@ -2100,20 +2110,22 @@ public class ReceiveCommits {
rw.markUninteresting(rw.parseCommit(cmd.getOldId()));
}
final Map<ObjectId, Ref> byCommit = changeRefsById();
final SetMultimap<ObjectId, Ref> byCommit = changeRefsById();
final Map<Change.Key, Change.Id> byKey = openChangesByKey(
new Branch.NameKey(project.getNameKey(), cmd.getRefName()));
final List<ReplaceRequest> toClose = new ArrayList<ReplaceRequest>();
RevCommit c;
while ((c = rw.next()) != null) {
final Ref ref = byCommit.get(c.copy());
if (ref != null) {
rw.parseBody(c);
Change.Key closedChange =
closeChange(cmd, PatchSet.Id.fromRef(ref.getName()), c);
closeProgress.update(1);
if (closedChange != null) {
byKey.remove(closedChange);
final Set<Ref> refs = byCommit.get(c.copy());
for (Ref ref : refs) {
if (ref != null) {
rw.parseBody(c);
Change.Key closedChange =
closeChange(cmd, PatchSet.Id.fromRef(ref.getName()), c);
closeProgress.update(1);
if (closedChange != null) {
byKey.remove(closedChange);
}
}
}
@@ -2193,9 +2205,9 @@ public class ReceiveCommits {
return change.getKey();
}
private Map<ObjectId, Ref> changeRefsById() throws IOException {
private SetMultimap<ObjectId, Ref> changeRefsById() throws IOException {
if (refsById == null) {
refsById = new HashMap<ObjectId, Ref>();
refsById = HashMultimap.create();
for (Ref r : repo.getRefDatabase().getRefs("refs/changes/").values()) {
if (PatchSet.isRef(r.getName())) {
refsById.put(r.getObjectId(), r);

View File

@@ -1,6 +1,6 @@
# Changes to this file should also be made in
# gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.properties
revertChangeDefaultMessage = Revert \"{0}\"\n\nThis reverts commit {1}
revertChangeDefaultMessage = Revert \"{0}\"\n\nThis reverts commit {1}.
reviewerNotFound = {0} does not identify a registered user or group
groupIsNotAllowed = The group {0} cannot be added as reviewer.