Merge "Merge branch 'stable-2.11'"
This commit is contained in:
@@ -32,6 +32,7 @@ import com.google.gerrit.extensions.restapi.TopLevelResource;
|
||||
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.reviewdb.client.RefNames;
|
||||
@@ -207,6 +208,15 @@ public class CreateChange implements
|
||||
changeInserterFactory.create(refControl.getProjectControl(),
|
||||
change, c);
|
||||
|
||||
ChangeMessage msg = new ChangeMessage(new ChangeMessage.Key(change.getId(),
|
||||
ChangeUtil.messageUUID(db.get())),
|
||||
me.getAccountId(),
|
||||
ins.getPatchSet().getCreatedOn(),
|
||||
ins.getPatchSet().getId());
|
||||
msg.setMessage(String.format("Uploaded patch set %s.",
|
||||
ins.getPatchSet().getPatchSetId()));
|
||||
|
||||
ins.setMessage(msg);
|
||||
validateCommit(git, refControl, c, me, ins);
|
||||
updateRef(git, rw, c, change, ins.getPatchSet());
|
||||
|
||||
|
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.gerrit.common.data.Capable;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.extensions.restapi.AcceptsPost;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
@@ -84,6 +85,12 @@ public class PublishChangeEdit implements
|
||||
public Response<?> apply(ChangeResource rsrc, Publish.Input in)
|
||||
throws AuthException, ResourceConflictException, NoSuchChangeException,
|
||||
IOException, OrmException {
|
||||
Capable r =
|
||||
rsrc.getControl().getProjectControl().canPushToAtLeastOneRef();
|
||||
if (r != Capable.OK) {
|
||||
throw new AuthException(r.getMessage());
|
||||
}
|
||||
|
||||
Optional<ChangeEdit> edit = editUtil.byChange(rsrc.getChange());
|
||||
if (!edit.isPresent()) {
|
||||
throw new ResourceConflictException(String.format(
|
||||
|
@@ -84,6 +84,7 @@ public class SubmoduleSectionParser {
|
||||
final String url = bbc.getString("submodule", id, "url");
|
||||
final String path = bbc.getString("submodule", id, "path");
|
||||
String branch = bbc.getString("submodule", id, "branch");
|
||||
SubmoduleSubscription ss = null;
|
||||
|
||||
try {
|
||||
if (url != null && url.length() > 0 && path != null && path.length() > 0
|
||||
@@ -116,8 +117,10 @@ public class SubmoduleSectionParser {
|
||||
}
|
||||
Project.NameKey projectKey = new Project.NameKey(projectName);
|
||||
if (projectCache.get(projectKey) != null) {
|
||||
return new SubmoduleSubscription(superProjectBranch,
|
||||
new Branch.NameKey(projectKey, branch), path);
|
||||
ss = new SubmoduleSubscription(
|
||||
superProjectBranch,
|
||||
new Branch.NameKey(new Project.NameKey(projectName), branch),
|
||||
path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,6 +129,6 @@ public class SubmoduleSectionParser {
|
||||
// Error in url syntax (in fact it is uri syntax)
|
||||
}
|
||||
|
||||
return null;
|
||||
return ss;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user