diff hg_delta_editor.py @ 207:b20a6c149021

fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
author Augie Fackler <durin42@gmail.com>
date Mon, 09 Mar 2009 12:01:40 -0500
parents 907c160c6289
children 05243ec295e1
line wrap: on
line diff
--- a/hg_delta_editor.py
+++ b/hg_delta_editor.py
@@ -220,6 +220,9 @@ class HgChangeReceiver(delta.Editor):
                     filepaths = [p for p in filepaths if not '/'.join(p).startswith(parentdir)]
                     branchpath = self._normalize_path(parentdir)
                     branchname = self._localname(branchpath)
+                    if branchpath.startswith('trunk/'):
+                        branches[self._localname('trunk')] = 'trunk'
+                        continue
                     branches[branchname] = branchpath
 
         return branches
@@ -268,8 +271,12 @@ class HgChangeReceiver(delta.Editor):
             return path[len(test)+1:], self._localname(test), test
         if existing:
             return None, None, None
-        path = test.split('/')[-1]
-        test = '/'.join(test.split('/')[:-1])
+        if path.startswith('trunk/'):
+            path = test.split('/')[1:]
+            test = 'trunk'
+        else:
+            path = test.split('/')[-1]
+            test = '/'.join(test.split('/')[:-1])
         return path, self._localname(test), test
 
     def set_current_rev(self, rev):