Project

General

Profile

Patch #38278 » improve_display_revision.patch

Fixed a problem with negated setting - Niklaus Giger, 2023-02-17 17:33

View differences:

app/helpers/repositories_helper.rb (working copy)
end
max_space
end
def has_branch_detail?
@repository.scm.respond_to? :branch_contains
end
def insert_branches_detail(html)
return html unless has_branch_detail?
substring = '</li>'
location = html.index(substring).to_i + substring.length
html.insert(location, branches_html)
end
def branches_html
content_tag(:li) do
content = content_tag(:strong, "#{l(:label_branch)}")
content << " "
content << "#{@repository.identifier}@ "
content << links_to_branches.join(', ').html_safe
end
end
def links_to_branches
return [] unless has_branch_detail?
branch_groups.map { |name, branches| branches_link(name, branches) }
end
def branches_link(name, branches)
return branch_link(branches.first) if branches.length == 1
link = link_to("[#{name}...]", 'javascript:;', class: 'scm-branch-group').html_safe
content_tag(:span, class: 'scm-branch-hide') do
link << content_tag(:span, class: 'scm-branches') do
branches.map { |branch| branch_link(branch) }.join(', ').html_safe
end
end
end
def branch_link(branch)
link_to(branch, {:controller => 'repositories',
:action => 'show',
:id => @repository.project,
:repository_id => @repository.identifier,
:path => to_path_param(@path),
:rev => branch}).html_safe
end
def branch_groups
@repository.scm.branch_contains(@rev).group_by do |branch|
branch.downcase
.gsub(/^\d+/, '#####')
.split(/[\-\._]/)
.first
end.sort_by { |name, branches| [branches.length, name] }
end
end
app/views/issues/tabs/_changesets.html.erb (working copy)
</h4>
<p>
<%= "#{changeset.project.name} - " unless changeset.project == project %>
<%= if Setting.display_repository_base_name?
changeset.repository.url.split('/').last.sub('.git','') + ': '
end %>
<%= link_to_revision(changeset, changeset.repository,
:text => "#{l(:label_revision)} #{changeset.format_identifier}") %>
<% if changeset.filechanges.any? && User.current.allowed_to?(:browse_repository, changeset.project) %>
......
:repository_id => changeset.repository.identifier_param,
:path => "",
:rev => changeset.identifier) %>)
<% if Setting.display_under_associated_revisions? && changeset.scmid.present?
@repository = changeset.repository
@rev = changeset.identifier
%>
(<em><%= l(:label_branches) %>: <%= links_to_branches.join(', ').html_safe %></em>)
<% end %>
<% end %></p>
<div class="wiki changeset-comments">
app/views/repositories/_changeset.html.erb (working copy)
}.join(", ").html_safe %>
</li>
<% end %>
<% if !Setting.display_under_single_revision? %>
<li>
<strong><%= l(:label_branches) %></strong>
<%= links_to_branches.join(', ').html_safe %>
</li>
<% end %>
<% if @changeset.children.present? %>
<li>
<strong><%= l(:label_child_revision) %></strong>
app/views/settings/_issues.html.erb (working copy)
<p><%= setting_text_field :gantt_items_limit, :size => 6 %></p>
<p><%= setting_text_field :gantt_months_limit, :size => 6 %></p>
</div>
<fieldset class="box">
<legend><%= l(:label_display_revision_branches) %></legend>
<div class="tabular settings">
<p><%= setting_check_box :display_under_single_revision %></p>
<p><%= setting_check_box :display_under_associated_revisions %></p>
<p><%= setting_check_box :display_repository_base_name %></p>
</div>
</fieldset>
<fieldset class="box">
<legend><%= l(:label_parent_task_attributes) %></legend>
<div class="tabular settings">
config/locales/de.yml (working copy)
label_board_sticky: Wichtig (immer oben)
label_boolean: Boolean
label_branch: Zweig
label_branches: Zweige
label_browse: Codebrowser
label_bulk_edit_selected_issues: Alle ausgewählten Tickets bearbeiten
label_bulk_edit_selected_time_entries: Ausgewählte Zeitaufwände bearbeiten
......
setting_default_projects_tracker_ids: Standardmäßig aktivierte Tracker für neue Projekte
setting_diff_max_lines_displayed: Maximale Anzahl anzuzeigender Diff-Zeilen
setting_display_subprojects_issues: Tickets von Unterprojekten im Hauptprojekt anzeigen
setting_display_under_single_revision: Unterschiede bei Revision anzeigen
setting_display_under_associated_revisions: Bei zugehörigen Revisionen anzeigen
setting_display_repository_base_name: Name des zugehörigen Repository anzeigen
setting_emails_footer: E-Mail-Fußzeile
setting_emails_header: E-Mail-Kopfzeile
setting_enabled_scm: Aktivierte Versionskontrollsysteme
......
label_ends_with: endet mit
label_issue_fixed_version_updated: Zielversion aktualisiert
setting_project_list_defaults: Voreinstellungen Projektliste
label_display_revision_branches: Zweige zur Revision anzeigen
label_display_type: Ergebnisse anzeigen als
label_display_type_list: Liste
label_display_type_board: Karte
config/locales/en.yml (working copy)
setting_time_format: Time format
setting_timespan_format: Time span format
setting_cross_project_issue_relations: Allow cross-project issue relations
setting_display_under_single_revision: Display revision under Single Revision
setting_display_under_associated_revisions: Display revision under Associated Revisions
setting_display_repository_base_name: Display basename of associated repository
setting_cross_project_subtasks: Allow cross-project subtasks
setting_issue_list_default_columns: Issues list defaults
setting_repositories_encodings: Attachments and repositories encodings
......
label_repository_plural: Repositories
label_browse: Browse
label_branch: Branch
label_branches: Branches
label_tag: Tag
label_revision: Revision
label_revision_plural: Revisions
......
label_registration_manual_activation: manual account activation
label_registration_automatic_activation: automatic account activation
label_display_per_page: "Per page: %{value}"
label_display_revision_branches: Show branches for revision
label_age: Age
label_change_properties: Change properties
label_general: General
config/settings.yml (working copy)
issue_list_default_totals:
serialized: true
default: []
display_under_single_revision:
default: true
display_under_associated_revisions:
default: true
display_subprojects_issues:
default: 1
display_repository_base_name:
default: true
time_entry_list_defaults:
serialized: true
default:
lib/redmine/scm/adapters/git_adapter.rb (working copy)
rescue ScmCommandAborted
nil
end
def branch_contains(hash)
cleaned_hash = hash.sub(/[^\w]/, '')
cmd_args = ['branch', '--contains', cleaned_hash]
begin
branches = git_cmd(cmd_args) do |io|
io.readlines.sort!.map{|t| t.strip.gsub(/\* ?/, '')}
end
rescue ScmCommandAborted
branches = Array.new
end
branches.uniq
end
def tags
return @tags if @tags
public/javascripts/repository_navigation.js (working copy)
$('#branch,#tag').removeAttr('disabled');
}
});
$('a.scm-branch-group').on('click', function() {
$(this).parent().removeClass('scm-branch-hide');
});
})
public/stylesheets/scm.css (working copy)
.breadcrumbs>.separator::before, .breadcrumbs>.separator::after {
content: " ";
}
.scm-branch-group, .scm-branch-hide > .scm-branches { display: none; }
.scm-branch-hide > .scm-branch-group { display: inline; }
(4-4/4)