Mercurial > hgsubversion
comparison hgsubversion/layouts/standard.py @ 1275:ca771cbf69c6
layouts: use meta.infix in standard
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Mon, 24 Mar 2014 11:20:51 -0500 |
parents | d21b7259724a |
children | cc1e2c8cdaa6 |
comparison
equal
deleted
inserted
replaced
1274:d21b7259724a | 1275:ca771cbf69c6 |
---|---|
29 if self._infix: | 29 if self._infix: |
30 self._infix = '/' + self._infix | 30 self._infix = '/' + self._infix |
31 | 31 |
32 @property | 32 @property |
33 def trunk(self): | 33 def trunk(self): |
34 return 'trunk' + self._infix | 34 return 'trunk' + self.meta.infix |
35 | 35 |
36 def localname(self, path): | 36 def localname(self, path): |
37 if path == self.trunk: | 37 if path == self.trunk: |
38 return None | 38 return None |
39 elif path.startswith(self.meta.branchdir) and path.endswith(self._infix): | 39 elif path.startswith(self.meta.branchdir) and path.endswith(self.meta.infix): |
40 path = path[len(self.meta.branchdir):] | 40 path = path[len(self.meta.branchdir):] |
41 if self._infix: | 41 if self.meta.infix: |
42 path = path[:-len(self._infix)] | 42 path = path[:-len(self.meta.infix)] |
43 return path | 43 return path |
44 return '../%s' % path | 44 return '../%s' % path |
45 | 45 |
46 def remotename(self, branch): | 46 def remotename(self, branch): |
47 if branch == 'default' or branch is None: | 47 if branch == 'default' or branch is None: |
48 path = self.trunk | 48 path = self.trunk |
49 elif branch.startswith('../'): | 49 elif branch.startswith('../'): |
50 path = branch[3:] | 50 path = branch[3:] |
51 else: | 51 else: |
52 path = ''.join((self.meta.branchdir, branch, self._infix)) | 52 path = ''.join((self.meta.branchdir, branch, self.meta.infix)) |
53 | 53 |
54 return path | 54 return path |
55 | 55 |
56 def remotepath(self, branch, subdir='/'): | 56 def remotepath(self, branch, subdir='/'): |
57 if subdir == '/': | 57 if subdir == '/': |
59 branchpath = self.trunk | 59 branchpath = self.trunk |
60 if branch and branch != 'default': | 60 if branch and branch != 'default': |
61 if branch.startswith('../'): | 61 if branch.startswith('../'): |
62 branchpath = branch[3:] | 62 branchpath = branch[3:] |
63 else: | 63 else: |
64 branchpath = ''.join((self.meta.branchdir, branch, self._infix)) | 64 branchpath = ''.join((self.meta.branchdir, branch, |
65 self.meta.infix)) | |
65 | 66 |
66 return '%s/%s' % (subdir or '', branchpath) | 67 return '%s/%s' % (subdir or '', branchpath) |
67 | 68 |
68 def taglocations(self, metapath): | 69 def taglocations(self, metapath): |
69 # import late to avoid trouble when running the test suite | 70 # import late to avoid trouble when running the test suite |
130 local_path = '' | 131 local_path = '' |
131 else: | 132 else: |
132 local_path = components[1] | 133 local_path = components[1] |
133 | 134 |
134 if local_path == '': | 135 if local_path == '': |
135 branch_path += self._infix | 136 branch_path += self.meta.infix |
136 elif local_path.startswith(self._infix[1:] + '/'): | 137 elif local_path.startswith(self.meta.infix[1:] + '/'): |
137 branch_path += self._infix | 138 branch_path += self.meta.infix |
138 local_path = local_path[len(self._infix):] | 139 local_path = local_path[len(self.meta.infix):] |
139 return branch_path, local_path | 140 return branch_path, local_path |
140 | 141 |
141 components = path.split('/') | 142 components = path.split('/') |
142 return '/'.join(components[:-1]), components[-1] | 143 return '/'.join(components[:-1]), components[-1] |