changeset 135:421c992c058b

import_git_objects: add progress indicator
author Sverre Rabbelier <sverre@rabbelier.nl>
date Fri, 15 May 2009 00:27:38 +0200
parents 324a1ad9212a
children 74385b613bb7
files git_handler.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/git_handler.py	Thu May 14 23:55:13 2009 +0200
+++ b/git_handler.py	Fri May 15 00:27:38 2009 +0200
@@ -465,7 +465,11 @@
         commits = toposort.TopoSort(convert_list).items()
         
         # import each of the commits, oldest first
-        for csha in commits:
+        total = len(commits)
+        magnitude = int(math.log(total, 10)) + 1 if total else 1
+        for i, csha in enumerate(commits):
+            if i%100 == 0:
+                self.ui.status(_("at: %*d/%d\n") % (magnitude, i, total))
             commit = convert_list[csha]
             if not self.map_hg_get(csha): # it's already here
                 self.import_git_commit(commit)