Browse Source

scm: mercurial: refactor "cat" by using hg helper method (#4455).

Contributed by Yuya Nishihara.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4842 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/1.2.0
Toshi MARUYAMA 13 years ago
parent
commit
109afa7881
1 changed files with 4 additions and 8 deletions
  1. 4
    8
      lib/redmine/scm/adapters/mercurial_adapter.rb

+ 4
- 8
lib/redmine/scm/adapters/mercurial_adapter.rb View File

@@ -192,16 +192,12 @@ module Redmine
end

def cat(path, identifier=nil)
cmd = "#{self.class.sq_bin} -R #{target('')} cat"
cmd << " -r #{hgrev(identifier, true)}"
cmd << " #{target(path)}"
cat = nil
shellout(cmd) do |io|
hg 'cat', '-r', hgrev(identifier), hgtarget(path) do |io|
io.binmode
cat = io.read
io.read
end
return nil if $? && $?.exitstatus != 0
cat
rescue HgCommandAborted
nil # means not found
end

def annotate(path, identifier=nil)

Loading…
Cancel
Save