# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1270037071 -7200
# Node ID 7c44bc259505214b734a5131b545cd0dc46067f3
# Parent  0fe490ce2fbb82bbda0ff0f3603a087e8d8d0a5e
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.

diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py
--- 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