##// END OF EJS Templates
scm: cvs: add new method 'scm_cmd' to wrap shellout....
Toshi MARUYAMA -
r4962:d3d7ea08f421
parent child
Show More
@@ -25,6 +25,9 module Redmine
25 # CVS executable name
25 # CVS executable name
26 CVS_BIN = Redmine::Configuration['scm_cvs_command'] || "cvs"
26 CVS_BIN = Redmine::Configuration['scm_cvs_command'] || "cvs"
27
27
28 # raised if scm command exited with error, e.g. unknown revision.
29 class ScmCommandAborted < CommandFailed; end
30
28 class << self
31 class << self
29 def client_command
32 def client_command
30 @@bin ||= CVS_BIN
33 @@bin ||= CVS_BIN
@@ -338,8 +341,19 module Redmine
338 def normalize_path(path)
341 def normalize_path(path)
339 path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1')
342 path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1')
340 end
343 end
344
345 def scm_cmd(*args, &block)
346 full_args = [CVS_BIN, '-d', root_url]
347 full_args += args
348 ret = shellout(full_args.map { |e| shell_quote e.to_s }.join(' '), &block)
349 if $? && $?.exitstatus != 0
350 raise ScmCommandAborted, "cvs exited with non-zero status: #{$?.exitstatus}"
351 end
352 ret
353 end
354 private :scm_cmd
341 end
355 end
342
356
343 class CvsRevisionHelper
357 class CvsRevisionHelper
344 attr_accessor :complete_rev, :revision, :base, :branchid
358 attr_accessor :complete_rev, :revision, :base, :branchid
345
359
General Comments 0
You need to be logged in to leave comments. Login now