Skip to content

[Branch View] manual merge tag #7979

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

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,7 @@ branch.restore_failed = Failed to restore branch '%s'.
branch.protected_deletion_failed = Branch '%s' is protected. It cannot be deleted.
branch.restore = Restore Branch '%s'
branch.download = Download Branch '%s'
branch.manual_merged = Branch was merged manually

topic.manage_topics = Manage Topics
topic.done = Done
Expand Down
7 changes: 7 additions & 0 deletions routers/repo/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Branch struct {
Commit *git.Commit
IsProtected bool
IsDeleted bool
IsMerged bool
DeletedBranch *models.DeletedBranch
CommitsAhead int
CommitsBehind int
Expand Down Expand Up @@ -203,10 +204,16 @@ func loadBranches(ctx *context.Context) []*Branch {
}
}

isMerged := true
if (divergence.Ahead != 0) || (divergence.Behind == 0) || (ctx.Repo.Repository.DefaultBranch == branchName) {
isMerged = false
}

branches[i] = &Branch{
Name: branchName,
Commit: commit,
IsProtected: isProtected,
IsMerged: isMerged,
CommitsAhead: divergence.Ahead,
CommitsBehind: divergence.Behind,
LatestPullRequest: pr,
Expand Down
6 changes: 5 additions & 1 deletion templates/repo/branch/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@
</td>
<td class="two wide right aligned">
{{if not .LatestPullRequest}}
{{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
{{if .IsMerged}}
<div class="ui poping up purple small label" data-content="{{$.i18n.Tr "repo.branch.manual_merged"}}" data-variation="tiny inverted" data-position="top right">
<i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.merged"}}
</div>
{{else if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
<a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
<button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button>
</a>
Expand Down