##// END OF EJS Templates
convert: svn: pull out broken batching code, add alpha tags support
Brendan Cully -
r4796:26857a6f default
parent child Browse files
Show More
@@ -183,25 +183,6 b' class convert_svn(converter_source):'
183 183 svn.ra.reparent(self.ra, svn_url.encode(self.encoding))
184 184
185 185 def _fetch_revisions(self, from_revnum = 0, to_revnum = 347, module=None):
186 # batching is broken for branches
187 to_revnum = 0
188 if not hasattr(self, 'child_rev'):
189 self.child_rev = from_revnum
190 self.child_cset = self.commits.get(self.child_rev)
191 else:
192 self.commits[self.child_rev] = self.child_cset
193 # batching broken
194 return
195 # if the branch was created in the middle of the last batch,
196 # svn log will complain that the path doesn't exist in this batch
197 # so we roll the parser back to the last revision where this branch appeared
198 revnum = self.revnum(self.child_rev)
199 if revnum > from_revnum:
200 from_revnum = revnum
201
202 self.ui.note('fetching revision log from %d to %d\n' % \
203 (from_revnum, to_revnum))
204
205 186 def get_entry_from_path(path, module=self.module):
206 187 # Given the repository url of this wc, say
207 188 # "http://server/plone/CMFPlone/branches/Plone-2_0-branch"
@@ -221,6 +202,7 b' class convert_svn(converter_source):'
221 202 self.ui.debug('Ignoring %r since it is not under %r\n' % (path, module))
222 203 return None
223 204
205 self.child_cset = None
224 206 def parselogentry(*arg, **args):
225 207 orig_paths, revnum, author, date, message, pool = arg
226 208 orig_paths = svn_paths(orig_paths)
@@ -256,13 +238,13 b' class convert_svn(converter_source):'
256 238 for path in orig_paths:
257 239 # self.ui.write("path %s\n" % path)
258 240 if path == self.module: # Follow branching back in history
259 import pdb
260 pdb.set_trace()
261 241 ent = orig_paths[path]
262 242 if ent:
263 243 if ent.copyfrom_path:
264 self.modulemap[ent.copyfrom_rev] = ent.copyfrom_path
265 parents = [self.rev(ent.copyfrom_rev, ent.copyfrom_path)]
244 # ent.copyfrom_rev may not be the actual last revision
245 prev = self.latest(ent.copyfrom_path, revnum)
246 self.modulemap[prev] = ent.copyfrom_path
247 parents = [self.rev(prev, ent.copyfrom_path)]
266 248 else:
267 249 self.ui.debug("No copyfrom path, don't know what to do.\n")
268 250 # Maybe it was added and there is no more history.
@@ -440,11 +422,13 b' class convert_svn(converter_source):'
440 422 copies=copies,
441 423 branch=branch)
442 424
443 if self.child_cset and self.child_rev != rev:
425 self.commits[rev] = cset
426 if self.child_cset and not self.child_cset.parents:
444 427 self.child_cset.parents = [rev]
445 self.commits[self.child_rev] = self.child_cset
446 428 self.child_cset = cset
447 self.child_rev = rev
429
430 self.ui.note('fetching revision log from %d to %d\n' % \
431 (from_revnum, to_revnum))
448 432
449 433 if module is None:
450 434 module = self.module
@@ -514,12 +498,30 b' class convert_svn(converter_source):'
514 498 if rev not in self.commits:
515 499 uuid, module, revnum = self.revsplit(rev)
516 500 minrev = revnum - LOG_BATCH_SIZE > 0 and revnum - LOG_BATCH_SIZE or 0
517 self._fetch_revisions(from_revnum=revnum, to_revnum=minrev,
501 self._fetch_revisions(from_revnum=revnum, to_revnum=0,
518 502 module=module)
519 503 return self.commits[rev]
520 504
521 505 def gettags(self):
522 return []
506 tags = {}
507 def parselogentry(*arg, **args):
508 orig_paths, revnum, author, date, message, pool = arg
509 orig_paths = svn_paths(orig_paths)
510 for path in orig_paths:
511 ent = orig_paths[path]
512 source = ent.copyfrom_path
513 rev = ent.copyfrom_rev
514 tag = path.split('/', 2)[2]
515 tags[tag] = self.rev(rev, module=source)
516
517 start = self.revnum(self.head)
518 try:
519 svn.ra.get_log(self.ra, ['/tags'], start, 0, 1, True, False,
520 parselogentry)
521 return tags
522 except SubversionException:
523 self.ui.note('no tags found at revision %d\n' % start)
524 return {}
523 525
524 526 def _find_children(self, path, revnum):
525 527 path = path.strip("/")
General Comments 0
You need to be logged in to leave comments. Login now