changeset 1216:572417ad0313

svnmeta: turn filemap into a lazy property
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 24 Mar 2014 11:20:48 -0500
parents 77bd24841a5f
children a10a4fc69364
files hgsubversion/maps.py hgsubversion/svnmeta.py
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -393,7 +393,7 @@ class BranchMap(dict):
         if path != self.meta.branchmap_file:
             writing = open(self.meta.branchmap_file, 'a')
 
-        self.ui.debug('reading branchmap from %s\n' % path)
+        self.meta.ui.debug('reading branchmap from %s\n' % path)
         f = open(path, 'r')
         for number, line in enumerate(f):
 
--- a/hgsubversion/svnmeta.py
+++ b/hgsubversion/svnmeta.py
@@ -53,7 +53,7 @@ class SVNMeta(object):
 
         self._tagmap = None
 
-        self.filemap = maps.FileMap(self.ui, self.filemap_file)
+        self._filemap = None
 
         self.lastdate = '1970-01-01 00:00:00 -0000'
         self.addedtags = {}
@@ -231,6 +231,12 @@ class SVNMeta(object):
     def filemap_file(self):
         return os.path.join(self.metapath, 'filemap')
 
+    @property
+    def filemap(self):
+        if self._filemap is None:
+            self._filemap = maps.FileMap(self.ui, self.filemap_file)
+        return self._filemap
+
     @property
     def branchmap_file(self):
         return os.path.join(self.metapath, 'branchmap')