Show More
@@ -448,76 +448,79 b' class svn_source(converter_source):' | |||||
448 | pendings = [] |
|
448 | pendings = [] | |
449 | tagspath = self.tags |
|
449 | tagspath = self.tags | |
450 | start = svn.ra.get_latest_revnum(self.ra) |
|
450 | start = svn.ra.get_latest_revnum(self.ra) | |
451 |
|
|
451 | stream = self._getlog([self.tags], start, self.startrev) | |
452 | origpaths, revnum, author, date, message = entry |
|
452 | try: | |
453 | copies = [(e.copyfrom_path, e.copyfrom_rev, p) for p, e |
|
453 | for entry in stream: | |
454 | in origpaths.iteritems() if e.copyfrom_path] |
|
454 | origpaths, revnum, author, date, message = entry | |
455 | # Apply moves/copies from more specific to general |
|
455 | copies = [(e.copyfrom_path, e.copyfrom_rev, p) for p, e | |
456 | copies.sort(reverse=True) |
|
456 | in origpaths.iteritems() if e.copyfrom_path] | |
|
457 | # Apply moves/copies from more specific to general | |||
|
458 | copies.sort(reverse=True) | |||
457 |
|
459 | |||
458 | srctagspath = tagspath |
|
460 | srctagspath = tagspath | |
459 | if copies and copies[-1][2] == tagspath: |
|
461 | if copies and copies[-1][2] == tagspath: | |
460 | # Track tags directory moves |
|
462 | # Track tags directory moves | |
461 | srctagspath = copies.pop()[0] |
|
463 | srctagspath = copies.pop()[0] | |
462 |
|
464 | |||
463 | for source, sourcerev, dest in copies: |
|
465 | for source, sourcerev, dest in copies: | |
464 | if not dest.startswith(tagspath + '/'): |
|
466 | if not dest.startswith(tagspath + '/'): | |
465 | continue |
|
467 | continue | |
466 | for tag in pendings: |
|
468 | for tag in pendings: | |
467 | if tag[0].startswith(dest): |
|
469 | if tag[0].startswith(dest): | |
468 | tagpath = source + tag[0][len(dest):] |
|
470 | tagpath = source + tag[0][len(dest):] | |
469 | tag[:2] = [tagpath, sourcerev] |
|
471 | tag[:2] = [tagpath, sourcerev] | |
470 | break |
|
472 | break | |
471 | else: |
|
473 | else: | |
472 | pendings.append([source, sourcerev, dest]) |
|
474 | pendings.append([source, sourcerev, dest]) | |
473 |
|
475 | |||
474 | # Filter out tags with children coming from different |
|
476 | # Filter out tags with children coming from different | |
475 | # parts of the repository like: |
|
477 | # parts of the repository like: | |
476 | # /tags/tag.1 (from /trunk:10) |
|
478 | # /tags/tag.1 (from /trunk:10) | |
477 | # /tags/tag.1/foo (from /branches/foo:12) |
|
479 | # /tags/tag.1/foo (from /branches/foo:12) | |
478 | # Here/tags/tag.1 discarded as well as its children. |
|
480 | # Here/tags/tag.1 discarded as well as its children. | |
479 | # It happens with tools like cvs2svn. Such tags cannot |
|
481 | # It happens with tools like cvs2svn. Such tags cannot | |
480 | # be represented in mercurial. |
|
482 | # be represented in mercurial. | |
481 | addeds = dict((p, e.copyfrom_path) for p, e |
|
483 | addeds = dict((p, e.copyfrom_path) for p, e | |
482 | in origpaths.iteritems() |
|
484 | in origpaths.iteritems() | |
483 | if e.action == 'A' and e.copyfrom_path) |
|
485 | if e.action == 'A' and e.copyfrom_path) | |
484 | badroots = set() |
|
486 | badroots = set() | |
485 | for destroot in addeds: |
|
487 | for destroot in addeds: | |
486 | for source, sourcerev, dest in pendings: |
|
488 | for source, sourcerev, dest in pendings: | |
487 | if (not dest.startswith(destroot + '/') |
|
489 | if (not dest.startswith(destroot + '/') | |
488 | or source.startswith(addeds[destroot] + '/')): |
|
490 | or source.startswith(addeds[destroot] + '/')): | |
489 | continue |
|
491 | continue | |
490 | badroots.add(destroot) |
|
492 | badroots.add(destroot) | |
491 | break |
|
493 | break | |
492 |
|
494 | |||
493 | for badroot in badroots: |
|
495 | for badroot in badroots: | |
494 | pendings = [p for p in pendings if p[2] != badroot |
|
496 | pendings = [p for p in pendings if p[2] != badroot | |
495 | and not p[2].startswith(badroot + '/')] |
|
497 | and not p[2].startswith(badroot + '/')] | |
496 |
|
498 | |||
497 | # Tell tag renamings from tag creations |
|
499 | # Tell tag renamings from tag creations | |
498 | remainings = [] |
|
500 | remainings = [] | |
499 | for source, sourcerev, dest in pendings: |
|
501 | for source, sourcerev, dest in pendings: | |
500 | tagname = dest.split('/')[-1] |
|
502 | tagname = dest.split('/')[-1] | |
501 | if source.startswith(srctagspath): |
|
503 | if source.startswith(srctagspath): | |
502 | remainings.append([source, sourcerev, tagname]) |
|
504 | remainings.append([source, sourcerev, tagname]) | |
503 | continue |
|
505 | continue | |
504 | if tagname in tags: |
|
506 | if tagname in tags: | |
505 | # Keep the latest tag value |
|
507 | # Keep the latest tag value | |
506 | continue |
|
508 | continue | |
507 | # From revision may be fake, get one with changes |
|
509 | # From revision may be fake, get one with changes | |
508 | try: |
|
510 | try: | |
509 | tagid = self.latest(source, sourcerev) |
|
511 | tagid = self.latest(source, sourcerev) | |
510 | if tagid and tagname not in tags: |
|
512 | if tagid and tagname not in tags: | |
511 | tags[tagname] = tagid |
|
513 | tags[tagname] = tagid | |
512 | except SvnPathNotFound: |
|
514 | except SvnPathNotFound: | |
513 | # It happens when we are following directories |
|
515 | # It happens when we are following directories | |
514 | # we assumed were copied with their parents |
|
516 | # we assumed were copied with their parents | |
515 | # but were really created in the tag |
|
517 | # but were really created in the tag | |
516 | # directory. |
|
518 | # directory. | |
517 | pass |
|
519 | pass | |
518 | pendings = remainings |
|
520 | pendings = remainings | |
519 | tagspath = srctagspath |
|
521 | tagspath = srctagspath | |
520 |
|
522 | finally: | ||
|
523 | stream.close() | |||
521 | return tags |
|
524 | return tags | |
522 |
|
525 | |||
523 | def converted(self, rev, destrev): |
|
526 | def converted(self, rev, destrev): |
General Comments 0
You need to be logged in to leave comments.
Login now