diff hgext/convert/subversion.py @ 5074:4cef0b93969d

convert: svn: hoist up branch creation check
author Brendan Cully <brendan@kublai.com>
date Sun, 05 Aug 2007 10:23:45 -0700
parents eb81294cf970
children 514c06098e9c
line wrap: on
line diff
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -377,20 +377,22 @@ class convert_svn(converter_source):
 
             orig_paths = orig_paths.items()
             orig_paths.sort()
+            
+            # check whether this revision is the start of a branch
+            path, ent = orig_paths and orig_paths[0] or (None, None)
+            if ent and path == self.module:
+                if ent.copyfrom_path:
+                    # ent.copyfrom_rev may not be the actual last revision
+                    prev = self.latest(ent.copyfrom_path, ent.copyfrom_rev)
+                    self.modulemap[prev] = ent.copyfrom_path
+                    parents = [self.revid(prev, ent.copyfrom_path)]
+                    self.ui.note('found parent of branch %s at %d: %s\n' % \
+                                     (self.module, prev, ent.copyfrom_path))
+                else:
+                    self.ui.debug("No copyfrom path, don't know what to do.\n")
+
             for path, ent in orig_paths:
                 # self.ui.write("path %s\n" % path)
-                if path == self.module: # Follow branching back in history
-                    if ent:
-                        if ent.copyfrom_path:
-                            # ent.copyfrom_rev may not be the actual last revision
-                            prev = self.latest(ent.copyfrom_path, ent.copyfrom_rev)
-                            self.modulemap[prev] = ent.copyfrom_path
-                            parents = [self.revid(prev, ent.copyfrom_path)]
-                            self.ui.note('found parent of branch %s at %d: %s\n' % \
-                                         (self.module, prev, ent.copyfrom_path))
-                        else:
-                            self.ui.debug("No copyfrom path, don't know what to do.\n")
-                            # Maybe it was added and there is no more history.
                 entrypath = get_entry_from_path(path, module=self.module)
                 # self.ui.write("entrypath %s\n" % entrypath)
                 if entrypath is None: