diff options
author | Felipe Contreras <felipe.contreras@gmail.com> | 2013-05-24 21:29:33 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-28 07:59:30 -0700 |
commit | 63f54cf216944e8cadd7c762e624b0a7b1d0c3a2 (patch) | |
tree | 1a1e0d92cff2c062cd62c9f7f9ebe7015e13e868 | |
parent | remote-hg: trivial cleanups (diff) | |
download | tgif-63f54cf216944e8cadd7c762e624b0a7b1d0c3a2.tar.xz |
remote-hg: improve progress calculation
No need to manually keep track of the revision count.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | contrib/remote-helpers/git-remote-hg | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg index ee60dbf047..48edf3b562 100755 --- a/contrib/remote-helpers/git-remote-hg +++ b/contrib/remote-helpers/git-remote-hg @@ -415,7 +415,7 @@ def export_ref(repo, name, kind, head): tip = 0 revs = xrange(tip, head.rev() + 1) - count = 0 + total = len(revs) for rev in revs: @@ -423,7 +423,6 @@ def export_ref(repo, name, kind, head): node = c.node() if marks.is_marked(c.hex()): - count += 1 continue (manifest, user, (time, tz), files, desc, extra) = repo.changelog.read(node) @@ -495,9 +494,9 @@ def export_ref(repo, name, kind, head): print "D %s" % (fix_file_path(f)) print - count += 1 - if (count % 100 == 0): - print "progress revision %d '%s' (%d/%d)" % (rev, name, count, len(revs)) + progress = (rev - tip) + if (progress % 100 == 0): + print "progress revision %d '%s' (%d/%d)" % (rev, name, progress, total) # make sure the ref is updated print "reset %s/%s" % (prefix, ename) |