1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
- merged = local_assigns.fetch(:merged, false)
- commit = @repository.commit(branch.dereferenced_target)
- related_merge_request = @related_merge_requests[branch.name]&.first
- mr_status = merge_request_status(related_merge_request)
- is_default_branch = branch.name == @repository.root_ref
%li{ class: "branch-item gl-display-flex! gl-align-items-center! js-branch-item js-branch-#{branch.name} gl-pl-5! gl-pr-2!", data: { name: branch.name, qa_selector: 'branch_container', qa_name: branch.name } }
.branch-info
.gl-display-flex.gl-align-items-center
= link_to project_tree_path(@project, branch.name, ref_type: 'heads'), class: 'item-title str-truncated-100 ref-name', data: { qa_selector: 'branch_link' } do
= branch.name
= clipboard_button(text: branch.name, title: _("Copy branch name"))
- if is_default_branch
= gl_badge_tag s_('DefaultBranchLabel|default'), { variant: :neutral, size: :sm }, { class: 'gl-ml-2' }
- if protected_branch?(@project, branch)
= gl_badge_tag s_('Branches|protected'), { variant: :muted, size: :sm }, { class: 'gl-ml-2' }
= render_if_exists 'projects/branches/diverged_from_upstream', branch: branch
.gl-text-truncate
- if commit
= render 'projects/branches/commit', commit: commit, project: @project
- else
= s_('Branches|Can’t find HEAD commit for this branch')
- if branch.name != @repository.root_ref
.js-branch-divergence-graph
.pipeline-status.d-none.d-md-block<
- if commit_status
= render 'ci/status/icon', size: 16, status: commit_status
- elsif show_commit_status
.gl-display-inline-flex.gl-vertical-align-middle.gl-mr-3
%svg.s16
.right-block.gl-display-flex.gl-align-items-center.gl-justify-content-end
.gl-mr-3
- if mr_status.present?
.issuable-reference.gl-display-flex.gl-justify-content-end.gl-overflow-hidden
= gl_badge_tag issuable_reference(related_merge_request),
{ icon: mr_status[:icon], variant: mr_status[:variant], size: :md, href: merge_request_path(related_merge_request) },
{ class: 'gl-display-block gl-text-truncate', title: mr_status[:title], data: { toggle: 'tooltip', container: 'body' } }
- elsif mr_status.nil? && create_mr_button?(from: branch.name, source_project: @project)
= render Pajamas::ButtonComponent.new(icon: 'merge-request', href: create_mr_path(from: branch.name, source_project: @project), button_options: { class: 'has-tooltip', title: _('New merge request') }) do
= _('New')
= render 'projects/buttons/download', project: @project, ref: branch.name, pipeline: @refs_pipelines[branch.name], css_class: 'gl-mr-2!'
.gl-w-7
- if !is_default_branch
.js-branch-more-actions{ data: {
branch_name: branch.name,
default_branch_name: @repository.root_ref,
can_delete_branch: user_access(@project).can_delete_branch?(branch.name).to_s,
is_protected_branch: protected_branch?(@project, branch).to_s,
merged: merged.to_s,
compare_path: project_compare_index_path(@project, from: @repository.root_ref, to: branch.name),
delete_path: project_branch_path(@project, branch.name),
} }
|