changeset 602:7c44bc259505

wrappers.pull: fix calculation of progress totals. The previous calculation was wrong and could lead to negative totals; it substracted a revision number from totals, from which the start revision has already been subtracted.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 31 Mar 2010 14:04:31 +0200
parents 0fe490ce2fbb
children 24c73f35f3cf
files hgsubversion/wrappers.py
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -245,7 +245,6 @@ def pull(repo, source, heads=[], force=F
                            'remains unimplemented.')
 
     oldrevisions = len(meta.revmap)
-    progoffset = 0
     if stopat_rev:
         total = stopat_rev - start
     else:
@@ -272,10 +271,8 @@ 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)
-                        if not progoffset:
-                            progoffset = r.revnum
                         ui.status(('[r%d] %s: %s\n' % bits)[:w])
-                        util.progress(ui, 'pull', (r.revnum-progoffset), total=(total-progoffset))
+                        util.progress(ui, 'pull', r.revnum - start, total=total)
 
                         meta.save_tbdelta(tbdelta)
                         close = pullfuns[have_replay](ui, meta, svn, r, tbdelta)
@@ -303,7 +300,7 @@ def pull(repo, source, heads=[], force=F
         except KeyboardInterrupt:
             pass
     finally:
-        util.progress(ui, 'pull', None, total=(total-progoffset))
+        util.progress(ui, 'pull', None, total=total)
         util.swap_out_encoding(old_encoding)
 
     revisions = len(meta.revmap) - oldrevisions