diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-04-12 10:31:33 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-04-12 10:31:33 +0000 |
commit | bc6b219fc953bdcf2f713ebeae1bb2d27be17c9f (patch) | |
tree | d9d02379ea8c0fc4a04955be0c4c8c0eeb16b449 /lib | |
parent | df04f56891ceebdf03add3519c2e30b9dc9b0ef5 (diff) | |
download | redmine-bc6b219fc953bdcf2f713ebeae1bb2d27be17c9f.tar.gz redmine-bc6b219fc953bdcf2f713ebeae1bb2d27be17c9f.zip |
scm: cvs: refactor adapter.
create new method path_with_proj() for calling cvs command.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5438 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/scm/adapters/cvs_adapter.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb index 3e2c96ccf..e840f1821 100644 --- a/lib/redmine/scm/adapters/cvs_adapter.rb +++ b/lib/redmine/scm/adapters/cvs_adapter.rb @@ -91,11 +91,10 @@ module Redmine # this method is used by the repository-browser (aka LIST) def entries(path=nil, identifier=nil) logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'" - path_with_project="#{url}#{with_leading_slash(path)}" entries = Entries.new cmd_args = %w|-q rls -e| cmd_args << "-D" << time_to_cvstime_rlog(identifier) if identifier - cmd_args << path_with_project + cmd_args << path_with_proj(path) scm_cmd(*cmd_args) do |io| io.each_line() do |line| fields = line.chop.split('/',-1) @@ -152,10 +151,9 @@ module Redmine def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}, &block) logger.debug "<cvs> revisions path:" + "'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}" - path_with_project = "#{url}#{with_leading_slash(path)}" cmd_args = %w|-q rlog| cmd_args << "-d" << ">#{time_to_cvstime_rlog(identifier_from)}" if identifier_from - cmd_args << path_with_project + cmd_args << path_with_proj(path) scm_cmd(*cmd_args) do |io| state = "entry_start" commit_log = String.new @@ -174,7 +172,7 @@ module Redmine end if state=="entry_start" branch_map=Hash.new - if /^RCS file: #{Regexp.escape(root_url_path)}\/#{Regexp.escape(path_with_project)}(.+),v$/ =~ line + if /^RCS file: #{Regexp.escape(root_url_path)}\/#{Regexp.escape(path_with_proj(path))}(.+),v$/ =~ line entry_path = normalize_cvs_path($1) entry_name = normalize_path(File.basename($1)) logger.debug("Path #{entry_path} <=> Name #{entry_name}") @@ -268,11 +266,10 @@ module Redmine def diff(path, identifier_from, identifier_to=nil) logger.debug "<cvs> diff path:'#{path}'" + ",identifier_from #{identifier_from}, identifier_to #{identifier_to}" - path_with_project="#{url}#{with_leading_slash(path)}" cmd_args = %w|rdiff -u| cmd_args << "-r#{identifier_to}" cmd_args << "-r#{identifier_from}" - cmd_args << path_with_project + cmd_args << path_with_proj(path) diff = [] scm_cmd(*cmd_args) do |io| io.each_line do |line| @@ -287,10 +284,9 @@ module Redmine def cat(path, identifier=nil) identifier = (identifier) ? identifier : "HEAD" logger.debug "<cvs> cat path:'#{path}',identifier #{identifier}" - path_with_project="#{url}#{with_leading_slash(path)}" cmd_args = %w|-q co| - cmd_args << "-D" << "#{time_to_cvstime(identifier)}" if identifier - cmd_args << "-p" << path_with_project + cmd_args << "-D" << time_to_cvstime(identifier) if identifier + cmd_args << "-p" << path_with_proj(path) cat = nil scm_cmd(*cmd_args) do |io| io.binmode @@ -304,10 +300,9 @@ module Redmine def annotate(path, identifier=nil) identifier = (identifier) ? identifier : "HEAD" logger.debug "<cvs> annotate path:'#{path}',identifier #{identifier}" - path_with_project="#{url}#{with_leading_slash(path)}" cmd_args = %w|rannotate| - cmd_args << "-D" << "#{time_to_cvstime(identifier)}" if identifier - cmd_args << path_with_project + cmd_args << "-D" << time_to_cvstime(identifier) if identifier + cmd_args << path_with_proj(path) blame = Annotate.new scm_cmd(*cmd_args) do |io| io.each_line do |line| @@ -360,6 +355,11 @@ module Redmine path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1') end + def path_with_proj(path) + "#{url}#{with_leading_slash(path)}" + end + private :path_with_proj + class Revision < Redmine::Scm::Adapters::Revision # Returns the readable identifier def format_identifier |