diff hgsubversion/svnmeta.py @ 1160:f06bb42bd2b2

svnmeta: turn tags into lazy property This has no effect currently but will be used in a future patch to make it possible to create a SVNMeta object without having to load the tags file (for use in rebuilding metadata). Tests have been updated.
author Sean Farley <sean.michael.farley@gmail.com>
date Sat, 22 Feb 2014 18:26:48 -0600
parents 770ac6de58c5
children 8693c9558f1a
line wrap: on
line diff
--- a/hgsubversion/svnmeta.py
+++ b/hgsubversion/svnmeta.py
@@ -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._tags = None
         self._layout = layouts.detect.layout_from_file(self.metapath,
                                                        ui=self.repo.ui)
         self._layoutobj = None
@@ -167,6 +167,12 @@ class SVNMeta(object):
         # called tagmap for backwards compatibility
         return os.path.join(self.metapath, 'tagmap')
 
+    @property
+    def tags(self):
+        if self._tags is None:
+            self._tags = maps.Tags(self.repo)
+        return self._tags
+
     @property
     def tagmapfile(self):
         # called tag-renames for backwards compatibility