<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lsprofcalltree.py</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -30,6 +30,7 @@ WEBSITE
 
 SPEED/EFFICIENCY
 ================
+* cache rename detection on push (seems to be very expensive)
 * switch object mapping to hg-&gt;git since the many to one is that direction
 * don't send blobs/trees already on server (thin pack)
 * packfile creation benchmarking (seems to take a while sometimes)</diff>
      <filename>TODO.txt</filename>
    </modified>
    <modified>
      <diff>@@ -49,14 +49,19 @@ def gclone(ui, git_url, hg_repo_path=None):
 def gpush(ui, repo, remote_name='origin', branch=None):
     git = GitHandler(repo, ui)
     import cProfile, pstats
+    import lsprofcalltree
     prof = cProfile.Profile()
     prof = prof.runctx(&quot;git.push(remote_name)&quot;, globals(), locals())
     stats = pstats.Stats(prof)
+    k = lsprofcalltree.KCacheGrind(prof)
+    data = open('/tmp/prof.kgrind', 'w+')
+    k.output(data)
+    data.close()
     stats.sort_stats(&quot;time&quot;)  # Or cumulative
     stats.print_stats(80)  # 80 = how many to print
     # The rest is optional.
-    # stats.print_callees()
-    # stats.print_callers()
+    #stats.print_callees()
+    #stats.print_callers()
 
 def gimport(ui, repo, remote_name=None):
     git = GitHandler(repo, ui)</diff>
      <filename>__init__.py</filename>
    </modified>
    <modified>
      <diff>@@ -187,6 +187,7 @@ class GitHandler(object):
         return dict(filter(is_local_head, refs.items()))
 
     def export_git_objects(self):
+        self.manifest_renames = {}
         self.ui.status(_(&quot;importing Hg objects into Git\n&quot;))
         total = len(self.repo.changelog)
         if total:
@@ -331,16 +332,24 @@ class GitHandler(object):
         trees = {}
         man = ctx.manifest()
         renames = []
-        for filenm in man.keys():
+        for filenm, nodesha in man.iteritems():
+            file_id = hex(nodesha)
             # write blob if not in our git database
-            fctx = ctx.filectx(filenm)
-            rename = fctx.renamed()
-            if rename:
-                filerename, sha = rename
+            fctx = ctx.filectx(filenm) 
+            filerename = None
+            if file_id in self.manifest_renames:
+                filerename = self.manifest_renames[file_id]
+            else:
+                rename = fctx.renamed()
+                if rename:
+                    filerename, sha = rename
+                    self.manifest_renames[file_id] = filerename
+                else:
+                    self.manifest_renames[file_id] = None                    
+            if filerename:
                 renames.append((filerename, filenm))
             is_exec = 'x' in fctx.flags()
             is_link = 'l' in fctx.flags()
-            file_id = hex(fctx.filenode())
             blob_sha = self.map_git_get(file_id)
             if not blob_sha:
                 blob_sha = self.git.write_blob(fctx.data()) # writing new blobs to git</diff>
      <filename>git_handler.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>38d071d67c0d2e9a575b50cafe8b23a406a5ca23</id>
    </parent>
  </parents>
  <author>
    <name>Scott Chacon</name>
    <email>schacon@gmail.com</email>
  </author>
  <url>http://github.com/schacon/hg-git/commit/18e6d096c5a0711eba644153e631700c6bfcfb5d</url>
  <id>18e6d096c5a0711eba644153e631700c6bfcfb5d</id>
  <committed-date>2009-06-03T09:22:27-07:00</committed-date>
  <authored-date>2009-06-03T09:22:17-07:00</authored-date>
  <message>fixed serious speed issue with rename detection</message>
  <tree>d5a6fca748da64cb1e7c1f0aa7eca0f3ebcc324f</tree>
  <committer>
    <name>Scott Chacon</name>
    <email>schacon@gmail.com</email>
  </committer>
</commit>
