changeset 5203:653790c2fa52

convert: wrap cached commits author remapping
author Patrick Mezard <pmezard@gmail.com>
date Sun, 19 Aug 2007 17:38:07 +0200
parents c7e8fe11f34a
children 6f636d13f6b8
files hgext/convert/__init__.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/__init__.py	Sat Aug 18 21:36:10 2007 -0300
+++ b/hgext/convert/__init__.py	Sun Aug 19 17:38:07 2007 +0200
@@ -81,10 +81,9 @@
             n = visit.pop(0)
             if n in known or n in self.map: continue
             known[n] = 1
-            self.commitcache[n] = self.source.getcommit(n)
-            cp = self.commitcache[n].parents
+            commit = self.cachecommit(n)
             parents[n] = []
-            for p in cp:
+            for p in commit.parents:
                 parents[n].append(p)
                 visit.append(p)
 
@@ -188,6 +187,12 @@
                     % (authorfile, line))
         afile.close()
 
+    def cachecommit(self, rev):
+        commit = self.source.getcommit(rev)
+        commit.author = self.authors.get(commit.author, commit.author)
+        self.commitcache[rev] = commit
+        return commit
+
     def copy(self, rev):
         commit = self.commitcache[rev]
         do_copies = hasattr(self.dest, 'copyfile')
@@ -243,9 +248,6 @@
                 desc = self.commitcache[c].desc
                 if "\n" in desc:
                     desc = desc.splitlines()[0]
-                author = self.commitcache[c].author
-                author = self.authors.get(author, author)
-                self.commitcache[c].author = author
                 self.ui.status("%d %s\n" % (num, desc))
                 self.copy(c)