summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-13 11:54:42 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-04-13 11:54:42 +0000
commitb091c98238495e7c696efc87348dec4199edac14 (patch)
treec87399a530ffeac82e91aef5999c448c9a7f0899
parent12c856124b6b968d55053f413a406b97b4423160 (diff)
downloadredmine-b091c98238495e7c696efc87348dec4199edac14.tar.gz
redmine-b091c98238495e7c696efc87348dec4199edac14.zip
scm: cvs: code clean up model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5450 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/repository/cvs.rb51
1 files changed, 26 insertions, 25 deletions
diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb
index d2504ff06..4112f3ecd 100644
--- a/app/models/repository/cvs.rb
+++ b/app/models/repository/cvs.rb
@@ -124,8 +124,7 @@ class Repository::Cvs < Repository
# last one is the next step to take. the commit-date is not equal for all
# commits in one changeset. cvs update the commit-date when the *,v file was touched. so
# we use a small delta here, to merge all changes belonging to _one_ changeset
- time_delta=10.seconds
-
+ time_delta = 10.seconds
fetch_since = latest_changeset ? latest_changeset.committed_on : nil
transaction do
tmp_rev_num = 1
@@ -134,39 +133,41 @@ class Repository::Cvs < Repository
# is not exclusive at all.
tmp_time = revision.time.clone
unless changes.find_by_path_and_revision(
- scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision])
+ scm.with_leading_slash(revision.paths[0][:path]),
+ revision.paths[0][:revision]
+ )
cmt = Changeset.normalize_comments(revision.message, repo_log_encoding)
- cs = changesets.find(:first, :conditions=>{
- :committed_on=>tmp_time - time_delta .. tmp_time + time_delta,
- :committer=>revision.author,
- :comments=>cmt
- })
-
+ cs = changesets.find(
+ :first,
+ :conditions => {
+ :committed_on => tmp_time - time_delta .. tmp_time + time_delta,
+ :committer => revision.author,
+ :comments => cmt
+ }
+ )
# create a new changeset....
unless cs
# we use a temporaray revision number here (just for inserting)
# later on, we calculate a continous positive number
tmp_time2 = tmp_time.clone.gmtime
- branch = revision.paths[0][:branch]
- scmid = branch + "-" + tmp_time2.strftime("%Y%m%d-%H%M%S")
- cs = Changeset.create(:repository => self,
- :revision => "tmp#{tmp_rev_num}",
- :scmid => scmid,
- :committer => revision.author,
+ branch = revision.paths[0][:branch]
+ scmid = branch + "-" + tmp_time2.strftime("%Y%m%d-%H%M%S")
+ cs = Changeset.create(:repository => self,
+ :revision => "tmp#{tmp_rev_num}",
+ :scmid => scmid,
+ :committer => revision.author,
:committed_on => tmp_time,
- :comments => revision.message)
+ :comments => revision.message)
tmp_rev_num += 1
end
-
- #convert CVS-File-States to internal Action-abbrevations
- #default action is (M)odified
- action="M"
- if revision.paths[0][:action]=="Exp" && revision.paths[0][:revision]=="1.1"
- action="A" #add-action always at first revision (= 1.1)
- elsif revision.paths[0][:action]=="dead"
- action="D" #dead-state is similar to Delete
+ # convert CVS-File-States to internal Action-abbrevations
+ # default action is (M)odified
+ action = "M"
+ if revision.paths[0][:action] == "Exp" && revision.paths[0][:revision] == "1.1"
+ action = "A" # add-action always at first revision (= 1.1)
+ elsif revision.paths[0][:action] == "dead"
+ action = "D" # dead-state is similar to Delete
end
-
Change.create(
:changeset => cs,
:action => action,