changeset 831:4b5a18d2fa10

git_handler.export_git_objects: filter out octopus explosions earlier hg-git translates octopus merges into a series of merges, called an octopus explosion. The intermediate octopus explosion commits are not recorded in the mapfile -- only the final commit is. This means that they show up in the export list and have to then be detected and filtered out. Don't initialize the incremental exporter with octopus explosion commits. Previously, if there were octopus merges early in the history, we'd initialize the incremental exporter with the first one's parent, then calculate the diff of that against the first commit we actually cared about exporting. That's slow and wasteful. For a particular real-world repo with one octopus merge 1/3 of the way in history, this is a 10x improvement for 'hg gexport' with one commit to export -- 60 seconds to 6.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 30 Nov 2014 00:42:30 -0800
parents 5fa9649c4ef6
children 799c41a24e75
files hggit/git_handler.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py	Sun Nov 30 00:26:24 2014 -0800
+++ b/hggit/git_handler.py	Sun Nov 30 00:42:30 2014 -0800
@@ -380,6 +380,8 @@
         clnode = repo.changelog.node
         nodes = [clnode(n) for n in repo]
         export = [repo[node] for node in nodes if not hex(node) in self._map_hg]
+        export = [ctx for ctx in export
+                  if ctx.extra().get('hg-git', None) != 'octopus']
         total = len(export)
         if not total:
             return
@@ -410,10 +412,6 @@
         for i, ctx in enumerate(export):
             self.ui.progress('exporting', i, total=total)
             state = ctx.extra().get('hg-git', None)
-            if state == 'octopus':
-                self.ui.debug("revision %d is a part "
-                              "of octopus explosion\n" % ctx.rev())
-                continue
             self.export_hg_commit(ctx.node(), exporter)
         self.ui.progress('exporting', None, total=total)