# HG changeset patch # User Sean Farley # Date 1392589920 21600 # Node ID c3c4518e00aa3171f73f4c5d5ab5141283e3f0a7 # Parent aa98fdccaa0e1ed0c13284862a92cc09eb056647 svnmeta: rename meta_data_dir to metapath This is part of a cleanup throughout hgsubversion to unify the codebase with similar variable names and style. diff --git a/hgsubversion/layouts/base.py b/hgsubversion/layouts/base.py --- a/hgsubversion/layouts/base.py +++ b/hgsubversion/layouts/base.py @@ -48,7 +48,7 @@ class BaseLayout(object): """ self.__unimplemented('remotepath') - def taglocations(self, meta_data_dir): + def taglocations(self, metapath): """Return a list of locations within svn to search for tags Should be returned in reverse-sorted order. diff --git a/hgsubversion/layouts/custom.py b/hgsubversion/layouts/custom.py --- a/hgsubversion/layouts/custom.py +++ b/hgsubversion/layouts/custom.py @@ -64,7 +64,7 @@ class CustomLayout(base.BaseLayout): subdir += '/' return subdir + self.remotename(branch) - def taglocations(self, meta_data_dir): + def taglocations(self, metapath): return [] def get_path_tag(self, path, taglocations): diff --git a/hgsubversion/layouts/detect.py b/hgsubversion/layouts/detect.py --- a/hgsubversion/layouts/detect.py +++ b/hgsubversion/layouts/detect.py @@ -58,7 +58,7 @@ def layout_from_config(ui, allow_auto=Fa raise hgutil.Abort("unknown layout '%s'" % layout) return layout -def layout_from_file(meta_data_dir, ui=None): +def layout_from_file(metapath, ui=None): """ Load the layout in use from the metadata file. If you pass the ui arg, we will also write the layout to the @@ -67,7 +67,7 @@ def layout_from_file(meta_data_dir, ui=N """ layout = None - layoutfile = os.path.join(meta_data_dir, 'layout') + layoutfile = os.path.join(metapath, 'layout') if os.path.exists(layoutfile): f = open(layoutfile) layout = f.read().strip() diff --git a/hgsubversion/layouts/persist.py b/hgsubversion/layouts/persist.py --- a/hgsubversion/layouts/persist.py +++ b/hgsubversion/layouts/persist.py @@ -7,10 +7,10 @@ to do it. import os.path -def layout_to_file(meta_data_dir, layout): - """Save the given layout to a file under the given meta_data_dir""" +def layout_to_file(metapath, layout): + """Save the given layout to a file under the given metapath""" - layoutfile = os.path.join(meta_data_dir, 'layout') + layoutfile = os.path.join(metapath, 'layout') f = open(layoutfile, 'w') f.write(layout) f.close() diff --git a/hgsubversion/layouts/single.py b/hgsubversion/layouts/single.py --- a/hgsubversion/layouts/single.py +++ b/hgsubversion/layouts/single.py @@ -14,7 +14,7 @@ class SingleLayout(base.BaseLayout): def remotepath(self, branch, subdir='/'): return subdir or '/' - def taglocations(self, meta_data_dir): + def taglocations(self, metapath): return [] def get_path_tag(self, path, taglocations): diff --git a/hgsubversion/layouts/standard.py b/hgsubversion/layouts/standard.py --- a/hgsubversion/layouts/standard.py +++ b/hgsubversion/layouts/standard.py @@ -54,7 +54,7 @@ class StandardLayout(base.BaseLayout): return '%s/%s' % (subdir or '', branchpath) - def taglocations(self, meta_data_dir): + 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 @@ -65,7 +65,7 @@ class StandardLayout(base.BaseLayout): if self._tag_locations is None: - tag_locations_file = os.path.join(meta_data_dir, 'tag_locations') + tag_locations_file = os.path.join(metapath, 'tag_locations') self._tag_locations = util.load(tag_locations_file) if not self._tag_locations: diff --git a/hgsubversion/svnmeta.py b/hgsubversion/svnmeta.py --- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -25,8 +25,8 @@ class SVNMeta(object): self.repo = repo self.path = os.path.normpath(repo.join('..')) - if not os.path.isdir(self.meta_data_dir): - os.makedirs(self.meta_data_dir) + if not os.path.isdir(self.metapath): + os.makedirs(self.metapath) self.uuid = uuid self.subdir = subdir self.revmap = maps.RevMap(repo) @@ -42,7 +42,7 @@ class SVNMeta(object): self.branches = util.load(self.branch_info_file) or {} self.prevbranches = dict(self.branches) self.tags = maps.Tags(repo) - self._layout = layouts.detect.layout_from_file(self.meta_data_dir, + self._layout = layouts.detect.layout_from_file(self.metapath, ui=self.repo.ui) self._layoutobj = None @@ -73,7 +73,7 @@ class SVNMeta(object): # gets called if not self._layout or self._layout == 'auto': self._layout = layouts.detect.layout_from_config(self.repo.ui) - layouts.persist.layout_to_file(self.meta_data_dir, self._layout) + layouts.persist.layout_to_file(self.metapath, self._layout) return self._layout @property @@ -95,7 +95,7 @@ class SVNMeta(object): if subdir: subdir = '/'.join(p for p in subdir.split('/') if p) - subdirfile = os.path.join(self.meta_data_dir, 'subdir') + subdirfile = os.path.join(self.metapath, 'subdir') if os.path.isfile(subdirfile): stored_subdir = util.load(subdirfile) @@ -122,7 +122,7 @@ class SVNMeta(object): return self.__uuid def _set_uuid(self, uuid): - uuidfile = os.path.join(self.meta_data_dir, 'uuid') + uuidfile = os.path.join(self.metapath, 'uuid') if os.path.isfile(uuidfile): stored_uuid = util.load(uuidfile) assert stored_uuid @@ -140,29 +140,29 @@ class SVNMeta(object): 'Error-checked UUID of source Subversion repository.') @property - def meta_data_dir(self): + def metapath(self): return os.path.join(self.path, '.hg', 'svn') @property def branch_info_file(self): - return os.path.join(self.meta_data_dir, 'branch_info') + return os.path.join(self.metapath, 'branch_info') @property def authors_file(self): - return os.path.join(self.meta_data_dir, 'authors') + return os.path.join(self.metapath, 'authors') @property def filemap_file(self): - return os.path.join(self.meta_data_dir, 'filemap') + return os.path.join(self.metapath, 'filemap') @property def branchmapfile(self): - return os.path.join(self.meta_data_dir, 'branchmap') + return os.path.join(self.metapath, 'branchmap') @property def tagmapfile(self): # called tag-renames for backwards compatibility - return os.path.join(self.meta_data_dir, 'tag-renames') + return os.path.join(self.metapath, 'tag-renames') def fixdate(self, date): if date is not None: @@ -237,7 +237,7 @@ class SVNMeta(object): @property def taglocations(self): - return self.layoutobj.taglocations(self.meta_data_dir) + return self.layoutobj.taglocations(self.metapath) def get_path_tag(self, path): """If path could represent the path to a tag, returns the