convert: follow svn module parent moves
authorPatrick Mezard <pmezard@gmail.com>
Sat, 26 Jan 2008 14:45:04 +0100
changeset 5958 59dce24933ad
parent 5957 971a17af5982
child 5959 0162c6cc045e
convert: follow svn module parent moves
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Sat Jan 26 14:45:04 2008 +0100
+++ b/hgext/convert/subversion.py	Sat Jan 26 14:45:04 2008 +0100
@@ -668,13 +668,18 @@
                 return None, branched
 
             parents = []
-            # check whether this revision is the start of a branch
-            if self.module in orig_paths:
-                ent = orig_paths[self.module]
+            # check whether this revision is the start of a branch or part
+            # of a branch renaming
+            orig_paths = orig_paths.items()
+            orig_paths.sort()
+            root_paths = [(p,e) for p,e in orig_paths if self.module.startswith(p)]
+            if root_paths:
+                path, ent = root_paths[-1]
                 if ent.copyfrom_path:
                     branched = True
+                    newpath = ent.copyfrom_path + self.module[len(path):]
                     # ent.copyfrom_rev may not be the actual last revision
-                    previd = self.latest(ent.copyfrom_path, ent.copyfrom_rev)
+                    previd = self.latest(newpath, ent.copyfrom_rev)
                     if previd is not None:
                         parents = [previd]
                         prevmodule, prevnum = self.revsplit(previd)[1:]
@@ -683,8 +688,6 @@
                 else:
                     self.ui.debug("No copyfrom path, don't know what to do.\n")
 
-            orig_paths = orig_paths.items()
-            orig_paths.sort()
             paths = []
             # filter out unrelated paths
             for path, ent in orig_paths: