changeset 102:302df8a2a8d0

major speedup in the already-converted case
author Sverre Rabbelier <sverre@rabbelier.nl>
date Sun, 10 May 2009 08:58:24 -0700
parents 7c57f15d397c
children b1f0ae5e0f3f
files git_handler.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/git_handler.py	Sun May 10 08:54:47 2009 -0700
+++ b/git_handler.py	Sun May 10 08:58:24 2009 -0700
@@ -164,8 +164,9 @@
         for i, rev in enumerate(self.repo.changelog):
             if i%100 == 0:
                 self.ui.status(_("at: %*d/%d\n") % (magnitude, i, total))
-            self.export_hg_commit(rev)
-            self.save_map()
+            pgit_sha, already_written = self.export_hg_commit(rev)
+            if not already_written:
+                self.save_map()
 
     # convert this commit into git objects
     # go through the manifest, convert all blobs/trees we don't have
@@ -176,7 +177,7 @@
         phgsha = hex(node)
         pgit_sha = self.map_git_get(phgsha)
         if pgit_sha:
-            return pgit_sha
+            return pgit_sha, True
 
         self.ui.status(_("converting revision %s\n") % str(rev))
 
@@ -233,7 +234,7 @@
 
         commit_sha = self.git.write_commit_hash(commit) # writing new blobs to git
         self.map_set(commit_sha, phgsha)
-        return commit_sha
+        return commit_sha, False
 
     def write_git_tree(self, ctx):
         trees = {}