scm: bazaar: refactor adapter cat to use scm_cmd().

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5919 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-05-26 05:07:55 +00:00
parent a01bd88379
commit 4be9734824
1 changed files with 6 additions and 5 deletions

View File

@ -186,16 +186,17 @@ module Redmine
end end
def cat(path, identifier=nil) def cat(path, identifier=nil)
cmd = "#{self.class.sq_bin} cat"
cmd << " -r#{identifier.to_i}" if identifier && identifier.to_i > 0
cmd << " #{target(path)}"
cat = nil cat = nil
shellout(cmd) do |io| cmd_args = %w|cat|
cmd_args << "-r#{identifier.to_i}" if identifier && identifier.to_i > 0
cmd_args << bzr_target(path)
scm_cmd(*cmd_args) do |io|
io.binmode io.binmode
cat = io.read cat = io.read
end end
return nil if $? && $?.exitstatus != 0
cat cat
rescue ScmCommandAborted
return nil
end end
def annotate(path, identifier=nil) def annotate(path, identifier=nil)