##// END OF EJS Templates
scm: cvs: code clean up app/models/repository/cvs.rb....
Toshi MARUYAMA -
r5256:18431d3681e0
parent child
Show More
@@ -77,12 +77,11 class Repository::Cvs < Repository
77 changeset_to=changesets.find_by_revision(rev_to)
77 changeset_to=changesets.find_by_revision(rev_to)
78 end
78 end
79 changeset_from.changes.each() do |change_from|
79 changeset_from.changes.each() do |change_from|
80
80 revision_from = nil
81 revision_from=nil
81 revision_to = nil
82 revision_to=nil
82 if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
83
83 revision_from=change_from.revision
84 revision_from=change_from.revision if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
84 end
85
86 if revision_from
85 if revision_from
87 if changeset_to
86 if changeset_to
88 changeset_to.changes.each() do |change_to|
87 changeset_to.changes.each() do |change_to|
@@ -98,10 +97,11 class Repository::Cvs < Repository
98 end
97 end
99 return diff
98 return diff
100 end
99 end
101
100
102 def fetch_changesets
101 def fetch_changesets
103 # some nifty bits to introduce a commit-id with cvs
102 # some nifty bits to introduce a commit-id with cvs
104 # natively cvs doesn't provide any kind of changesets, there is only a revision per file.
103 # natively cvs doesn't provide any kind of changesets,
104 # there is only a revision per file.
105 # we now take a guess using the author, the commitlog and the commit-date.
105 # we now take a guess using the author, the commitlog and the commit-date.
106
106
107 # last one is the next step to take. the commit-date is not equal for all
107 # last one is the next step to take. the commit-date is not equal for all
@@ -150,27 +150,30 class Repository::Cvs < Repository
150 action="D" #dead-state is similar to Delete
150 action="D" #dead-state is similar to Delete
151 end
151 end
152
152
153 Change.create(:changeset => cs,
153 Change.create(
154 :action => action,
154 :changeset => cs,
155 :path => scm.with_leading_slash(revision.paths[0][:path]),
155 :action => action,
156 :revision => revision.paths[0][:revision],
156 :path => scm.with_leading_slash(revision.paths[0][:path]),
157 :branch => revision.paths[0][:branch]
157 :revision => revision.paths[0][:revision],
158 )
158 :branch => revision.paths[0][:branch]
159 )
159 end
160 end
160 end
161 end
161
162
162 # Renumber new changesets in chronological order
163 # Renumber new changesets in chronological order
163 changesets.find(
164 changesets.find(
164 :all, :order => 'committed_on ASC, id ASC', :conditions => "revision LIKE 'tmp%'"
165 :all,
166 :order => 'committed_on ASC, id ASC',
167 :conditions => "revision LIKE 'tmp%'"
165 ).each do |changeset|
168 ).each do |changeset|
166 changeset.update_attribute :revision, next_revision_number
169 changeset.update_attribute :revision, next_revision_number
167 end
170 end
168 end # transaction
171 end # transaction
169 @current_revision_number = nil
172 @current_revision_number = nil
170 end
173 end
171
174
172 private
175 private
173
176
174 # Returns the next revision number to assign to a CVS changeset
177 # Returns the next revision number to assign to a CVS changeset
175 def next_revision_number
178 def next_revision_number
176 # Need to retrieve existing revision numbers to sort them as integers
179 # Need to retrieve existing revision numbers to sort them as integers
General Comments 0
You need to be logged in to leave comments. Login now