##// 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 77 changeset_to=changesets.find_by_revision(rev_to)
78 78 end
79 79 changeset_from.changes.each() do |change_from|
80
81 revision_from=nil
82 revision_to=nil
83
84 revision_from=change_from.revision if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
85
80 revision_from = nil
81 revision_to = nil
82 if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
83 revision_from=change_from.revision
84 end
86 85 if revision_from
87 86 if changeset_to
88 87 changeset_to.changes.each() do |change_to|
@@ -98,10 +97,11 class Repository::Cvs < Repository
98 97 end
99 98 return diff
100 99 end
101
100
102 101 def fetch_changesets
103 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 105 # we now take a guess using the author, the commitlog and the commit-date.
106 106
107 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 150 action="D" #dead-state is similar to Delete
151 151 end
152 152
153 Change.create(:changeset => cs,
154 :action => action,
155 :path => scm.with_leading_slash(revision.paths[0][:path]),
156 :revision => revision.paths[0][:revision],
157 :branch => revision.paths[0][:branch]
158 )
153 Change.create(
154 :changeset => cs,
155 :action => action,
156 :path => scm.with_leading_slash(revision.paths[0][:path]),
157 :revision => revision.paths[0][:revision],
158 :branch => revision.paths[0][:branch]
159 )
159 160 end
160 161 end
161
162
162 163 # Renumber new changesets in chronological order
163 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 168 ).each do |changeset|
166 169 changeset.update_attribute :revision, next_revision_number
167 170 end
168 171 end # transaction
169 172 @current_revision_number = nil
170 173 end
171
174
172 175 private
173
176
174 177 # Returns the next revision number to assign to a CVS changeset
175 178 def next_revision_number
176 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