Sean Farley  committed f06bb42

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.

  • Participants
  • Parent commits d62c53c
  • Branches default

Comments (0)

Files changed (2)

File hgsubversion/

         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,
         self._layoutobj = None
         return os.path.join(self.metapath, 'tagmap')
+    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
         return os.path.join(self.metapath, 'tag-renames')

File tests/

         repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')
         tm = os.path.join(repo.path, 'svn', 'tagmap')
         open(tm, 'w').write('1\n')
+        # force tags to load since it is lazily loaded when needed
+        repo.svnmeta().tags
         commands.pull(repo.ui, repo)
         self.assertEqual(open(tm).read().splitlines()[0], '2')