diff hg_delta_editor.py @ 218:a360ddc97719

branches: change handling again, but this time a little less magic. This change means that files located in the actual branches directory will now be wholly ignored. If we want to handle those correctly, it will take a reasonably large amount of work and probably a configuration flag. Also, any non-related paths outside of branches/trunk will be explicitly ignored, which is similar to the somewhat accidental pre-branch-refactor behavior. Finally, any unrelated files located as children of branches will cause the directory in branches to be used as the branch - not, as recently was the case, the directory immediately containing that file.
author Augie Fackler <durin42@gmail.com>
date Sat, 28 Mar 2009 16:38:57 -0500
parents 6eb691a163cd
children f2c65dd3d5c0
line wrap: on
line diff
--- a/hg_delta_editor.py
+++ b/hg_delta_editor.py
@@ -225,6 +225,8 @@ class HgChangeReceiver(delta.Editor):
                     if branchpath.startswith('trunk/'):
                         branches[self._localname('trunk')] = 'trunk'
                         continue
+                    if branchname and branchname.startswith('../'):
+                        continue
                     branches[branchname] = branchpath
 
         return branches
@@ -276,10 +278,17 @@ class HgChangeReceiver(delta.Editor):
         if path.startswith('trunk/'):
             path = test.split('/')[1:]
             test = 'trunk'
+        elif path.startswith('branches/'):
+            elts = path.split('/')
+            test = '/'.join(elts[:2])
+            path = '/'.join(elts[2:])
         else:
             path = test.split('/')[-1]
             test = '/'.join(test.split('/')[:-1])
-        return path, self._localname(test), test
+        ln =  self._localname(test)
+        if ln and ln.startswith('../'):
+            return None, None, None
+        return path, ln, test
 
     def set_current_rev(self, rev):
         """Set the revision we're currently converting.