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