Feature #5386 » 5386-branches-in-associated-revisions.diff
| app/helpers/application_helper.rb (working copy) | ||
|---|---|---|
|
:title => l(:label_revision_id, format_revision(revision)))
|
||
|
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(
|
||
| app/models/repository/git.rb (working copy) | ||
|---|---|---|
|
if db_rev.nil?
|
||
|
save_revision(rev)
|
||
|
end
|
||
|
save_revision_branches(rev)
|
||
|
h["branches"][br]["last_scmid"] = rev.scmid
|
||
|
merge_extra_info(h)
|
||
|
self.save
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
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
|
||
|
def save_revision(rev)
|
||
|
changeset = Changeset.new(
|
||
|
:repository => self,
|
||
| app/views/issues/_changesets.rhtml (working copy) | ||
|---|---|---|
|
<% changesets.each do |changeset| %>
|
||
|
<div class="changeset <%= cycle('odd', 'even') %>">
|
||
|
<p><%= link_to_revision(changeset, changeset.project,
|
||
|
:text => "#{l(:label_revision)} #{changeset.format_identifier}") %><br />
|
||
|
:text => "#{l(:label_revision)} #{changeset.format_identifier}") %>
|
||
|
<% if changeset.branches? %>
|
||
|
<span style="float:right;"><%= changeset.branches.split(',').collect{ |branch|
|
||
|
changeset.repository.branches.include?(branch) ?
|
||
|
link_to_repository(branch, changeset.project, :text => branch) : nil }.compact.join(' / ') %></span>
|
||
|
<% end %>
|
||
|
<br />
|
||
|
<span class="author"><%= authoring(changeset.committed_on, changeset.author) %></span></p>
|
||
|
<div class="wiki">
|
||
|
<%= textilizable(changeset, :comments) %>
|
||
| db/migrate/20111012193800_add_changesets_branches.rb (revision 0) | ||
|---|---|---|
|
class AddChangesetsBranches < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
add_column :changesets, :branches, :string, :limit => nil, :default => nil
|
||
|
end
|
||
|
def self.down
|
||
|
remove_column :changesets, :branches
|
||
|
end
|
||
|
end
|
||
| lib/redmine/scm/adapters/git_adapter.rb (working copy) | ||
|---|---|---|
|
revs
|
||
|
end
|
||
|
def revision_branches(identifier)
|
||
|
cmd_args = %w|branch --contains|
|
||
|
cmd_args << identifier
|
||
|
branches = []
|
||
|
scm_cmd(*cmd_args) do |io|
|
||
|
io.each_line do |line|
|
||
|
branches << line.match('\s*\*?\s*(.*)$')[1]
|
||
|
end
|
||
|
end
|
||
|
branches.sort!
|
||
|
rescue ScmCommandAborted
|
||
|
nil
|
||
|
end
|
||
|
def diff(path, identifier_from, identifier_to=nil)
|
||
|
path ||= ''
|
||
|
cmd_args = []
|
||