changeset 589:f360e1629f5d

pull: try and produce a better progress bar for certain cases This uses the first converted revision as an offset, and then uses (r.revnum - offset) as the current item index and (HEAD - offset) as the total so that we always show a "real" progress number for the case where we're cloning only part of the svn repository.
author Augie Fackler <durin42@gmail.com>
date Fri, 19 Mar 2010 21:24:03 -0500
parents 2723152c8111
children 5e9ab25e0112
files hgsubversion/wrappers.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -256,7 +256,7 @@ def pull(repo, source, heads=[], force=F
                            'remains unimplemented.')
 
     oldrevisions = len(meta.revmap)
-    cnt = 0
+    progoffset = 0
     if stopat_rev:
         total = stopat_rev - start
     else:
@@ -283,9 +283,10 @@ def pull(repo, source, heads=[], force=F
                             msg = [s.strip() for s in msg.splitlines() if s][0]
                         w = hgutil.termwidth()
                         bits = (r.revnum, r.author, msg)
-                        cnt += 1
+                        if not progoffset:
+                            progoffset = r.revnum
                         ui.status(('[r%d] %s: %s\n' % bits)[:w])
-                        util.progress(ui, 'pull', cnt, total=total)
+                        util.progress(ui, 'pull', (r.revnum-progoffset), total=(total-progoffset))
 
                         meta.save_tbdelta(tbdelta)
                         close = pullfuns[have_replay](ui, meta, svn, r, tbdelta)
@@ -313,7 +314,7 @@ def pull(repo, source, heads=[], force=F
         except KeyboardInterrupt:
             pass
     finally:
-        util.progress(ui, 'pull', None, total=total)
+        util.progress(ui, 'pull', None, total=(total-progoffset))
         util.swap_out_encoding(old_encoding)
 
     revisions = len(meta.revmap) - oldrevisions