Mercurial > hgsubversion
comparison hgsubversion/layouts/standard.py @ 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 | a6d3692a5800 |
children |
comparison
equal
deleted
inserted
replaced
1318:f1b8029cf8e9 | 1319:43a365f5d13c |
---|---|
26 meta._gen_cachedconfig('infix', '', pre=_infix_transform) | 26 meta._gen_cachedconfig('infix', '', pre=_infix_transform) |
27 | 27 |
28 # the lambda is to ensure nested paths are handled properly | 28 # the lambda is to ensure nested paths are handled properly |
29 meta._gen_cachedconfig('taglocations', ['tags'], 'tag_locations', | 29 meta._gen_cachedconfig('taglocations', ['tags'], 'tag_locations', |
30 'tagpaths', lambda x: list(reversed(sorted(x)))) | 30 'tagpaths', lambda x: list(reversed(sorted(x)))) |
31 meta._gen_cachedconfig('trunkdir', 'trunk', 'trunk_dir') | |
31 | 32 |
32 @property | 33 @property |
33 def name(self): | 34 def name(self): |
34 return 'standard' | 35 return 'standard' |
35 | 36 |
36 @property | 37 @property |
37 def trunk(self): | 38 def trunk(self): |
38 return 'trunk' + self.meta.infix | 39 return self.meta.trunkdir + self.meta.infix |
39 | 40 |
40 def localname(self, path): | 41 def localname(self, path): |
41 if path == self.trunk: | 42 if path == self.trunk: |
42 return None | 43 return None |
43 elif path.startswith(self.meta.branchdir) and path.endswith(self.meta.infix): | 44 elif path.startswith(self.meta.branchdir) and path.endswith(self.meta.infix): |
100 candidate += '/' | 101 candidate += '/' |
101 candidate += components.pop(0) | 102 candidate += components.pop(0) |
102 if self.localname(candidate) in known_branches: | 103 if self.localname(candidate) in known_branches: |
103 return candidate, '/'.join(components) | 104 return candidate, '/'.join(components) |
104 | 105 |
105 if path == 'trunk' or path.startswith('trunk/'): | 106 if path == self.meta.trunkdir or path.startswith(self.meta.trunkdir + '/'): |
106 return self.trunk, path[len(self.trunk) + 1:] | 107 return self.trunk, path[len(self.trunk) + 1:] |
107 | 108 |
108 if path.startswith(self.meta.branchdir): | 109 if path.startswith(self.meta.branchdir): |
109 path = path[len(self.meta.branchdir):] | 110 path = path[len(self.meta.branchdir):] |
110 components = path.split('/', 1) | 111 components = path.split('/', 1) |