[PATCH 4 of 5] convert: enable deterministic conversion progress bar for git

Augie Fackler raf at durin42.com
Wed Sep 10 10:21:00 CDT 2014


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1410360706 14400
#      Wed Sep 10 10:51:46 2014 -0400
# Node ID 8718ff8d8fb623abca877d662054bb027d0f3a53
# Parent  c37f42f7610de3ae06098ca65b3f2a0bd2fda818
convert: enable deterministic conversion progress bar for git

diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -263,6 +263,9 @@
                    rev=version)
         return c
 
+    def numcommits(self):
+        return len([None for _ in self.gitopen('git rev-list --all')])
+
     def gettags(self):
         tags = {}
         alltags = {}
@@ -342,4 +345,3 @@
     def checkrevformat(self, revstr, mapname='splicemap'):
         """ git revision string is a 40 byte hex """
         self.checkhexformat(revstr, mapname)
-
diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t
--- a/tests/test-convert-git.t
+++ b/tests/test-convert-git.t
@@ -56,12 +56,12 @@
   >   --config progress.refresh=0 --config progress.width=60 \
   > --datesort git-repo
   \r (no-eol) (esc)
-  scanning [ <=>                                          ] 1\r (no-eol) (esc)
-  scanning [  <=>                                         ] 2\r (no-eol) (esc)
-  scanning [   <=>                                        ] 3\r (no-eol) (esc)
-  scanning [    <=>                                       ] 4\r (no-eol) (esc)
-  scanning [     <=>                                      ] 5\r (no-eol) (esc)
-  scanning [      <=>                                     ] 6\r (no-eol) (esc)
+  scanning [======>                                     ] 1/6\r (no-eol) (esc)
+  scanning [=============>                              ] 2/6\r (no-eol) (esc)
+  scanning [=====================>                      ] 3/6\r (no-eol) (esc)
+  scanning [============================>               ] 4/6\r (no-eol) (esc)
+  scanning [===================================>        ] 5/6\r (no-eol) (esc)
+  scanning [===========================================>] 6/6\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
   converting [                                          ] 0/6\r (no-eol) (esc)


More information about the Mercurial-devel mailing list