##// END OF EJS Templates
scm: cvs: code clean up model....
Toshi MARUYAMA -
r5330:b091c9823849
parent child
Show More
@@ -124,8 +124,7 class Repository::Cvs < Repository
124 124 # last one is the next step to take. the commit-date is not equal for all
125 125 # commits in one changeset. cvs update the commit-date when the *,v file was touched. so
126 126 # we use a small delta here, to merge all changes belonging to _one_ changeset
127 time_delta=10.seconds
128
127 time_delta = 10.seconds
129 128 fetch_since = latest_changeset ? latest_changeset.committed_on : nil
130 129 transaction do
131 130 tmp_rev_num = 1
@@ -134,39 +133,41 class Repository::Cvs < Repository
134 133 # is not exclusive at all.
135 134 tmp_time = revision.time.clone
136 135 unless changes.find_by_path_and_revision(
137 scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision])
136 scm.with_leading_slash(revision.paths[0][:path]),
137 revision.paths[0][:revision]
138 )
138 139 cmt = Changeset.normalize_comments(revision.message, repo_log_encoding)
139 cs = changesets.find(:first, :conditions=>{
140 :committed_on=>tmp_time - time_delta .. tmp_time + time_delta,
141 :committer=>revision.author,
142 :comments=>cmt
143 })
144
140 cs = changesets.find(
141 :first,
142 :conditions => {
143 :committed_on => tmp_time - time_delta .. tmp_time + time_delta,
144 :committer => revision.author,
145 :comments => cmt
146 }
147 )
145 148 # create a new changeset....
146 149 unless cs
147 150 # we use a temporaray revision number here (just for inserting)
148 151 # later on, we calculate a continous positive number
149 152 tmp_time2 = tmp_time.clone.gmtime
150 branch = revision.paths[0][:branch]
151 scmid = branch + "-" + tmp_time2.strftime("%Y%m%d-%H%M%S")
152 cs = Changeset.create(:repository => self,
153 :revision => "tmp#{tmp_rev_num}",
154 :scmid => scmid,
155 :committer => revision.author,
153 branch = revision.paths[0][:branch]
154 scmid = branch + "-" + tmp_time2.strftime("%Y%m%d-%H%M%S")
155 cs = Changeset.create(:repository => self,
156 :revision => "tmp#{tmp_rev_num}",
157 :scmid => scmid,
158 :committer => revision.author,
156 159 :committed_on => tmp_time,
157 :comments => revision.message)
160 :comments => revision.message)
158 161 tmp_rev_num += 1
159 162 end
160
161 #convert CVS-File-States to internal Action-abbrevations
162 #default action is (M)odified
163 action="M"
164 if revision.paths[0][:action]=="Exp" && revision.paths[0][:revision]=="1.1"
165 action="A" #add-action always at first revision (= 1.1)
166 elsif revision.paths[0][:action]=="dead"
167 action="D" #dead-state is similar to Delete
163 # convert CVS-File-States to internal Action-abbrevations
164 # default action is (M)odified
165 action = "M"
166 if revision.paths[0][:action] == "Exp" && revision.paths[0][:revision] == "1.1"
167 action = "A" # add-action always at first revision (= 1.1)
168 elsif revision.paths[0][:action] == "dead"
169 action = "D" # dead-state is similar to Delete
168 170 end
169
170 171 Change.create(
171 172 :changeset => cs,
172 173 :action => action,
General Comments 0
You need to be logged in to leave comments. Login now