Skip to content

Commit 545495d

Browse files
authored
Pull Requests: add button to compare force pushed commits (#22857)
To quickly see what changed without having to re-read the whole diff.
1 parent 0268ee5 commit 545495d

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

options/locale/locale_en-US.ini

+1
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,7 @@ issues.error_removing_due_date = "Failed to remove the due date."
14701470
issues.push_commit_1 = "added %d commit %s"
14711471
issues.push_commits_n = "added %d commits %s"
14721472
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`
1473+
issues.force_push_compare = Compare
14731474
issues.due_date_form = "yyyy-mm-dd"
14741475
issues.due_date_form_add = "Add due date"
14751476
issues.due_date_form_edit = "Edit"

templates/repo/issue/view_content/comments.tmpl

+5
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,11 @@
707707
{{$.locale.TrN (len .Commits) "repo.issues.push_commit_1" "repo.issues.push_commits_n" (len .Commits) $createdStr | Safe}}
708708
{{end}}
709709
</span>
710+
{{if and .IsForcePush $.Issue.PullRequest.BaseRepo.Name}}
711+
<span class="ui float right comparebox">
712+
<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>
713+
</span>
714+
{{end}}
710715
</div>
711716
{{if not .IsForcePush}}
712717
{{template "repo/commits_list_small" dict "comment" . "root" $}}

web_src/less/_repository.less

+11
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,17 @@
952952
margin-top: 4px;
953953
}
954954

955+
.comparebox {
956+
line-height: 32px;
957+
vertical-align: middle;
958+
959+
.compare.label {
960+
font-size: 1rem;
961+
margin: 0;
962+
border: 1px solid var(--color-light-border);
963+
}
964+
}
965+
955966
.comment-form-reply .footer {
956967
padding-bottom: 1em;
957968
}

0 commit comments

Comments
 (0)