convert: enable deterministic conversion progress bar for svn
authorAugie Fackler <raf@durin42.com>
Wed, 10 Sep 2014 10:52:00 -0400
changeset 22414 299eaa09b41b
parent 22413 3cb0318bb2dd
child 22415 65ec6c5c0fb3
convert: enable deterministic conversion progress bar for svn This produces slightly bad results when branches are in play, but overall I think it's probably worthwhile. We might be able to do better with branches somehow, but I haven't given it any thought.
hgext/convert/subversion.py
tests/test-convert-svn-encoding.t
tests/test-convert-svn-move.t
--- a/hgext/convert/subversion.py	Wed Sep 10 10:51:46 2014 -0400
+++ b/hgext/convert/subversion.py	Wed Sep 10 10:52:00 2014 -0400
@@ -508,6 +508,9 @@
             raise util.Abort(_('%s entry %s is not a valid revision'
                                ' identifier') % (mapname, revstr))
 
+    def numcommits(self):
+        return int(self.head.rsplit('@', 1)[1]) - self.startrev
+
     def gettags(self):
         tags = {}
         if self.tags is None:
--- a/tests/test-convert-svn-encoding.t	Wed Sep 10 10:51:46 2014 -0400
+++ b/tests/test-convert-svn-encoding.t	Wed Sep 10 10:52:00 2014 -0400
@@ -20,7 +20,7 @@
   found branches at 'branches'
   found branch branch\xc3\xa9 at 5 (esc)
   found branch branch\xc3\xa9e at 6 (esc)
-  scanning: 1 revisions
+  scanning: 1/4 revisions (25.00%)
   reparent to file://*/svn-repo/trunk (glob)
   fetching revision log for "/trunk" from 4 to 0
   parsing revision 4 (2 changes)
@@ -30,23 +30,23 @@
   no copyfrom path, don't know what to do.
   '/branches' is not under '/trunk', ignoring
   '/tags' is not under '/trunk', ignoring
-  scanning: 2 revisions
+  scanning: 2/4 revisions (50.00%)
   reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
   fetching revision log for "/branches/branch\xc3\xa9" from 5 to 0 (esc)
   parsing revision 5 (1 changes)
   reparent to file://*/svn-repo (glob)
   reparent to file://*/svn-repo/branches/branch%C3%A9 (glob)
   found parent of branch /branches/branch\xc3\xa9 at 4: /trunk (esc)
-  scanning: 3 revisions
+  scanning: 3/4 revisions (75.00%)
   reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
   fetching revision log for "/branches/branch\xc3\xa9e" from 6 to 0 (esc)
   parsing revision 6 (1 changes)
   reparent to file://*/svn-repo (glob)
   reparent to file://*/svn-repo/branches/branch%C3%A9e (glob)
   found parent of branch /branches/branch\xc3\xa9e at 5: /branches/branch\xc3\xa9 (esc)
-  scanning: 4 revisions
-  scanning: 5 revisions
-  scanning: 6 revisions
+  scanning: 4/4 revisions (100.00%)
+  scanning: 5/4 revisions (125.00%)
+  scanning: 6/4 revisions (150.00%)
   sorting...
   converting...
   5 init projA
--- a/tests/test-convert-svn-move.t	Wed Sep 10 10:51:46 2014 -0400
+++ b/tests/test-convert-svn-move.t	Wed Sep 10 10:52:00 2014 -0400
@@ -165,13 +165,13 @@
 
   $ hg convert svn-repo hg-progress
   \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 [       <=>                                    ] 7\r (no-eol) (esc)
+  scanning [=====>                                      ] 1/7\r (no-eol) (esc)
+  scanning [===========>                                ] 2/7\r (no-eol) (esc)
+  scanning [=================>                          ] 3/7\r (no-eol) (esc)
+  scanning [========================>                   ] 4/7\r (no-eol) (esc)
+  scanning [==============================>             ] 5/7\r (no-eol) (esc)
+  scanning [====================================>       ] 6/7\r (no-eol) (esc)
+  scanning [===========================================>] 7/7\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
   \r (no-eol) (esc)
   converting [                                          ] 0/7\r (no-eol) (esc)