summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-09 23:22:22 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-09 23:22:22 +0000
commit18431d3681e07899b4a699f5013146490423398b (patch)
tree04da6e3135ad5af026616d3343eca991b440dce6 /app
parentcae3fcce54bd8bb9214520cbdac26a7a4adcc451 (diff)
downloadredmine-18431d3681e07899b4a699f5013146490423398b.tar.gz
redmine-18431d3681e07899b4a699f5013146490423398b.zip
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
Diffstat (limited to 'app')
-rw-r--r--app/models/repository/cvs.rb39
1 files changed, 21 insertions, 18 deletions
diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb
index be10e64a3..84784359d 100644
--- a/app/models/repository/cvs.rb
+++ b/app/models/repository/cvs.rb
@@ -77,12 +77,11 @@ class Repository::Cvs < Repository
changeset_to=changesets.find_by_revision(rev_to)
end
changeset_from.changes.each() do |change_from|
-
- revision_from=nil
- revision_to=nil
-
- revision_from=change_from.revision if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
-
+ revision_from = nil
+ revision_to = nil
+ if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
+ revision_from=change_from.revision
+ end
if revision_from
if changeset_to
changeset_to.changes.each() do |change_to|
@@ -98,10 +97,11 @@ class Repository::Cvs < Repository
end
return diff
end
-
+
def fetch_changesets
# 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.
# 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
end
- Change.create(:changeset => cs,
- :action => action,
- :path => scm.with_leading_slash(revision.paths[0][:path]),
- :revision => revision.paths[0][:revision],
- :branch => revision.paths[0][:branch]
- )
+ Change.create(
+ :changeset => cs,
+ :action => action,
+ :path => scm.with_leading_slash(revision.paths[0][:path]),
+ :revision => revision.paths[0][:revision],
+ :branch => revision.paths[0][:branch]
+ )
end
end
-
+
# Renumber new changesets in chronological order
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|
changeset.update_attribute :revision, next_revision_number
end
end # transaction
@current_revision_number = nil
end
-
+
private
-
+
# Returns the next revision number to assign to a CVS changeset
def next_revision_number
# Need to retrieve existing revision numbers to sort them as integers