changeset 4837:4cdbaa885d8a

convert: svn: some improvements in memory usage
author Brendan Cully <brendan@kublai.com>
date Thu, 05 Jul 2007 14:31:13 -0700
parents 744371157212
children 61343b40a141
files hgext/convert/subversion.py
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Thu Jul 05 12:45:41 2007 -0700
+++ b/hgext/convert/subversion.py	Thu Jul 05 14:31:13 2007 -0700
@@ -188,13 +188,18 @@
             entries = []
             rev = self.revid(revnum)
             parents = []
+
+            # branch log might return entries for a parent we already have
+            if rev in self.commits:
+                return
+
             try:
                 branch = self.module.split("/")[-1]
                 if branch == 'trunk':
                     branch = ''
             except IndexError:
                 branch = None
-                
+
             for path in sorted(orig_paths):
                 # self.ui.write("path %s\n" % path)
                 if path == self.module: # Follow branching back in history
@@ -487,6 +492,8 @@
         files = self.files[rev]
         cl = files
         cl.sort()
+        # caller caches the result, so free it here to release memory
+        del self.files[rev]
         return cl
 
     def getcommit(self, rev):
@@ -496,7 +503,10 @@
             self.reparent(module)
             stop = self.lastrevs.get(module, 0)
             self._fetch_revisions(from_revnum=revnum, to_revnum=stop)
-        return self.commits[rev]
+        commit = self.commits[rev]
+        # caller caches the result, so free it here to release memory
+        del self.commits[rev]
+        return commit
 
     def gettags(self):
         tags = {}