Index: app/helpers/application_helper.rb ======================================================================== --- app/helpers/application_helper.rb Fri Apr 05 09:59:21 2013 +0000 +++ app/helpers/application_helper.rb Wed May 22 23:25:08 2013 +0200 @@ -113,6 +113,13 @@ ) end + # Generates a link to a SCM repository + def link_to_repository(rev, project, options={}) + text = options.delete(:text) || rev + link_to(text, {:controller => 'repositories', :action => 'show', :id => project, :rev => rev}, + :title => rev) + end + # Generates a link to a message def link_to_message(message, options={}, html_options = nil) link_to( Index: app/models/repository/git.rb ======================================================================== --- app/models/repository/git.rb Fri Apr 05 09:59:21 2013 +0000 +++ app/models/repository/git.rb Wed May 22 23:25:08 2013 +0200 @@ -209,6 +209,7 @@ # There is no search in the db for this revision, because above we ensured, # that it's not in the db. save_revision(rev) + save_revision_branches(rev) end end h["heads"] = repo_heads.dup @@ -217,6 +218,18 @@ end private :save_revisions + def save_revision_branches(rev) + db_rev = find_changeset_by_name(rev.scmid) + unless db_rev.nil? + branches = scm.revision_branches(rev.scmid) + unless branches.nil? + db_rev.branches = branches.join(',') + db_rev.save + end + end + end + private :save_revision_branches + def save_revision(rev) parents = (rev.parents || []).collect{|rp| find_changeset_by_name(rp)}.compact changeset = Changeset.create( Index: app/views/issues/_changesets.html.erb ================================================================================ --- app/views/issues/_changesets.html.erb Fri Apr 05 09:59:21 2013 +0000 +++ app/views/issues/_changesets.html.erb Wed May 22 23:25:08 2013 +0200 @@ -1,7 +1,16 @@ <% changesets.each do |changeset| %>
<%= link_to_revision(changeset, changeset.repository,
- :text => "#{l(:label_revision)} #{changeset.format_identifier}") %>
+ :text => "#{l(:label_revision)} #{changeset.format_identifier}") %>
+ <% if changeset.branches? %>
+
+ <%== changeset.branches.split(',').collect{ |branch|
+ changeset.repository.branches.include?(branch) ?
+ link_to_repository(branch, changeset.project, :text => branch) : nil }.compact.join(' / ') %>
+
+ <% end %>
+
+