changeset 1319:43a365f5d13c

Allow changing the path to the trunk
author Francois Dinel <fdinel@gmail.com>
date Fri, 20 Feb 2015 13:13:03 -0500
parents f1b8029cf8e9
children 2061fd988f3f
files hgsubversion/__init__.py hgsubversion/layouts/standard.py hgsubversion/wrappers.py
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/__init__.py
+++ b/hgsubversion/__init__.py
@@ -77,6 +77,8 @@ wrapcmds = { # cmd: generic, target, fix
          'list of paths to search for tags in Subversion repositories'),
         ('', 'branchdir', '',
          'path to search for branches in subversion repositories'),
+        ('', 'trunkdir', '',
+         'path to trunk in subversion repositories'),
         ('', 'infix', '',
          'path relative to trunk, branch an tag dirs to import'),
         ('A', 'authors', '',
--- a/hgsubversion/layouts/standard.py
+++ b/hgsubversion/layouts/standard.py
@@ -28,6 +28,7 @@ class StandardLayout(base.BaseLayout):
         # the lambda is to ensure nested paths are handled properly
         meta._gen_cachedconfig('taglocations', ['tags'], 'tag_locations',
                                'tagpaths', lambda x: list(reversed(sorted(x))))
+        meta._gen_cachedconfig('trunkdir', 'trunk', 'trunk_dir')
 
     @property
     def name(self):
@@ -35,7 +36,7 @@ class StandardLayout(base.BaseLayout):
 
     @property
     def trunk(self):
-        return 'trunk' + self.meta.infix
+        return self.meta.trunkdir + self.meta.infix
 
     def localname(self, path):
         if path == self.trunk:
@@ -102,7 +103,7 @@ class StandardLayout(base.BaseLayout):
         if self.localname(candidate) in known_branches:
             return candidate, '/'.join(components)
 
-        if path == 'trunk' or path.startswith('trunk/'):
+        if path == self.meta.trunkdir or path.startswith(self.meta.trunkdir + '/'):
             return self.trunk, path[len(self.trunk) + 1:]
 
         if path.startswith(self.meta.branchdir):
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -589,6 +589,7 @@ optionmap = {
     'tagpaths': ('hgsubversion', 'tagpaths'),
     'authors': ('hgsubversion', 'authormap'),
     'branchdir': ('hgsubversion', 'branchdir'),
+    'trunkdir': ('hgsubversion', 'trunkdir'),
     'infix': ('hgsubversion', 'infix'),
     'filemap': ('hgsubversion', 'filemap'),
     'branchmap': ('hgsubversion', 'branchmap'),