Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

382: List commits that have been pushed in integration message #602

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -442,7 +442,16 @@ private String getMergeReadyComment(String commitMessage, List<Review> reviews)
}
message.append("pushed to the `");
message.append(pr.targetRef());
message.append("` branch. ");
message.append("` branch:\n\n");
divergingCommits.stream()
.limit(10)
edvbld marked this conversation as resolved.
Show resolved Hide resolved
.forEach(c -> message.append(" * ").append(c.hash().hex()).append(": ").append(c.message().get(0)).append("\n"));
if (divergingCommits.size() > 10) {
message.append(" * ... and ").append(divergingCommits.size() - 10).append(" more: ")
.append(pr.repository().webUrl(baseHash.hex(), pr.targetRef())).append("\n");
}

message.append("\n");
message.append("As there are no conflicts, your changes will automatically be rebased on top of ");
message.append("these commits when integrating. If you prefer to avoid automatic rebasing, please merge `");
message.append(pr.targetRef());
@@ -528,6 +528,7 @@ void mergeMessage(TestInfo testInfo) throws IOException {
// The bot should reply with an ok message
var updated = pr.comments().stream()
.filter(comment -> comment.body().contains("there has been 1 commit"))
.filter(comment -> comment.body().contains(" * " + unrelatedHash.abbreviate()))
.filter(comment -> comment.body().contains("please merge"))
.count();
assertEquals(1, updated);
@@ -101,6 +101,11 @@ public URI webUrl(Hash hash) {
return null;
}

@Override
public URI webUrl(String baseRef, String headRef) {
return null;
}

@Override
public VCS repositoryType() {
return null;
@@ -58,6 +58,7 @@ PullRequest createPullRequest(HostedRepository target,
URI webUrl();
URI nonTransformedWebUrl();
URI webUrl(Hash hash);
URI webUrl(String baseRef, String headRef);
VCS repositoryType();
String fileContents(String filename, String ref);
String namespace();
@@ -200,6 +200,12 @@ public URI webUrl(Hash hash) {
return gitHubHost.getWebURI(endpoint);
}

@Override
public URI webUrl(String baseRef, String headRef) {
var endpoint = "/" + repository + "/compare/" + baseRef + "..." + headRef;
return gitHubHost.getWebURI(endpoint);
}

@Override
public VCS repositoryType() {
return VCS.GIT;
@@ -179,6 +179,13 @@ public URI webUrl(Hash hash) {
.build();
}

@Override
public URI webUrl(String baseRef, String headRef) {
return URIBuilder.base(gitLabHost.getUri())
.setPath("/" + projectName + "/compare/" + baseRef + "..." + headRef)
.build();
}

@Override
public VCS repositoryType() {
return VCS.GIT;
@@ -133,11 +133,12 @@ public URI nonTransformedWebUrl() {

@Override
public URI webUrl(Hash hash) {
try {
return new URI(url().toString() + "/" + hash.hex());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
return URI.create(url().toString() + "/" + hash.hex());
}

@Override
public URI webUrl(String baseRef, String headRef) {
return URI.create(url().toString() + "/" + baseRef + "..." + headRef);
}

@Override