Skip to content
Permalink
Browse files
merge-bot: clearer merge messages when merging between repos
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Feb 7, 2020
1 parent b5f9228 commit 19f5473d8ae9559581afcbf4d4a84e21f1fa6b89
@@ -391,7 +391,10 @@ public void run(Path scratchPath) {
if (error == null) {
log.info("Pushing successful merge");
if (!isAncestor) {
repo.commit("Automatic merge of " + fromBranch + " into " + toBranch,
var targetName = Path.of(target.name()).getFileName();
var fromName = Path.of(fromRepo.name()).getFileName();
var fromDesc = targetName.equals(fromName) ? fromBranch : fromName + ":" + fromBranch;
repo.commit("Automatic merge of " + fromDesc + " into " + toBranch,
"duke", "duke@openjdk.org");
}
repo.push(toBranch, target.url().toString(), false);
@@ -109,7 +109,7 @@ void mergeMasterBranch(TestInfo testInfo) throws IOException {
var known = Set.of(toHashA, fromHashB, toHashC);
var merge = toCommits.stream().filter(c -> !known.contains(c.hash())).findAny().get();
assertTrue(merge.isMerge());
assertEquals(List.of("Automatic merge of master into master"), merge.message());
assertEquals(List.of("Automatic merge of test:master into master"), merge.message());
assertEquals("duke", merge.author().name());
assertEquals("duke@openjdk.org", merge.author().email());

@@ -538,7 +538,7 @@ void testMergeHourly(TestInfo testInfo) throws IOException {
var known = Set.of(toHashA, fromHashB, toHashC);
var merge = toCommits.stream().filter(c -> !known.contains(c.hash())).findAny().get();
assertTrue(merge.isMerge());
assertEquals(List.of("Automatic merge of master into master"), merge.message());
assertEquals(List.of("Automatic merge of test:master into master"), merge.message());
assertEquals("duke", merge.author().name());
assertEquals("duke@openjdk.org", merge.author().email());

@@ -583,7 +583,7 @@ void testMergeDaily(TestInfo testInfo) throws IOException {
var toGitConfig = toDir.resolve(".git").resolve("config");
Files.write(toGitConfig, List.of("[receive]", "denyCurrentBranch = ignore"),
StandardOpenOption.APPEND);
var toHostedRepo = new TestHostedRepository(host, "test-mirror", toLocalRepo);
var toHostedRepo = new TestHostedRepository(host, "test", toLocalRepo);

var forkDir = temp.path().resolve("fork.git");
var forkLocalRepo = Repository.init(forkDir, VCS.GIT);
@@ -774,7 +774,7 @@ void testMergeWeekly(TestInfo testInfo) throws IOException {
var known = Set.of(toHashA, fromHashB, toHashC);
var merge = toCommits.stream().filter(c -> !known.contains(c.hash())).findAny().get();
assertTrue(merge.isMerge());
assertEquals(List.of("Automatic merge of master into master"), merge.message());
assertEquals(List.of("Automatic merge of test:master into master"), merge.message());
assertEquals("duke", merge.author().name());
assertEquals("duke@openjdk.org", merge.author().email());

@@ -825,7 +825,7 @@ void testMergeMonthly(TestInfo testInfo) throws IOException {
var toGitConfig = toDir.resolve(".git").resolve("config");
Files.write(toGitConfig, List.of("[receive]", "denyCurrentBranch = ignore"),
StandardOpenOption.APPEND);
var toHostedRepo = new TestHostedRepository(host, "test-mirror", toLocalRepo);
var toHostedRepo = new TestHostedRepository(host, "test", toLocalRepo);

var forkDir = temp.path().resolve("fork.git");
var forkLocalRepo = Repository.init(forkDir, VCS.GIT);
@@ -946,7 +946,7 @@ void testMergeYearly(TestInfo testInfo) throws IOException {
var toGitConfig = toDir.resolve(".git").resolve("config");
Files.write(toGitConfig, List.of("[receive]", "denyCurrentBranch = ignore"),
StandardOpenOption.APPEND);
var toHostedRepo = new TestHostedRepository(host, "test-mirror", toLocalRepo);
var toHostedRepo = new TestHostedRepository(host, "test", toLocalRepo);

var forkDir = temp.path().resolve("fork.git");
var forkLocalRepo = Repository.init(forkDir, VCS.GIT);

0 comments on commit 19f5473

Please sign in to comment.