Pull Requests: add button to compare force pushed commits (#22857)

To quickly see what changed without having to re-read the whole diff.
This commit is contained in:
Brecht Van Lommel 2023-03-01 20:19:47 +01:00 committed by GitHub
parent 0268ee5c37
commit 545495dcb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View file

@ -1470,6 +1470,7 @@ issues.error_removing_due_date = "Failed to remove the due date."
issues.push_commit_1 = "added %d commit %s" issues.push_commit_1 = "added %d commit %s"
issues.push_commits_n = "added %d commits %s" issues.push_commits_n = "added %d commits %s"
issues.force_push_codes = `force-pushed %[1]s from <a class="ui sha" href="%[3]s"><code>%[2]s</code></a> to <a class="ui sha" href="%[5]s"><code>%[4]s</code></a> %[6]s` issues.force_push_codes = `force-pushed %[1]s from <a class="ui sha" href="%[3]s"><code>%[2]s</code></a> to <a class="ui sha" href="%[5]s"><code>%[4]s</code></a> %[6]s`
issues.force_push_compare = Compare
issues.due_date_form = "yyyy-mm-dd" issues.due_date_form = "yyyy-mm-dd"
issues.due_date_form_add = "Add due date" issues.due_date_form_add = "Add due date"
issues.due_date_form_edit = "Edit" issues.due_date_form_edit = "Edit"

View file

@ -707,6 +707,11 @@
{{$.locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}} {{$.locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}}
{{end}} {{end}}
</span> </span>
{{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}}
<span class="ui float right comparebox">
<a href="{{$.Issue.PullRequest.BaseRepo.Link}}/compare/{{PathEscape .OldCommit}}..{{PathEscape .NewCommit}}" rel="nofollow" class="ui compare label">{{$.locale.Tr "repo.issues.force_push_compare"}}</a>
</span>
{{end}}
</div> </div>
{{if not .IsForcePush}} {{if not .IsForcePush}}
{{template "repo/commits_list_small" dict "comment" . "root" $}} {{template "repo/commits_list_small" dict "comment" . "root" $}}

View file

@ -952,6 +952,17 @@
margin-top: 4px; margin-top: 4px;
} }
.comparebox {
line-height: 32px;
vertical-align: middle;
.compare.label {
font-size: 1rem;
margin: 0;
border: 1px solid var(--color-light-border);
}
}
.comment-form-reply .footer { .comment-form-reply .footer {
padding-bottom: 1em; padding-bottom: 1em;
} }