summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/git/PatchsetReceivePack.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-03-06 13:36:23 -0500
committerJames Moger <james.moger@gitblit.com>2014-03-06 13:36:23 -0500
commit9883341c1fbb35abcb7a1d09f93f6a9e805ea551 (patch)
tree861c1aeb430e2c8a896873ad249734ebf5e4701c /src/main/java/com/gitblit/git/PatchsetReceivePack.java
parente462bbf2974d33f1a5a0b2a808e150aa0e22d6f4 (diff)
downloadgitblit-9883341c1fbb35abcb7a1d09f93f6a9e805ea551.tar.gz
gitblit-9883341c1fbb35abcb7a1d09f93f6a9e805ea551.zip
Revise push/mirror tickets branch triggering
Diffstat (limited to 'src/main/java/com/gitblit/git/PatchsetReceivePack.java')
-rw-r--r--src/main/java/com/gitblit/git/PatchsetReceivePack.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/main/java/com/gitblit/git/PatchsetReceivePack.java b/src/main/java/com/gitblit/git/PatchsetReceivePack.java
index 2044f604..c0ab8aeb 100644
--- a/src/main/java/com/gitblit/git/PatchsetReceivePack.java
+++ b/src/main/java/com/gitblit/git/PatchsetReceivePack.java
@@ -60,6 +60,7 @@ import com.gitblit.models.TicketModel.Patchset;
import com.gitblit.models.TicketModel.PatchsetType;
import com.gitblit.models.TicketModel.Status;
import com.gitblit.models.UserModel;
+import com.gitblit.tickets.BranchTicketService;
import com.gitblit.tickets.ITicketService;
import com.gitblit.tickets.TicketMilestone;
import com.gitblit.tickets.TicketNotifier;
@@ -105,7 +106,7 @@ public class PatchsetReceivePack extends GitblitReceivePack {
protected final TicketNotifier ticketNotifier;
- private boolean requireCleanMerge;
+ private boolean requireMergeablePatchset;
public PatchsetReceivePack(IGitblit gitblit, Repository db, RepositoryModel repository, UserModel user) {
super(gitblit, db, repository, user);
@@ -257,12 +258,26 @@ public class PatchsetReceivePack extends GitblitReceivePack {
/** Execute commands to update references. */
@Override
protected void executeCommands() {
+ // we process patchsets unless the user is pushing something special
+ boolean processPatchsets = true;
+ for (ReceiveCommand cmd : filterCommands(Result.NOT_ATTEMPTED)) {
+ if (ticketService instanceof BranchTicketService
+ && BranchTicketService.BRANCH.equals(cmd.getRefName())) {
+ // the user is pushing an update to the BranchTicketService data
+ processPatchsets = false;
+ }
+ }
+
// workaround for JGit's awful scoping choices
//
// reset the patchset refs to NOT_ATTEMPTED (see validateCommands)
for (ReceiveCommand cmd : filterCommands(Result.OK)) {
if (isPatchsetRef(cmd.getRefName())) {
cmd.setResult(Result.NOT_ATTEMPTED);
+ } else if (ticketService instanceof BranchTicketService
+ && BranchTicketService.BRANCH.equals(cmd.getRefName())) {
+ // the user is pushing an update to the BranchTicketService data
+ processPatchsets = false;
}
}
@@ -292,7 +307,7 @@ public class PatchsetReceivePack extends GitblitReceivePack {
continue;
}
- if (isPatchsetRef(cmd.getRefName())) {
+ if (isPatchsetRef(cmd.getRefName()) && processPatchsets) {
if (ticketService == null) {
sendRejection(cmd, "Sorry, the ticket service is unavailable and can not accept patchsets at this time.");
continue;
@@ -393,6 +408,8 @@ public class PatchsetReceivePack extends GitblitReceivePack {
for (ReceiveCommand cmd : toApply) {
if (cmd.getResult() == Result.NOT_ATTEMPTED) {
sendRejection(cmd, "lock error: {0}", err.getMessage());
+ LOGGER.error(MessageFormat.format("failed to lock {0}:{1}",
+ repository.name, cmd.getRefName()), err);
}
}
}
@@ -539,7 +556,7 @@ public class PatchsetReceivePack extends GitblitReceivePack {
case MERGEABLE:
break;
default:
- if (ticket == null || requireCleanMerge) {
+ if (ticket == null || requireMergeablePatchset) {
sendError("");
sendError("Your patchset can not be cleanly merged into {0}.", forBranch);
sendError("Please rebase your patchset and push again.");