scm: cvs: add new method 'scm_cmd' to wrap shellout.
Refer Mercurial adapter r4830. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5082 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f41848fda4
commit
d3d7ea08f4
@ -25,6 +25,9 @@ module Redmine
|
|||||||
# CVS executable name
|
# CVS executable name
|
||||||
CVS_BIN = Redmine::Configuration['scm_cvs_command'] || "cvs"
|
CVS_BIN = Redmine::Configuration['scm_cvs_command'] || "cvs"
|
||||||
|
|
||||||
|
# raised if scm command exited with error, e.g. unknown revision.
|
||||||
|
class ScmCommandAborted < CommandFailed; end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def client_command
|
def client_command
|
||||||
@@bin ||= CVS_BIN
|
@@bin ||= CVS_BIN
|
||||||
@ -338,8 +341,19 @@ module Redmine
|
|||||||
def normalize_path(path)
|
def normalize_path(path)
|
||||||
path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1')
|
path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def scm_cmd(*args, &block)
|
||||||
|
full_args = [CVS_BIN, '-d', root_url]
|
||||||
|
full_args += args
|
||||||
|
ret = shellout(full_args.map { |e| shell_quote e.to_s }.join(' '), &block)
|
||||||
|
if $? && $?.exitstatus != 0
|
||||||
|
raise ScmCommandAborted, "cvs exited with non-zero status: #{$?.exitstatus}"
|
||||||
|
end
|
||||||
|
ret
|
||||||
|
end
|
||||||
|
private :scm_cmd
|
||||||
end
|
end
|
||||||
|
|
||||||
class CvsRevisionHelper
|
class CvsRevisionHelper
|
||||||
attr_accessor :complete_rev, :revision, :base, :branchid
|
attr_accessor :complete_rev, :revision, :base, :branchid
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user