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

744: The "Webrevs" link in the PR has confusing link to the changes for just one commit #1077

Closed
wants to merge 1 commit into from
Closed
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
@@ -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());
}
}