]> source.dussan.org Git - redmine.git/commitdiff
scm: cvs: code clean up model.
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 13 Apr 2011 11:54:42 +0000 (11:54 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 13 Apr 2011 11:54:42 +0000 (11:54 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5450 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository/cvs.rb

index d2504ff06354a9941a88868d863354de0780a2ae..4112f3ecd5dc70ee557a990ead4e1ed7673a605e 100644 (file)
@@ -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,