Skip to content
Permalink
Browse files
744: The "Webrevs" link in the PR has confusing link to the changes f…
…or just one commit

Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Mar 18, 2021
1 parent 60eb3a6 commit f16663b766fa02ced204bb1ca8d334a4ca776092
@@ -155,7 +155,7 @@ private void updateWebrevComment(List<Comment> comments, int index, List<WebrevD
comment += "### Webrevs" + "\n";
comment += webrevListMarker + "\n";
comment += " * " + String.format("%02d", index) + ": " + webrevDescriptions;
comment += " (" + pr.headHash() + ")\n";
comment += " (" + pr.filesUrl(pr.headHash()) + ")\n";

if (existing.isPresent()) {
if (existing.get().body().contains(webrevDescriptions)) {
@@ -314,4 +314,9 @@ public Diff diff() {
public Optional<HostUser> closedBy() {
return Optional.empty();
}

@Override
public URI filesUrl(Hash hash) {
return null;
}
}
@@ -161,4 +161,6 @@ public interface PullRequest extends Issue {
* @return
*/
void setTargetRef(String targetRef);

URI filesUrl(Hash hash);
}
@@ -738,4 +738,10 @@ public Optional<HostUser> closedBy() {
.reduce((a, b) -> b)
.map(e -> host.parseUserObject(e.get("actor")));
}

@Override
public URI filesUrl(Hash hash) {
var endpoint = "/" + repository.name() + "/pull/" + id() + "/files/" + hash.hex();
return host.getWebURI(endpoint);
}
}
@@ -788,4 +788,10 @@ public Optional<HostUser> closedBy() {

return Optional.of(host.parseAuthorObject(json.get("closed_by").asObject()));
}

@Override
public URI filesUrl(Hash hash) {
var endpoint = "/" + repository.name() + "/-/merge_requests/" + id() + "/diffs?commit_id=" + hash.hex();
return host.getWebUri(endpoint);
}
}
@@ -257,4 +257,9 @@ public Diff diff() {
throw new UncheckedIOException(e);
}
}

@Override
public URI filesUrl(Hash hash) {
return URI.create(webUrl().toString() + "/files/" + hash.hex());
}
}

1 comment on commit f16663b

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on f16663b Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.