Project

General

Profile

Feature #5386 » show_branch_tags_in_changeset.diff

Port of plugin redmine_revision_branches to master - Niklaus Giger, 2020-09-21 14:54

View differences:

app/helpers/repositories_helper.rb (Arbeitskopie)
326 326
    end
327 327
    max_space
328 328
  end
329

  
330
  def has_branch_detail?
331
    @repository.scm.respond_to? :branch_contains
332
  end
333

  
334
  def insert_branches_detail(html)
335
    return html unless has_branch_detail?
336
    substring = '</li>'
337
    location = html.index(substring).to_i + substring.length
338
    html.insert(location, branches_html)
339
  end
340

  
341
  def branches_html
342
    content_tag(:li) do
343
      content = content_tag(:strong, "#{l(:label_branch)}")
344
      content << " "
345
      content << "#{@repository.identifier}@ "
346
      content << links_to_branches.join(', ').html_safe
347
    end
348
  end
349

  
350
  def links_to_branches
351
    return [] unless has_branch_detail?
352
    branch_groups.map { |name, branches| branches_link(name, branches) }
353
  end
354

  
355
  def branches_link(name, branches)
356
    return branch_link(branches.first) if branches.length == 1
357
    link =  link_to("[#{name}...]", 'javascript:;', class: 'scm-branch-group').html_safe
358
    content_tag(:span, class: 'scm-branch-hide') do
359
      link << content_tag(:span, class: 'scm-branches') do
360
        branches.map { |branch| branch_link(branch) }.join(', ').html_safe
361
      end
362
    end
363
  end
364

  
365
  def branch_link(branch)
366
    link_to(branch, {:controller => 'repositories',
367
                     :action => 'show',
368
                     :id => @repository.project,
369
                     :repository_id => @repository.identifier,
370
                     :path => to_path_param(@path),
371
                     :rev => branch}).html_safe
372
  end
373

  
374
  def branch_groups
375
    @repository.scm.branch_contains(@rev).group_by do |branch|
376
      branch.downcase
377
        .gsub(/^\d+/, '#####')
378
        .split(/[\-\._]/)
379
        .first
380
    end.sort_by { |name, branches| [branches.length, name] }
381
  end
382

  
383

  
329 384
end
app/views/issues/tabs/_changesets.html.erb (Arbeitskopie)
14 14
           :repository_id => changeset.repository.identifier_param,
15 15
           :path   => "",
16 16
           :rev    => changeset.identifier) %>)
17
      <% if !Setting.display_under_associated_revisions? && changeset.scmid.present?
18
           @repository = changeset.repository
19
           @rev = changeset.identifier
20
      %>
21
         (<em><%= l(:label_branches) %>: <%= links_to_branches.join(', ').html_safe %></em>)
22
      <% end %>
17 23
    <% end %></p>
18 24

  
19 25
    <div class="wiki changeset-comments">
app/views/repositories/_changeset.html.erb (Arbeitskopie)
20 20
              }.join(", ").html_safe %>
21 21
      </li>
22 22
    <% end %>
23
      <% if !Setting.display_under_single_revision? %>
24
      <li>
25
        <strong><%= l(:label_branches) %></strong>
26
        <%=  links_to_branches.join(', ').html_safe %>
27
      </li>
28
      <% end %>
29

  
23 30
    <% if @changeset.children.present? %>
24 31
      <li>
25 32
        <strong><%= l(:label_child_revision) %></strong>
app/views/settings/_issues.html.erb (Arbeitskopie)
24 24
<p><%= setting_text_field :gantt_items_limit, :size => 6 %></p>
25 25

  
26 26
<p><%= setting_text_field :gantt_months_limit, :size => 6 %></p>
27

  
27 28
</div>
29
<fieldset class="box">
30
  <legend><%= l(:label_display_revision_branches) %></legend>
31
  <div class="tabular settings">
32
<p><%= setting_check_box :display_under_single_revision %></p>
28 33

  
34
<p><%= setting_check_box :display_under_associated_revisions %></p>
35
  </div>
36
</fieldset>
37

  
29 38
<fieldset class="box">
30 39
  <legend><%= l(:label_parent_task_attributes) %></legend>
31 40
  <div class="tabular settings">
config/locales/de.yml (Arbeitskopie)
460 460
  label_board_sticky: Wichtig (immer oben)
461 461
  label_boolean: Boolean
462 462
  label_branch: Zweig
463
  label_branches: Zweige
463 464
  label_browse: Codebrowser
464 465
  label_bulk_edit_selected_issues: Alle ausgewählten Tickets bearbeiten
465 466
  label_bulk_edit_selected_time_entries: Ausgewählte Zeitaufwände bearbeiten
......
1004 1005
  setting_default_projects_tracker_ids: Standardmäßig aktivierte Tracker für neue Projekte
1005 1006
  setting_diff_max_lines_displayed: Maximale Anzahl anzuzeigender Diff-Zeilen
1006 1007
  setting_display_subprojects_issues: Tickets von Unterprojekten im Hauptprojekt anzeigen
1008
  setting_display_under_single_revision: Unterschiede bei Revision anzeigen
1009
  setting_display_under_associated_revisions: Bei zugehörigen Revisionen anzeigen
1007 1010
  setting_emails_footer: E-Mail-Fußzeile
1008 1011
  setting_emails_header: E-Mail-Kopfzeile
1009 1012
  setting_enabled_scm: Aktivierte Versionskontrollsysteme
......
1300 1303
  label_ends_with: endet mit
1301 1304
  label_issue_fixed_version_updated: Zielversion aktualisiert
1302 1305
  setting_project_list_defaults: Voreinstellungen Projektliste
1306
  label_display_revision_branches: Zweige zur Revision anzeigen
1303 1307
  label_display_type: Ergebnisse anzeigen als
1304 1308
  label_display_type_list: Liste
1305 1309
  label_display_type_board: Karte
config/locales/en.yml (Arbeitskopie)
430 430
  setting_time_format: Time format
431 431
  setting_timespan_format: Time span format
432 432
  setting_cross_project_issue_relations: Allow cross-project issue relations
433
  setting_display_under_single_revision: Display revision under Single Revision
434
  setting_display_under_associated_revisions: Display revision under Associated Revisions
433 435
  setting_cross_project_subtasks: Allow cross-project subtasks
434 436
  setting_issue_list_default_columns: Isuses list defaults
435 437
  setting_repositories_encodings: Attachments and repositories encodings
......
804 806
  label_repository_plural: Repositories
805 807
  label_browse: Browse
806 808
  label_branch: Branch
809
  label_branches: Branches
807 810
  label_tag: Tag
808 811
  label_revision: Revision
809 812
  label_revision_plural: Revisions
......
931 934
  label_registration_manual_activation: manual account activation
932 935
  label_registration_automatic_activation: automatic account activation
933 936
  label_display_per_page: "Per page: %{value}"
937
  label_display_revision_branches: Show branches for revision
934 938
  label_age: Age
935 939
  label_change_properties: Change properties
936 940
  label_general: General
config/settings.yml (Arbeitskopie)
1 1
# Redmine - project management software
2
# Copyright (C) 2006-2020  Jean-Philippe Lang
2
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 3
#
4 4
# This program is free software; you can redistribute it and/or
5 5
# modify it under the terms of the GNU General Public License
......
21 21

  
22 22
app_title:
23 23
  default: Redmine
24
app_subtitle:
25
  default: Project management
24 26
welcome_text:
25 27
  default:
26 28
login_required:
......
34 36
lost_password:
35 37
  default: 1
36 38
  security_notifications: 1
37
twofa:
38
  default: 1
39
  security_notifications: 1
40 39
unsubscribe:
41 40
  default: 1
42 41
password_required_char_classes:
......
56 55
max_additional_emails:
57 56
  format: int
58 57
  default: 5
59
email_domains_allowed:
60
  default:
61
email_domains_denied:
62
  default:
63 58
# Maximum lifetime of user sessions in minutes
64 59
session_lifetime:
65 60
  format: int
......
73 68
attachment_max_size:
74 69
  format: int
75 70
  default: 5120
76
bulk_download_max_size:
77
  format: int
78
  default: 102400
79 71
attachment_extensions_allowed:
80 72
  default:
81 73
attachment_extensions_denied:
......
119 111
gantt_items_limit:
120 112
  format: int
121 113
  default: 500
122
gantt_months_limit:
123
  format: int
124
  default: 24
125 114
# Maximum size of files that can be displayed
126 115
# inline through the file viewer (in KB)
127 116
file_max_size_displayed:
......
134 123
  serialized: true
135 124
  default:
136 125
  - Subversion
126
  - Darcs
137 127
  - Mercurial
138 128
  - Cvs
139 129
  - Bazaar
......
187 177
  default: 'derived'
188 178
link_copied_issue:
189 179
  default: 'ask'
190
close_duplicate_issues:
191
  default: 1
192 180
issue_group_assignment:
193 181
  default: 0
194 182
default_issue_start_date_to_creation_date:
......
202 190
  default: ''
203 191
mail_handler_enable_regex_delimiters:
204 192
  default: 0
205
mail_handler_enable_regex_excluded_filenames:
206
  default: 0
207 193
mail_handler_excluded_filenames:
208 194
  default: ''
209 195
mail_handler_api_enabled:
......
212 198
mail_handler_api_key:
213 199
  default:
214 200
  security_notifications: 1
215
mail_handler_preferred_body_part:
216
  default: plain
217 201
issue_list_default_columns:
218 202
  serialized: true
219 203
  default:
......
228 212
  default: []
229 213
display_subprojects_issues:
230 214
  default: 1
231
time_entry_list_defaults:
232
  serialized: true
233
  default:
234
    column_names:
235
    - spent_on
236
    - user
237
    - activity
238
    - issue
239
    - comments
240
    - hours
241
    totalable_names:
242
    - hours
243
project_list_display_type:
244
  default: board
245
project_list_defaults:
246
  serialized: true
247
  default:
248
    column_names:
249
    - name
250
    - identifier
251
    - short_description
252 215
issue_done_ratio:
253 216
  default: 'issue_field'
254 217
default_projects_public:
......
303 266
  default: 0
304 267
  security_notifications: 1
305 268
gravatar_default:
306
  default: 'identicon'
269
  default: ''
307 270
start_of_week:
308 271
  default: ''
309 272
rest_api_enabled:
......
317 280
emails_header:
318 281
  default: ''
319 282
thumbnails_enabled:
320
  default: 1
283
  default: 0
321 284
thumbnails_size:
322 285
  format: int
323 286
  default: 100
......
331 294
timelog_required_fields:
332 295
  serialized: true
333 296
  default: []
334
timelog_accept_0_hours:
335
  default: 1
336
timelog_max_hours_per_day:
337
  format: int
338
  default: 999
339
timelog_accept_future_dates:
340
  default: 1
341
show_status_changes_in_mail_subject:
342
  default: 1
lib/redmine/scm/adapters/git_adapter.rb (Arbeitskopie)
95 95
        rescue ScmCommandAborted
96 96
          nil
97 97
        end
98
        
99
        def branch_contains(hash)
100
          cleaned_hash = hash.sub(/[^\w]/, '')
101
          cmd_args = ['branch', '--contains', cleaned_hash]
102
          begin
103
            branches = git_cmd(cmd_args) do |io|
104
              io.readlines.sort!.map{|t| t.strip.gsub(/\* ?/, '')}
105
            end
106
          rescue ScmCommandAborted
107
            branches = Array.new
108
          end
109
          branches.uniq
110
        end
98 111

  
99 112
        def tags
100 113
          return @tags if @tags
public/javascripts/repository_navigation.js (Arbeitskopie)
33 33
      $('#branch,#tag').removeAttr('disabled');
34 34
    }
35 35
  });
36

  
37
  $('a.scm-branch-group').on('click', function() {
38
    $(this).parent().removeClass('scm-branch-hide');
39
  });
36 40
})
public/stylesheets/scm.css (Arbeitskopie)
120 120
.breadcrumbs>.separator::before, .breadcrumbs>.separator::after {
121 121
    content: " ";
122 122
}
123

  
124
.scm-branch-group, .scm-branch-hide > .scm-branches { display: none; }
125
.scm-branch-hide > .scm-branch-group { display: inline; }
(9-9/11)