diff hgsubversion/layouts/base.py @ 1029:513f2b607b06

layouts: pull out logic for splitting svn paths into branch and local parts There is a single method on svnmeta that is responsible for both splitting a subversion path into a local component, which specifies a path relative to the mercurial root, and a branch component, which specifies the path to the root of a subversion branch, and translating that branch path into a mercurial branch name. This pulls the logic for doing the path splitting into a layout object method that *only* splits the path, and changes the svnmeta to call the layout objects's localname method to do the subversion branch path to mercurial branch name translation.
author David Schleimer <dschleimer@fb.com>
date Wed, 05 Jun 2013 11:06:34 -0700
parents 16045f6f3fef
children 91d061989acc
line wrap: on
line diff
--- a/hgsubversion/layouts/base.py
+++ b/hgsubversion/layouts/base.py
@@ -63,3 +63,18 @@ class BaseLayout(object):
 
         """
         self.__unimplemented('get_path_tag')
+
+    def split_remote_name(self, path, known_branches):
+        """Split the path into a branch component and a local component.
+
+        path should be relative to our repo url
+
+        returns (branch_path, local_path)
+
+        branch_path should be suitable to pass into localname,
+        i.e. branch_path should NOT have a leading or trailing /
+
+        local_path should be relative to the root of the Mercurial working dir
+
+        """
+        self.unimplemented('split_branch_and_local_path')