scm: cvs: code clean up app/models/repository/cvs.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5376 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
cae3fcce54
commit
18431d3681
|
@ -77,12 +77,11 @@ class Repository::Cvs < Repository
|
||||||
changeset_to=changesets.find_by_revision(rev_to)
|
changeset_to=changesets.find_by_revision(rev_to)
|
||||||
end
|
end
|
||||||
changeset_from.changes.each() do |change_from|
|
changeset_from.changes.each() do |change_from|
|
||||||
|
revision_from = nil
|
||||||
revision_from=nil
|
revision_to = nil
|
||||||
revision_to=nil
|
if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
|
||||||
|
revision_from=change_from.revision
|
||||||
revision_from=change_from.revision if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
|
end
|
||||||
|
|
||||||
if revision_from
|
if revision_from
|
||||||
if changeset_to
|
if changeset_to
|
||||||
changeset_to.changes.each() do |change_to|
|
changeset_to.changes.each() do |change_to|
|
||||||
|
@ -98,10 +97,11 @@ class Repository::Cvs < Repository
|
||||||
end
|
end
|
||||||
return diff
|
return diff
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_changesets
|
def fetch_changesets
|
||||||
# some nifty bits to introduce a commit-id with cvs
|
# some nifty bits to introduce a commit-id with cvs
|
||||||
# natively cvs doesn't provide any kind of changesets, there is only a revision per file.
|
# natively cvs doesn't provide any kind of changesets,
|
||||||
|
# there is only a revision per file.
|
||||||
# we now take a guess using the author, the commitlog and the commit-date.
|
# we now take a guess using the author, the commitlog and the commit-date.
|
||||||
|
|
||||||
# last one is the next step to take. the commit-date is not equal for all
|
# last one is the next step to take. the commit-date is not equal for all
|
||||||
|
@ -150,27 +150,30 @@ class Repository::Cvs < Repository
|
||||||
action="D" #dead-state is similar to Delete
|
action="D" #dead-state is similar to Delete
|
||||||
end
|
end
|
||||||
|
|
||||||
Change.create(:changeset => cs,
|
Change.create(
|
||||||
:action => action,
|
:changeset => cs,
|
||||||
:path => scm.with_leading_slash(revision.paths[0][:path]),
|
:action => action,
|
||||||
:revision => revision.paths[0][:revision],
|
:path => scm.with_leading_slash(revision.paths[0][:path]),
|
||||||
:branch => revision.paths[0][:branch]
|
:revision => revision.paths[0][:revision],
|
||||||
)
|
:branch => revision.paths[0][:branch]
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renumber new changesets in chronological order
|
# Renumber new changesets in chronological order
|
||||||
changesets.find(
|
changesets.find(
|
||||||
:all, :order => 'committed_on ASC, id ASC', :conditions => "revision LIKE 'tmp%'"
|
:all,
|
||||||
|
:order => 'committed_on ASC, id ASC',
|
||||||
|
:conditions => "revision LIKE 'tmp%'"
|
||||||
).each do |changeset|
|
).each do |changeset|
|
||||||
changeset.update_attribute :revision, next_revision_number
|
changeset.update_attribute :revision, next_revision_number
|
||||||
end
|
end
|
||||||
end # transaction
|
end # transaction
|
||||||
@current_revision_number = nil
|
@current_revision_number = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Returns the next revision number to assign to a CVS changeset
|
# Returns the next revision number to assign to a CVS changeset
|
||||||
def next_revision_number
|
def next_revision_number
|
||||||
# Need to retrieve existing revision numbers to sort them as integers
|
# Need to retrieve existing revision numbers to sort them as integers
|
||||||
|
|
Loading…
Reference in New Issue