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

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5926 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-05-26 07:13:10 +00:00
parent 80e997ca22
commit 6b2a1085d1
1 changed files with 9 additions and 6 deletions

View File

@ -81,11 +81,11 @@ module Redmine
def entries(path=nil, identifier=nil, options={}) def entries(path=nil, identifier=nil, options={})
path ||= '' path ||= ''
entries = Entries.new entries = Entries.new
cmd = "#{self.class.sq_bin} ls -v --show-ids"
identifier = -1 unless identifier && identifier.to_i > 0 identifier = -1 unless identifier && identifier.to_i > 0
cmd << " -r#{identifier.to_i}" cmd_args = %w|ls -v --show-ids|
cmd << " #{target(path)}" cmd_args << "-r#{identifier.to_i}"
shellout(cmd) do |io| cmd_args << bzr_target(path)
scm_cmd(*cmd_args) do |io|
prefix = "#{url}/#{path}".gsub('\\', '/') prefix = "#{url}/#{path}".gsub('\\', '/')
logger.debug "PREFIX: #{prefix}" logger.debug "PREFIX: #{prefix}"
re = %r{^V\s+(#{Regexp.escape(prefix)})?(\/?)([^\/]+)(\/?)\s+(\S+)\r?$} re = %r{^V\s+(#{Regexp.escape(prefix)})?(\/?)([^\/]+)(\/?)\s+(\S+)\r?$}
@ -99,9 +99,12 @@ module Redmine
}) })
end end
end end
return nil if $? && $?.exitstatus != 0 if logger && logger.debug?
logger.debug("Found #{entries.size} entries in the repository for #{target(path)}") if logger && logger.debug? logger.debug("Found #{entries.size} entries in the repository for #{target(path)}")
end
entries.sort_by_name entries.sort_by_name
rescue ScmCommandAborted
return nil
end end
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})