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
This commit is contained in:
parent
df04f56891
commit
bc6b219fc9
@ -91,11 +91,10 @@ module Redmine
|
|||||||
# this method is used by the repository-browser (aka LIST)
|
# this method is used by the repository-browser (aka LIST)
|
||||||
def entries(path=nil, identifier=nil)
|
def entries(path=nil, identifier=nil)
|
||||||
logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'"
|
logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'"
|
||||||
path_with_project="#{url}#{with_leading_slash(path)}"
|
|
||||||
entries = Entries.new
|
entries = Entries.new
|
||||||
cmd_args = %w|-q rls -e|
|
cmd_args = %w|-q rls -e|
|
||||||
cmd_args << "-D" << time_to_cvstime_rlog(identifier) if identifier
|
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|
|
scm_cmd(*cmd_args) do |io|
|
||||||
io.each_line() do |line|
|
io.each_line() do |line|
|
||||||
fields = line.chop.split('/',-1)
|
fields = line.chop.split('/',-1)
|
||||||
@ -152,10 +151,9 @@ module Redmine
|
|||||||
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}, &block)
|
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}, &block)
|
||||||
logger.debug "<cvs> revisions path:" +
|
logger.debug "<cvs> revisions path:" +
|
||||||
"'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}"
|
"'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}"
|
||||||
path_with_project = "#{url}#{with_leading_slash(path)}"
|
|
||||||
cmd_args = %w|-q rlog|
|
cmd_args = %w|-q rlog|
|
||||||
cmd_args << "-d" << ">#{time_to_cvstime_rlog(identifier_from)}" if identifier_from
|
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|
|
scm_cmd(*cmd_args) do |io|
|
||||||
state = "entry_start"
|
state = "entry_start"
|
||||||
commit_log = String.new
|
commit_log = String.new
|
||||||
@ -174,7 +172,7 @@ module Redmine
|
|||||||
end
|
end
|
||||||
if state=="entry_start"
|
if state=="entry_start"
|
||||||
branch_map=Hash.new
|
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_path = normalize_cvs_path($1)
|
||||||
entry_name = normalize_path(File.basename($1))
|
entry_name = normalize_path(File.basename($1))
|
||||||
logger.debug("Path #{entry_path} <=> Name #{entry_name}")
|
logger.debug("Path #{entry_path} <=> Name #{entry_name}")
|
||||||
@ -268,11 +266,10 @@ module Redmine
|
|||||||
def diff(path, identifier_from, identifier_to=nil)
|
def diff(path, identifier_from, identifier_to=nil)
|
||||||
logger.debug "<cvs> diff path:'#{path}'" +
|
logger.debug "<cvs> diff path:'#{path}'" +
|
||||||
",identifier_from #{identifier_from}, identifier_to #{identifier_to}"
|
",identifier_from #{identifier_from}, identifier_to #{identifier_to}"
|
||||||
path_with_project="#{url}#{with_leading_slash(path)}"
|
|
||||||
cmd_args = %w|rdiff -u|
|
cmd_args = %w|rdiff -u|
|
||||||
cmd_args << "-r#{identifier_to}"
|
cmd_args << "-r#{identifier_to}"
|
||||||
cmd_args << "-r#{identifier_from}"
|
cmd_args << "-r#{identifier_from}"
|
||||||
cmd_args << path_with_project
|
cmd_args << path_with_proj(path)
|
||||||
diff = []
|
diff = []
|
||||||
scm_cmd(*cmd_args) do |io|
|
scm_cmd(*cmd_args) do |io|
|
||||||
io.each_line do |line|
|
io.each_line do |line|
|
||||||
@ -287,10 +284,9 @@ module Redmine
|
|||||||
def cat(path, identifier=nil)
|
def cat(path, identifier=nil)
|
||||||
identifier = (identifier) ? identifier : "HEAD"
|
identifier = (identifier) ? identifier : "HEAD"
|
||||||
logger.debug "<cvs> cat path:'#{path}',identifier #{identifier}"
|
logger.debug "<cvs> cat path:'#{path}',identifier #{identifier}"
|
||||||
path_with_project="#{url}#{with_leading_slash(path)}"
|
|
||||||
cmd_args = %w|-q co|
|
cmd_args = %w|-q co|
|
||||||
cmd_args << "-D" << "#{time_to_cvstime(identifier)}" if identifier
|
cmd_args << "-D" << time_to_cvstime(identifier) if identifier
|
||||||
cmd_args << "-p" << path_with_project
|
cmd_args << "-p" << path_with_proj(path)
|
||||||
cat = nil
|
cat = nil
|
||||||
scm_cmd(*cmd_args) do |io|
|
scm_cmd(*cmd_args) do |io|
|
||||||
io.binmode
|
io.binmode
|
||||||
@ -304,10 +300,9 @@ module Redmine
|
|||||||
def annotate(path, identifier=nil)
|
def annotate(path, identifier=nil)
|
||||||
identifier = (identifier) ? identifier : "HEAD"
|
identifier = (identifier) ? identifier : "HEAD"
|
||||||
logger.debug "<cvs> annotate path:'#{path}',identifier #{identifier}"
|
logger.debug "<cvs> annotate path:'#{path}',identifier #{identifier}"
|
||||||
path_with_project="#{url}#{with_leading_slash(path)}"
|
|
||||||
cmd_args = %w|rannotate|
|
cmd_args = %w|rannotate|
|
||||||
cmd_args << "-D" << "#{time_to_cvstime(identifier)}" if identifier
|
cmd_args << "-D" << time_to_cvstime(identifier) if identifier
|
||||||
cmd_args << path_with_project
|
cmd_args << path_with_proj(path)
|
||||||
blame = Annotate.new
|
blame = Annotate.new
|
||||||
scm_cmd(*cmd_args) do |io|
|
scm_cmd(*cmd_args) do |io|
|
||||||
io.each_line do |line|
|
io.each_line do |line|
|
||||||
@ -360,6 +355,11 @@ module Redmine
|
|||||||
path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1')
|
path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def path_with_proj(path)
|
||||||
|
"#{url}#{with_leading_slash(path)}"
|
||||||
|
end
|
||||||
|
private :path_with_proj
|
||||||
|
|
||||||
class Revision < Redmine::Scm::Adapters::Revision
|
class Revision < Redmine::Scm::Adapters::Revision
|
||||||
# Returns the readable identifier
|
# Returns the readable identifier
|
||||||
def format_identifier
|
def format_identifier
|
||||||
|
Loading…
x
Reference in New Issue
Block a user