changeset 996:c4a2ef796c19

add progress to commit discovery phase In large repositories, the commit discovery phase can take minutes. Let's give the user feedback on how long it will take.
author Ryan McElroy <rmcelroy@fb.com>
date Mon, 05 Sep 2016 03:03:24 -0700
parents 9c15c89088fd
children eb01d99111b6
files hggit/git_handler.py
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -411,13 +411,27 @@
     # CHANGESET CONVERSION METHODS
 
     def export_git_objects(self):
+        self.ui.note(_("finding hg commits to export\n"))
         repo = self.repo
         clnode = repo.changelog.node
+
         nodes = (clnode(n) for n in repo)
-        export = (repo[node] for node in nodes if not hex(node) in
+        to_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']
+
+        todo_total = len(repo) - len(self._map_hg)
+        topic = 'find commits to export'
+        pos = 0
+        unit = 'commits'
+
+        export = []
+        for ctx in to_export:
+            item = hex(ctx.node())
+            pos += 1
+            repo.ui.progress(topic, pos, item, unit, todo_total)
+            if ctx.extra().get('hg-git', None) != 'octopus':
+                export.append(ctx)
+
         total = len(export)
         if not total:
             return