Mercurial > hgsubversion
comparison hgsubversion/layouts/standard.py @ 1265:4744b7bfa476
layouts: change constructor to take a meta object
This change is another step forward to centralize subversion configuration
options and help refactor.
I couldn't find an easier way to split up this change since there are many
interdependent function calls. There is no functionality change in this patch,
only renaming ui -> meta.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Mon, 24 Mar 2014 11:20:49 -0500 |
parents | c3c4518e00aa |
children | fadacedaf391 |
comparison
equal
deleted
inserted
replaced
1264:eded1e736a7e | 1265:4744b7bfa476 |
---|---|
3 import base | 3 import base |
4 | 4 |
5 class StandardLayout(base.BaseLayout): | 5 class StandardLayout(base.BaseLayout): |
6 """The standard trunk, branches, tags layout""" | 6 """The standard trunk, branches, tags layout""" |
7 | 7 |
8 def __init__(self, ui): | 8 def __init__(self, meta): |
9 base.BaseLayout.__init__(self, ui) | 9 base.BaseLayout.__init__(self, meta) |
10 | 10 |
11 self._tag_locations = None | 11 self._tag_locations = None |
12 | 12 |
13 self._branch_dir = ui.config('hgsubversion', 'branchdir', 'branches') | 13 self._branch_dir = self.meta.ui.config('hgsubversion', 'branchdir', 'branches') |
14 if self._branch_dir[0] == '/': | 14 if self._branch_dir[0] == '/': |
15 self._branch_dir = self._branch_dir[1:] | 15 self._branch_dir = self._branch_dir[1:] |
16 if self._branch_dir[-1] != '/': | 16 if self._branch_dir[-1] != '/': |
17 self._branch_dir += '/' | 17 self._branch_dir += '/' |
18 | 18 |
19 self._infix = ui.config('hgsubversion', 'infix', '').strip('/') | 19 self._infix = self.meta.ui.config('hgsubversion', 'infix', '').strip('/') |
20 if self._infix: | 20 if self._infix: |
21 self._infix = '/' + self._infix | 21 self._infix = '/' + self._infix |
22 | 22 |
23 self._trunk = 'trunk%s' % self._infix | 23 self._trunk = 'trunk%s' % self._infix |
24 | 24 |
67 | 67 |
68 tag_locations_file = os.path.join(metapath, 'tag_locations') | 68 tag_locations_file = os.path.join(metapath, 'tag_locations') |
69 self._tag_locations = util.load(tag_locations_file) | 69 self._tag_locations = util.load(tag_locations_file) |
70 | 70 |
71 if not self._tag_locations: | 71 if not self._tag_locations: |
72 self._tag_locations = self.ui.configlist('hgsubversion', | 72 self._tag_locations = self.meta.ui.configlist('hgsubversion', |
73 'tagpaths', | 73 'tagpaths', |
74 ['tags']) | 74 ['tags']) |
75 util.dump(self._tag_locations, tag_locations_file) | 75 util.dump(self._tag_locations, tag_locations_file) |
76 | 76 |
77 # ensure nested paths are handled properly | 77 # ensure nested paths are handled properly |
78 self._tag_locations.sort() | 78 self._tag_locations.sort() |
79 self._tag_locations.reverse() | 79 self._tag_locations.reverse() |