scm: cvs: code clean up adapter.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5386 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-04-10 12:27:53 +00:00
parent 3be326f0a4
commit d5bb4b349a
1 changed files with 34 additions and 37 deletions

View File

@ -156,7 +156,8 @@ module Redmine
# in the repository. both identifier have to be dates or nil. # in the repository. both identifier have to be dates or nil.
# these method returns nothing but yield every result in block # these method returns nothing but yield every result in block
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:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}" logger.debug "<cvs> revisions path:" +
"'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}"
path_with_project = "#{url}#{with_leading_slash(path)}" path_with_project = "#{url}#{with_leading_slash(path)}"
cmd_args = %w|rlog| cmd_args = %w|rlog|
@ -211,18 +212,14 @@ module Redmine
elsif state=="revision" elsif state=="revision"
if /^#{ENDLOG}/ =~ line || /^#{STARTLOG}/ =~ line if /^#{ENDLOG}/ =~ line || /^#{STARTLOG}/ =~ line
if revision if revision
revHelper=CvsRevisionHelper.new(revision) revHelper=CvsRevisionHelper.new(revision)
revBranch="HEAD" revBranch="HEAD"
branch_map.each() do |branch_name, branch_point| branch_map.each() do |branch_name, branch_point|
if revHelper.is_in_branch_with_symbol(branch_point) if revHelper.is_in_branch_with_symbol(branch_point)
revBranch=branch_name revBranch=branch_name
end end
end end
logger.debug("********** YIELD Revision #{revision}::#{revBranch}") logger.debug("********** YIELD Revision #{revision}::#{revBranch}")
yield Revision.new({ yield Revision.new({
:time => date, :time => date,
:author => author, :author => author,
@ -237,10 +234,8 @@ module Redmine
}] }]
}) })
end end
commit_log = String.new commit_log = String.new
revision = nil revision = nil
if /^#{ENDLOG}/ =~ line if /^#{ENDLOG}/ =~ line
state="entry_start" state="entry_start"
end end
@ -255,8 +250,10 @@ module Redmine
date = Time.parse($1) date = Time.parse($1)
author = /author: ([^;]+)/.match(line)[1] author = /author: ([^;]+)/.match(line)[1]
file_state = /state: ([^;]+)/.match(line)[1] file_state = /state: ([^;]+)/.match(line)[1]
#TODO: linechanges only available in CVS.... maybe a feature our SVN implementation. i'm sure, they are # TODO:
# useful for stats or something else # linechanges only available in CVS....
# maybe a feature our SVN implementation.
# I'm sure, they are useful for stats or something else
# linechanges =/lines: \+(\d+) -(\d+)/.match(line) # linechanges =/lines: \+(\d+) -(\d+)/.match(line)
# unless linechanges.nil? # unless linechanges.nil?
# version.line_plus = linechanges[1] # version.line_plus = linechanges[1]