RE: Git branch tracking » fabian-hacking-git-support-v5.diff
| app/models/repository/git.rb (cópia de trabalho) | ||
|---|---|---|
|
require 'redmine/scm/adapters/git_adapter'
|
||
|
class ChangesAdapter < Array
|
||
|
def find(f, attributes={})
|
||
|
self
|
||
|
end
|
||
|
end
|
||
|
class ChangeAdapter
|
||
|
attr_accessor :changeset, :revision, :action, :path, :from_path, :from_revision
|
||
|
def initialize(changeset, revision, change)
|
||
|
self.changeset = changeset
|
||
|
self.revision = revision
|
||
|
self.action = change[:action]
|
||
|
self.path = change[:path]
|
||
|
self.from_path = change[:from_path]
|
||
|
self.from_revision = change[:from_revision]
|
||
|
end
|
||
|
end
|
||
|
class ChangesetAdapter
|
||
|
attr_accessor :repository, :revision, :scmid, :name, :committer, :committed_on, :comments, :previous, :next
|
||
|
def initialize(repository, revision, previous=nil, thenext=nil)
|
||
|
self.repository = repository
|
||
|
self.revision = revision.identifier
|
||
|
self.scmid = revision.scmid
|
||
|
self.name = revision.name
|
||
|
self.committer = revision.author
|
||
|
self.committed_on = revision.time
|
||
|
self.comments = revision.message
|
||
|
self.previous = previous
|
||
|
self.next = thenext
|
||
|
@user = self.repository.find_committer_user(self.committer)
|
||
|
@changes = ChangesAdapter.new(revision.paths.collect do |change|
|
||
|
ChangeAdapter.new(self, revision.identifier, change)
|
||
|
end)
|
||
|
end
|
||
|
def author
|
||
|
@user || self.committer.to_s.split('<').first
|
||
|
end
|
||
|
def project
|
||
|
self.repository.project
|
||
|
end
|
||
|
def issues
|
||
|
[]
|
||
|
end
|
||
|
def changes
|
||
|
@changes
|
||
|
end
|
||
|
end
|
||
|
class Repository::Git < Repository
|
||
|
attr_protected :root_url
|
||
|
validates_presence_of :url
|
||
| ... | ... | |
|
'Git'
|
||
|
end
|
||
|
def changesets_find_by_revision(rev, options={})
|
||
|
#changeset = changesets.find_by_revision(rev)
|
||
|
changeset = nil
|
||
|
if changeset.nil?
|
||
|
#revision = scm.get_rev(rev, '')
|
||
|
c = nil
|
||
|
changesets=scm.revisions('', rev, options[:branch], :limit => 2, :reverse => true).collect do |revision|
|
||
|
c = ChangesetAdapter.new(self, revision, c, nil)
|
||
|
c
|
||
|
end
|
||
|
changeset = changesets.last unless changesets.nil?
|
||
|
#changeset.revision=rev
|
||
|
end
|
||
|
changeset
|
||
|
end
|
||
|
def changesets_find_git(path, rev, f, options={})
|
||
|
changesets=nil
|
||
|
if changesets.nil?
|
||
|
c=nil
|
||
|
#rev='--all' if rev.nil?
|
||
|
rev='HEAD' if rev.nil?
|
||
|
offset = options[:offset] ? options[:offset] : 0
|
||
|
limit = options[:limit] ? options[:limit] : 1
|
||
|
limit += offset
|
||
|
|
||
|
changesets=scm.revisions(path, rev, nil, :limit => limit).collect do |revision|
|
||
|
cnew=ChangesetAdapter.new(self, revision, c, nil)
|
||
|
c.next=cnew if c
|
||
|
c=cnew
|
||
|
c
|
||
|
end
|
||
|
end
|
||
|
changesets[offset, limit]
|
||
|
end
|
||
|
|
||
|
def changesets_find(path, rev, f, options={})
|
||
|
if (path.nil? || path == '' ) && (rev.nil? || rev == '')
|
||
|
super(path, rev, f, options)
|
||
|
else
|
||
|
changesets_find_git(path, rev, f, options)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def changesets_count(path, rev, f)
|
||
|
# FIXME: Optimize via new scm.count_revs function
|
||
|
if (path.nil? || path == '' ) && (rev.nil? || rev == '')
|
||
|
super(path, rev, f)
|
||
|
else
|
||
|
scm.revisions(path, rev, nil).count
|
||
|
end
|
||
|
end
|
||
|
def changesets_for_path(path, options={})
|
||
|
Change.find(:all, :include => {:changeset => :user},
|
||
|
:conditions => ["repository_id = ? AND path = ?", id, path],
|
||
|
:order => "committed_on DESC, #{Changeset.table_name}.revision DESC",
|
||
|
:limit => options[:limit]).collect(&:changeset)
|
||
|
# changesets=Change.find(:all, :include => {:changeset => :user},
|
||
|
# :conditions => ["repository_id = ? AND path = ?", id, path],
|
||
|
# :order => "committed_on DESC, #{Changeset.table_name}.revision DESC",
|
||
|
# :limit => options[:limit]).collect(&:changeset)
|
||
|
changesets_find_git(path, options[:branch], :all, options)
|
||
|
end
|
||
|
def fetch_changesets
|
||
| ... | ... | |
|
scm_revision = scm_info.lastrev.scmid
|
||
|
unless changesets.find_by_scmid(scm_revision)
|
||
|
scm.revisions('', db_revision, nil, :reverse => true) do |revision|
|
||
|
# Get all commit heads until our stored revision
|
||
|
scm.revisions('', '--all', db_revision ? ('^' + db_revision) : nil, :reverse => true) do |revision|
|
||
|
if changesets.find_by_scmid(revision.scmid.to_s).nil?
|
||
|
transaction do
|
||
|
changeset = Changeset.create!(:repository => self,
|
||
| app/models/repository.rb (cópia de trabalho) | ||
|---|---|---|
|
def diff(path, rev, rev_to)
|
||
|
scm.diff(path, rev, rev_to)
|
||
|
end
|
||
|
# Default behaviour: we search in cached changesets
|
||
|
def changesets_find_by_revision(rev)
|
||
|
changesets.find_by_revision(rev)
|
||
|
end
|
||
|
|
||
|
# Default behaviour: we search in cached changesets
|
||
|
def changesets_find(path, rev, f, options={})
|
||
|
changesets.find(f, options)
|
||
|
end
|
||
|
# Default behaviour: we search in cached changesets
|
||
|
def changesets_count(path, rev, f)
|
||
|
changesets.count
|
||
|
end
|
||
|
# Default behaviour: we search in cached changesets
|
||
|
def changesets_for_path(path, options={})
|
||
|
path = "/#{path}" unless path.starts_with?('/')
|
||
|
Change.find(:all, :include => {:changeset => :user},
|
||
| app/models/changeset.rb (cópia de trabalho) | ||
|---|---|---|
|
user || committer.to_s.split('<').first
|
||
|
end
|
||
|
|
||
|
def name
|
||
|
revision
|
||
|
end
|
||
|
|
||
|
def before_create
|
||
|
self.user = repository.find_committer_user(committer)
|
||
|
end
|
||
| app/controllers/repositories_controller.rb (cópia de trabalho) | ||
|---|---|---|
|
# root entries
|
||
|
@entries = @repository.entries('', @rev)
|
||
|
# latest changesets
|
||
|
@changesets = @repository.changesets.find(:all, :limit => 10, :order => "committed_on DESC")
|
||
|
@changesets = @repository.changesets_find('', @rev, :all, :limit => 10, :order => "committed_on DESC")
|
||
|
show_error_not_found unless @entries || @changesets.any?
|
||
|
end
|
||
|
|
||
| ... | ... | |
|
def changes
|
||
|
@entry = @repository.entry(@path, @rev)
|
||
|
show_error_not_found and return unless @entry
|
||
|
@changesets = @repository.changesets_for_path(@path, :limit => Setting.repository_log_display_limit.to_i)
|
||
|
@changesets = @repository.changesets_for_path(@path, :limit => Setting.repository_log_display_limit.to_i, :branch => @rev)
|
||
|
@properties = @repository.properties(@path, @rev)
|
||
|
end
|
||
|
|
||
|
def revisions
|
||
|
@changeset_count = @repository.changesets.count
|
||
|
@changeset_count = @repository.changesets_count(@path, @rev, :all)
|
||
|
@changeset_pages = Paginator.new self, @changeset_count,
|
||
|
per_page_option,
|
||
|
params['page']
|
||
|
@changesets = @repository.changesets.find(:all,
|
||
|
@changesets = @repository.changesets_find(@path, @rev, :all,
|
||
|
:limit => @changeset_pages.items_per_page,
|
||
|
:offset => @changeset_pages.current.offset,
|
||
|
:include => :user)
|
||
| ... | ... | |
|
end
|
||
|
|
||
|
def revision
|
||
|
@changeset = @repository.changesets.find_by_revision(@rev)
|
||
|
@changeset = @repository.changesets_find_by_revision(@rev)
|
||
|
raise ChangesetNotFound unless @changeset
|
||
|
respond_to do |format|
|
||
| ... | ... | |
|
@path = params[:path].join('/') unless params[:path].nil?
|
||
|
@path ||= ''
|
||
|
@rev = params[:rev]
|
||
|
@rev = nil if @rev && @rev.blank?
|
||
|
@rev_to = params[:rev_to]
|
||
|
raise InvalidRevisionParam unless @rev.to_s.match(REV_PARAM_RE) && @rev.to_s.match(REV_PARAM_RE)
|
||
|
#raise InvalidRevisionParam unless @rev.to_s.match(REV_PARAM_RE) && @rev.to_s.match(REV_PARAM_RE)
|
||
|
rescue ActiveRecord::RecordNotFound
|
||
|
render_404
|
||
|
rescue InvalidRevisionParam
|
||
| app/views/repositories/revision.rhtml (cópia de trabalho) | ||
|---|---|---|
|
<h2><%= l(:label_revision) %> <%= format_revision(@changeset.revision) %></h2>
|
||
|
<p><% if @changeset.scmid %>ID: <%= @changeset.scmid %><br /><% end %>
|
||
|
<% if @changeset.name && @changeset.revision && @changeset.name != @changeset.revision %>Name: <%= @changeset.name %><br /><% end %>
|
||
|
<span class="author"><%= authoring(@changeset.committed_on, @changeset.author) %></span></p>
|
||
|
<%= textilizable @changeset.comments %>
|
||
| ... | ... | |
|
<p><%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.revision) if @changeset.changes.any? %></p>
|
||
|
<div class="changeset-changes">
|
||
|
<%= render_changeset_changes %>
|
||
|
<%= render_changeset_changes if @changeset.changes.any? %>
|
||
|
</div>
|
||
|
<% content_for :header_tags do %>
|
||
| app/views/repositories/browse.rhtml (cópia de trabalho) | ||
|---|---|---|
|
<div class="contextual">
|
||
|
<% form_tag do %>
|
||
|
<% form_tag(:action => 'browse', :id => @project) do %>
|
||
|
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
|
||
|
<%= submit_tag 'OK', :name => nil %>
|
||
|
<% end %>
|
||
|
</div>
|
||
| app/views/repositories/_dir_list_content.rhtml (cópia de trabalho) | ||
|---|---|---|
|
</td>
|
||
|
<td class="size"><%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %></td>
|
||
|
<% changeset = @project.repository.changesets.find_by_revision(entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
|
||
|
<td class="revision"><%= link_to(format_revision(entry.lastrev.name), :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %></td>
|
||
|
<td class="revision"><%= link_to(format_revision(entry.lastrev.identifier), :action => 'revision', :id => @project, :rev => entry.lastrev.identifier) if entry.lastrev && entry.lastrev.identifier %>
|
||
|
<%= ('<br/>' + entry.lastrev.name) if entry.lastrev && entry.lastrev.name && entry.lastrev.identifier && entry.lastrev.identifier!=entry.lastrev.name %></td>
|
||
|
<td class="age"><%= distance_of_time_in_words(entry.lastrev.time, Time.now) if entry.lastrev && entry.lastrev.time %></td>
|
||
|
<td class="author"><%= changeset.nil? ? h(entry.lastrev.author.to_s.split('<').first) : changeset.author if entry.lastrev %></td>
|
||
|
<td class="comments"><%=h truncate(changeset.comments, 50) unless changeset.nil? %></td>
|
||
|
<%
|
||
|
author = nil
|
||
|
author = changeset.author if changeset
|
||
|
author = @project.repository.find_committer_user(entry.lastrev.author) if author.nil? && entry.lastrev
|
||
|
author = h(entry.lastrev.author.to_s.split('<').first) if author.nil? && entry.lastrev
|
||
|
author = '' if author.nil?
|
||
|
%>
|
||
|
<td class="author"><%= author %></td>
|
||
|
<td class="comments"><%= h truncate(changeset.nil? ? entry.lastrev.message : changeset.comments, 50) if entry.lastrev %></td>
|
||
|
</tr>
|
||
|
<% end %>
|
||
| app/views/repositories/_revisions.rhtml (cópia de trabalho) | ||
|---|---|---|
|
<% line_num = 1 %>
|
||
|
<% revisions.each do |changeset| %>
|
||
|
<tr class="changeset <%= cycle 'odd', 'even' %>">
|
||
|
<td class="id"><%= link_to format_revision(changeset.revision), :action => 'revision', :id => project, :rev => changeset.revision %></td>
|
||
|
<td class="id"><%= link_to format_revision(changeset.revision), :action => 'revision', :id => project, :rev => changeset.revision %>
|
||
|
<%= ('<br/>' + changeset.name) if changeset.name && changeset.revision!=changeset.name %></td>
|
||
|
<td class="checkbox"><%= radio_button_tag('rev', changeset.revision, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('cbto-#{line_num+1}').checked=true;") if show_diff && (line_num < revisions.size) %></td>
|
||
|
<td class="checkbox"><%= radio_button_tag('rev_to', changeset.revision, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('cb-#{line_num}').checked==true) {$('cb-#{line_num-1}').checked=true;}") if show_diff && (line_num > 1) %></td>
|
||
|
<td class="committed_on"><%= format_time(changeset.committed_on) %></td>
|
||
| app/views/repositories/show.rhtml (cópia de trabalho) | ||
|---|---|---|
|
<%= link_to l(:label_statistics), {:action => 'stats', :id => @project}, :class => 'icon icon-stats' %>
|
||
|
<% if !@entries.nil? && authorize_for('repositories', 'browse') -%>
|
||
|
<% form_tag(:action => 'browse', :id => @project) do -%>
|
||
|
<% form_tag(:action => 'show', :id => @project) do -%>
|
||
|
| <%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
|
||
|
<%= submit_tag 'OK', :name => nil %>
|
||
|
<% end -%>
|
||
|
<% end -%>
|
||
|
</div>
|
||
| ... | ... | |
|
<% if !@changesets.empty? && authorize_for('repositories', 'revisions') %>
|
||
|
<h3><%= l(:label_latest_revision_plural) %></h3>
|
||
|
<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :revisions => @changesets, :entry => nil }%>
|
||
|
<p><%= link_to l(:label_view_revisions), :action => 'revisions', :id => @project %></p>
|
||
|
<p><%= link_to l(:label_view_revisions), :action => 'revisions', :id => @project, :rev => @rev %></p>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :action => 'revisions', :id => @project, :page => nil, :key => User.current.rss_key})) %>
|
||
|
<% end %>
|
||
| app/views/repositories/revisions.rhtml (cópia de trabalho) | ||
|---|---|---|
|
<div class="contextual">
|
||
|
<% form_tag({:action => 'revision', :id => @project}) do %>
|
||
|
<% form_tag({:action => 'revisions', :id => @project}) do %>
|
||
|
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 5 %>
|
||
|
<%= submit_tag 'OK' %>
|
||
|
<% end %>
|
||
| lib/redmine/scm/adapters/git_adapter.rb (cópia de trabalho) | ||
|---|---|---|
|
# Git executable name
|
||
|
GIT_BIN = "git"
|
||
|
def check_revision(rev, many=true)
|
||
|
rev='' if rev.nil?
|
||
|
cmd="#{GIT_BIN} --git-dir #{target('')} rev-parse #{shell_quote rev}"
|
||
|
newrev='HEAD' unless many
|
||
|
newrev='--all' if many
|
||
|
shellout(cmd) do |io|
|
||
|
io.each_line do |line|
|
||
|
if line =~ /^([0-9a-f]{40})$/
|
||
|
newrev=$1 unless many
|
||
|
newrev=rev if many
|
||
|
break
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
newrev || 'HEAD'
|
||
|
end
|
||
|
# Get the revision of a particuliar file
|
||
|
def get_rev (rev,path)
|
||
|
|
||
|
if rev != 'latest' && !rev.nil?
|
||
|
cmd="#{GIT_BIN} --git-dir #{target('')} show --date=iso --pretty=fuller #{shell_quote rev} -- #{shell_quote path}"
|
||
|
else
|
||
|
@branch ||= shellout("#{GIT_BIN} --git-dir #{target('')} branch") { |io| io.grep(/\*/)[0].strip.match(/\* (.*)/)[1] }
|
||
|
cmd="#{GIT_BIN} --git-dir #{target('')} log --date=iso --pretty=fuller -1 #{@branch} -- #{shell_quote path}"
|
||
|
end
|
||
|
rev=check_revision(rev)
|
||
|
path='' if path.nil?
|
||
|
cmd="#{GIT_BIN} --git-dir #{target('')} log --raw --date=iso --pretty=fuller --decorate -1 #{shell_quote rev} -- #{shell_quote path}"
|
||
|
rev=[]
|
||
|
i=0
|
||
|
shellout(cmd) do |io|
|
||
| ... | ... | |
|
parsing_descr = 0 #0: not parsing desc or files, 1: parsing desc, 2: parsing files
|
||
|
io.each_line do |line|
|
||
|
if line =~ /^commit ([0-9a-f]{40})$/
|
||
|
if line =~ /^commit ([0-9a-f]{40})? ?(.*)$/
|
||
|
key = "commit"
|
||
|
value = $1
|
||
|
if (parsing_descr == 1 || parsing_descr == 2)
|
||
|
parsing_descr = 0
|
||
|
rev = Revision.new({:identifier => changeset[:commit],
|
||
|
rev = Revision.new({:identifier => changeset[:identifier],
|
||
|
:scmid => changeset[:commit],
|
||
|
:name => changeset[:name],
|
||
|
:author => changeset[:author],
|
||
|
:time => Time.parse(changeset[:date]),
|
||
|
:message => changeset[:description],
|
||
| ... | ... | |
|
files = []
|
||
|
end
|
||
|
changeset[:commit] = $1
|
||
|
changeset[:identifier] = $1
|
||
|
changeset[:name] = ($2 != '') ? $2 : $1
|
||
|
elsif (parsing_descr == 0) && line =~ /^(\w+):\s*(.*)$/
|
||
|
key = $1
|
||
|
value = $2
|
||
| ... | ... | |
|
changeset[:description] << line
|
||
|
end
|
||
|
end
|
||
|
rev = Revision.new({:identifier => changeset[:commit],
|
||
|
rev = Revision.new({:identifier => changeset[:identifier],
|
||
|
:scmid => changeset[:commit],
|
||
|
:name => changeset[:name],
|
||
|
:author => changeset[:author],
|
||
|
:time => (changeset[:date] ? Time.parse(changeset[:date]) : nil),
|
||
|
:message => changeset[:description],
|
||
| ... | ... | |
|
end
|
||
|
get_rev('latest',path) if rev == []
|
||
|
get_rev(nil,path) if rev == []
|
||
|
return nil if $? && $?.exitstatus != 0
|
||
|
return rev
|
||
|
end
|
||
|
def info
|
||
|
revs = revisions(url,nil,nil,{:limit => 1})
|
||
|
revs = revisions('','--all',nil,{:limit => 1})
|
||
|
if revs && revs.any?
|
||
|
Info.new(:root_url => url, :lastrev => revs.first)
|
||
|
Info.new(:root_url => '', :lastrev => revs.first)
|
||
|
else
|
||
|
nil
|
||
|
end
|
||
| ... | ... | |
|
def entries(path=nil, identifier=nil)
|
||
|
path ||= ''
|
||
|
entries = Entries.new
|
||
|
identifier=check_revision(identifier, false)
|
||
|
cmd = "#{GIT_BIN} --git-dir #{target('')} ls-tree -l "
|
||
|
cmd << shell_quote("HEAD:" + path) if identifier.nil?
|
||
|
cmd << shell_quote(identifier + ":" + path) if identifier
|
||
| ... | ... | |
|
|
||
|
def revisions(path, identifier_from, identifier_to, options={})
|
||
|
revisions = Revisions.new
|
||
|
identifier_from=check_revision(identifier_from) if identifier_from
|
||
|
identifier_to=check_revision(identifier_to) if identifier_to
|
||
|
cmd = "#{GIT_BIN} --git-dir #{target('')} log --raw --date=iso --pretty=fuller"
|
||
|
cmd << " --reverse" if options[:reverse]
|
||
|
cmd << " --decorate" #if options[:decorate]
|
||
|
cmd << " -n #{options[:limit].to_i} " if (!options.nil?) && options[:limit]
|
||
|
cmd << " #{shell_quote(identifier_from + '..')} " if identifier_from
|
||
|
cmd << " #{shell_quote(identifier_from)} " if identifier_from
|
||
|
cmd << " #{shell_quote identifier_to} " if identifier_to
|
||
|
cmd << " -- #{shell_quote path}" if path
|
||
|
shellout(cmd) do |io|
|
||
|
files=[]
|
||
|
changeset = {}
|
||
| ... | ... | |
|
revno = 1
|
||
|
io.each_line do |line|
|
||
|
if line =~ /^commit ([0-9a-f]{40})$/
|
||
|
if line =~ /^commit ([0-9a-f]{40})? ?(.*)$/
|
||
|
key = "commit"
|
||
|
value = $1
|
||
|
if (parsing_descr == 1 || parsing_descr == 2)
|
||
|
parsing_descr = 0
|
||
|
revision = Revision.new({:identifier => changeset[:commit],
|
||
|
revision = Revision.new({:identifier => changeset[:identifier],
|
||
|
:scmid => changeset[:commit],
|
||
|
:name => changeset[:name],
|
||
|
:author => changeset[:author],
|
||
|
:time => Time.parse(changeset[:date]),
|
||
|
:message => changeset[:description],
|
||
| ... | ... | |
|
revno = revno + 1
|
||
|
end
|
||
|
changeset[:commit] = $1
|
||
|
changeset[:identifier] = $1
|
||
|
changeset[:name] = ($2 != '') ? $2 : $1
|
||
|
elsif (parsing_descr == 0) && line =~ /^(\w+):\s*(.*)$/
|
||
|
key = $1
|
||
|
value = $2
|
||
| ... | ... | |
|
end
|
||
|
if changeset[:commit]
|
||
|
revision = Revision.new({:identifier => changeset[:commit],
|
||
|
revision = Revision.new({:identifier => changeset[:identifier],
|
||
|
:scmid => changeset[:commit],
|
||
|
:name => changeset[:name],
|
||
|
:author => changeset[:author],
|
||
|
:time => Time.parse(changeset[:date]),
|
||
|
:message => changeset[:description],
|
||
| ... | ... | |
|
def diff(path, identifier_from, identifier_to=nil)
|
||
|
path ||= ''
|
||
|
if !identifier_to
|
||
|
identifier_to = nil
|
||
|
identifier_to=nil
|
||
|
end
|
||
|
identifier_from=check_revision(identifier_from, false)
|
||
|
identifier_to=check_revision(identifier_to, false) if !identifier_to.nil?
|
||
|
|
||
|
cmd = "#{GIT_BIN} --git-dir #{target('')} show #{shell_quote identifier_from}" if identifier_to.nil?
|
||
|
cmd = "#{GIT_BIN} --git-dir #{target('')} diff #{shell_quote identifier_to} #{shell_quote identifier_from}" if !identifier_to.nil?
|
||
| ... | ... | |
|
end
|
||
|
|
||
|
def annotate(path, identifier=nil)
|
||
|
identifier = 'HEAD' if identifier.blank?
|
||
|
identifier=check_revision(identifier, false)
|
||
|
cmd = "#{GIT_BIN} --git-dir #{target('')} blame -l #{shell_quote identifier} -- #{shell_quote path}"
|
||
|
blame = Annotate.new
|
||
|
content = nil
|
||
| ... | ... | |
|
end
|
||
|
|
||
|
def cat(path, identifier=nil)
|
||
|
if identifier.nil?
|
||
|
identifier = 'HEAD'
|
||
|
end
|
||
|
identifier=check_revision(identifier, false)
|
||
|
cmd = "#{GIT_BIN} --git-dir #{target('')} show #{shell_quote(identifier + ':' + path)}"
|
||
|
cat = nil
|
||
|
shellout(cmd) do |io|
|
||