# HG changeset patch # User Francois Dinel # Date 1424455983 18000 # Node ID 43a365f5d13cf48776ca830023cb9770303a3e78 # Parent f1b8029cf8e9d079e3ea7863219978651049e702 Allow changing the path to the trunk diff --git a/hgsubversion/__init__.py b/hgsubversion/__init__.py --- 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', '', diff --git a/hgsubversion/layouts/standard.py b/hgsubversion/layouts/standard.py --- 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): diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- 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'),