comparison hgext/convert/subversion.py @ 5958:59dce24933ad

convert: follow svn module parent moves
author Patrick Mezard <pmezard@gmail.com>
date Sat, 26 Jan 2008 14:45:04 +0100
parents 971a17af5982
children 4e87e785c5bf
comparison
equal deleted inserted replaced
5957:971a17af5982 5958:59dce24933ad
666 666
667 if (rev in self.commits or revnum < to_revnum): 667 if (rev in self.commits or revnum < to_revnum):
668 return None, branched 668 return None, branched
669 669
670 parents = [] 670 parents = []
671 # check whether this revision is the start of a branch 671 # check whether this revision is the start of a branch or part
672 if self.module in orig_paths: 672 # of a branch renaming
673 ent = orig_paths[self.module] 673 orig_paths = orig_paths.items()
674 orig_paths.sort()
675 root_paths = [(p,e) for p,e in orig_paths if self.module.startswith(p)]
676 if root_paths:
677 path, ent = root_paths[-1]
674 if ent.copyfrom_path: 678 if ent.copyfrom_path:
675 branched = True 679 branched = True
680 newpath = ent.copyfrom_path + self.module[len(path):]
676 # ent.copyfrom_rev may not be the actual last revision 681 # ent.copyfrom_rev may not be the actual last revision
677 previd = self.latest(ent.copyfrom_path, ent.copyfrom_rev) 682 previd = self.latest(newpath, ent.copyfrom_rev)
678 if previd is not None: 683 if previd is not None:
679 parents = [previd] 684 parents = [previd]
680 prevmodule, prevnum = self.revsplit(previd)[1:] 685 prevmodule, prevnum = self.revsplit(previd)[1:]
681 self.ui.note('found parent of branch %s at %d: %s\n' % 686 self.ui.note('found parent of branch %s at %d: %s\n' %
682 (self.module, prevnum, prevmodule)) 687 (self.module, prevnum, prevmodule))
683 else: 688 else:
684 self.ui.debug("No copyfrom path, don't know what to do.\n") 689 self.ui.debug("No copyfrom path, don't know what to do.\n")
685 690
686 orig_paths = orig_paths.items()
687 orig_paths.sort()
688 paths = [] 691 paths = []
689 # filter out unrelated paths 692 # filter out unrelated paths
690 for path, ent in orig_paths: 693 for path, ent in orig_paths:
691 if not path.startswith(self.module): 694 if not path.startswith(self.module):
692 self.ui.debug("boring@%s: %s\n" % (revnum, path)) 695 self.ui.debug("boring@%s: %s\n" % (revnum, path))