Mercurial > hgsubversion
changeset 1291:13f8e9cc90c6
layouts: generate cached taglocations property
Now that we have the machinery, we use the generator to define this
property. As a bonus, we no longer have to import util which saves from having
to import hgext_util.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Mon, 24 Mar 2014 11:20:53 -0500 |
parents | 3549a84bdebe |
children | 7bbe120be193 |
files | hgsubversion/layouts/standard.py |
diffstat | 1 files changed, 5 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/layouts/standard.py +++ b/hgsubversion/layouts/standard.py @@ -25,6 +25,10 @@ class StandardLayout(base.BaseLayout): return x meta._gen_cachedconfig('infix', '', pre=_infix_transform) + # the lambda is to ensure nested paths are handled properly + meta._gen_cachedconfig('taglocations', ['tags'], 'tag_locations', + 'tagpaths', lambda x: list(reversed(sorted(x)))) + @property def trunk(self): return 'trunk' + self.meta.infix @@ -63,30 +67,7 @@ class StandardLayout(base.BaseLayout): return '%s/%s' % (subdir or '', branchpath) def taglocations(self, metapath): - # import late to avoid trouble when running the test suite - try: - # newer versions of mercurial >= 2.8 will import this because the - # hgext_ logic is already being done in core - from hgsubversion import util - except ImportError: - from hgext_hgsubversion import util - - if self._tag_locations is None: - - tag_locations_file = os.path.join(metapath, 'tag_locations') - self._tag_locations = util.load(tag_locations_file) - - if not self._tag_locations: - self._tag_locations = self.meta.ui.configlist('hgsubversion', - 'tagpaths', - ['tags']) - util.dump(self._tag_locations, tag_locations_file) - - # ensure nested paths are handled properly - self._tag_locations.sort() - self._tag_locations.reverse() - - return self._tag_locations + return self.meta.taglocations def get_path_tag(self, path, taglocations): for tagspath in taglocations: