# HG changeset patch # User Augie Fackler # Date 1269051843 18000 # Node ID f360e1629f5dcac439858892f84d196f1f7005ba # Parent 2723152c8111c029ce68b1b6e2e15bdc1c3257ad 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. diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- 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