Skip to content
Permalink
Browse files
git-pr: support atomic integrations
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Feb 18, 2020
1 parent 16182f5 commit b2770574c4197ad78dc79f346dc495ed65a4c979
Showing with 18 additions and 1 deletion.
  1. +18 −1 cli/src/main/java/org/openjdk/skara/cli/GitPr.java
@@ -518,6 +518,10 @@ public static void main(String[] args) throws IOException, InterruptedException
.fullname("publish")
.helptext("Publish the local branch before creating the pull request")
.optional(),
Switch.shortcut("")
.fullname("atomic")
.helptext("Integrate the pull request atomically")
.optional(),
Switch.shortcut("")
.fullname("jcheck")
.helptext("Run jcheck before creating the pull request")
@@ -1074,7 +1078,20 @@ public static void main(String[] args) throws IOException, InterruptedException
} else if (action.equals("integrate")) {
var id = pullRequestIdArgument(arguments, repo);
var pr = getPullRequest(uri, repo, host, id);
var integrateComment = pr.addComment("/integrate");
var isAtomic = getSwitch("atomic", "integrate", arguments);

var message = "/integrate";
if (isAtomic) {
var targetHash = repo.resolve(pr.targetRef());
if (!targetHash.isPresent()) {
exit("error: cannot resolve target branch " + pr.targetRef());
}
var sourceHash = repo.fetch(pr.repository().webUrl(), pr.fetchRef());
var mergeBase = repo.mergeBase(sourceHash, targetHash.get());
message += " " + mergeBase.hex();
}

var integrateComment = pr.addComment(message);

var seenIntegrateComment = false;
var expected = "<!-- Jmerge command reply message (" + integrateComment.id() + ") -->";

0 comments on commit b277057

Please sign in to comment.