Merge branch 'stable-2.9'
* stable-2.9:
Only permit current patch set to edit the commit message
Use Provider for IdentifiedUser in CreateBranch constructor
Split PGPEncryptedDataGenerator creation out into a utility method
ChangeScreen2: Only reset the commit message text on cancel
Fix log spew caused by DeleteBranch constructor
Add Documentation menu entry for Project Owner Guide
Mention project-specific themes in the project owner guide
Added global request handlers to SshDaemon
diff --git a/Documentation/intro-project-owner.txt b/Documentation/intro-project-owner.txt
index 84f482b..64df285 100644
--- a/Documentation/intro-project-owner.txt
+++ b/Documentation/intro-project-owner.txt
@@ -547,6 +547,18 @@
are inherited by the child projects. A child project can overwrite an
inherited download command, or remove it by assigning no value to it.
+[[theme]]
+== Theme
+
+Gerrit supports project-specific themes for customizing the appearance
+of the change screen and the diff screens. It is possible to define an
+HTML header and footer and to adapt Gerrit's CSS. Details about themes
+are explained in the link:config-themes.html[Themes] section.
+
+Project-specific themes can only be installed by Gerrit administrators
+since the theme files must be copied into the Gerrit installation
+folder.
+
[[tool-integration]]
== Integration with other tools
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
index 6db8180..dd9a28b 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
@@ -689,6 +689,7 @@
addDocLink(m, C.menuDocumentationUpload(), "user-upload.html");
addDocLink(m, C.menuDocumentationAccess(), "access-control.html");
addDocLink(m, C.menuDocumentationAPI(), "rest-api.html");
+ addDocLink(m, C.menuDocumentationProjectOwnerGuide(), "intro-project-owner.html");
menuLeft.add(m, C.menuDocumentation());
}
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 a93dda5..5ba520c 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
@@ -91,6 +91,7 @@
String menuDocumentationUpload();
String menuDocumentationAccess();
String menuDocumentationAPI();
+ String menuDocumentationProjectOwnerGuide();
String searchHint();
String searchButton();
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 38498f3..58a6d08 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
@@ -74,6 +74,7 @@
menuDocumentationUpload = Uploading
menuDocumentationAccess = Access Controls
menuDocumentationAPI = REST API
+menuDocumentationProjectOwnerGuide = Project Owner Guide
searchHint = Search term
searchButton = Search
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/EditMessage.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/EditMessage.java
index 3477d45..b1a3290 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/EditMessage.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/EditMessage.java
@@ -65,6 +65,11 @@
ResourceNotFoundException, EmailException, OrmException, IOException {
if (Strings.isNullOrEmpty(input.message)) {
throw new BadRequestException("message must be non-empty");
+ } else if (!rsrc.getPatchSet().getId()
+ .equals(rsrc.getChange().currentPatchSetId())) {
+ throw new ResourceConflictException(String.format(
+ "revision %s is not current revision",
+ rsrc.getPatchSet().getRevision().get()));
}
try {
return json.format(changeUtil.editCommitMessage(
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java
index 8e8c844..3dcf9f4 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/CreateBranch.java
@@ -32,6 +32,7 @@
import com.google.gerrit.server.project.ListBranches.BranchInfo;
import com.google.gerrit.server.util.MagicBranch;
import com.google.inject.Inject;
+import com.google.inject.Provider;
import com.google.inject.assistedinject.Assisted;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
@@ -64,14 +65,15 @@
CreateBranch create(String ref);
}
- private final IdentifiedUser identifiedUser;
+ private final Provider<IdentifiedUser> identifiedUser;
private final GitRepositoryManager repoManager;
private final GitReferenceUpdated referenceUpdated;
private final ChangeHooks hooks;
private String ref;
@Inject
- CreateBranch(IdentifiedUser identifiedUser, GitRepositoryManager repoManager,
+ CreateBranch(Provider<IdentifiedUser> identifiedUser,
+ GitRepositoryManager repoManager,
GitReferenceUpdated referenceUpdated, ChangeHooks hooks,
@Assisted String ref) {
this.identifiedUser = identifiedUser;
@@ -135,7 +137,7 @@
final RefUpdate u = repo.updateRef(ref);
u.setExpectedOldObjectId(ObjectId.zeroId());
u.setNewObjectId(object.copy());
- u.setRefLogIdent(identifiedUser.newRefLogIdent());
+ u.setRefLogIdent(identifiedUser.get().newRefLogIdent());
u.setRefLogMessage("created via REST from " + input.revision, false);
final RefUpdate.Result result = u.update(rw);
switch (result) {
@@ -143,7 +145,7 @@
case NEW:
case NO_CHANGE:
referenceUpdated.fire(name.getParentKey(), u);
- hooks.doRefUpdatedHook(name, u, identifiedUser.getAccount());
+ hooks.doRefUpdatedHook(name, u, identifiedUser.get().getAccount());
break;
case LOCK_FAILURE:
if (repo.getRef(ref) != null) {
diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java
index f507920..11c58c8 100644
--- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java
+++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshDaemon.java
@@ -45,6 +45,7 @@
import org.apache.sshd.common.KeyExchange;
import org.apache.sshd.common.KeyPairProvider;
import org.apache.sshd.common.NamedFactory;
+import org.apache.sshd.common.RequestHandler;
import org.apache.sshd.common.Session;
import org.apache.sshd.common.Signature;
import org.apache.sshd.common.SshdSocketAddress;
@@ -80,6 +81,7 @@
import org.apache.sshd.common.random.JceRandom;
import org.apache.sshd.common.random.SingletonRandomFactory;
import org.apache.sshd.common.session.AbstractSession;
+import org.apache.sshd.common.session.ConnectionService;
import org.apache.sshd.common.signature.SignatureDSA;
import org.apache.sshd.common.signature.SignatureRSA;
import org.apache.sshd.common.util.Buffer;
@@ -92,6 +94,10 @@
import org.apache.sshd.server.auth.gss.GSSAuthenticator;
import org.apache.sshd.server.auth.gss.UserAuthGSS;
import org.apache.sshd.server.channel.ChannelSession;
+import org.apache.sshd.server.global.CancelTcpipForwardHandler;
+import org.apache.sshd.server.global.KeepAliveHandler;
+import org.apache.sshd.server.global.NoMoreSessionsHandler;
+import org.apache.sshd.server.global.TcpipForwardHandler;
import org.apache.sshd.server.kex.DHG1;
import org.apache.sshd.server.kex.DHG14;
import org.apache.sshd.server.session.SessionFactory;
@@ -149,6 +155,7 @@
private volatile IoAcceptor acceptor;
private final Config cfg;
+ @SuppressWarnings("unchecked")
@Inject
SshDaemon(final CommandFactory commandFactory, final NoShell noShell,
final PublickeyAuthenticator userAuth,
@@ -257,6 +264,12 @@
return new GerritServerSession(server, ioSession);
}
});
+ setGlobalRequestHandlers(Arrays.<RequestHandler<ConnectionService>> asList(
+ new KeepAliveHandler(),
+ new NoMoreSessionsHandler(),
+ new TcpipForwardHandler(),
+ new CancelTcpipForwardHandler()
+ ));
hostKeys = computeHostKeys();
}