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>
Felipe Contreras committed
May 24, 2013 at 21:29 UTC
63f54cf216944e8cadd7c762e624b0a7b1d0c3a2
1 file changed
+4
-5
contrib/remote-helpers/git-remote-hg
+4
-5
@@ -415,7 +415,7 @@ def export_ref(repo, name, kind, head):
415
tip = 0
416
417
revs = xrange(tip, head.rev() + 1)
418
- count = 0
418
+ total = len(revs)
419
420
for rev in revs:
421
@@ -423,7 +423,6 @@ def export_ref(repo, name, kind, head):
423
node = c.node()
424
425
if marks.is_marked(c.hex()):
426
- count += 1
426
continue
427
428
(manifest, user, (time, tz), files, desc, extra) = repo.changelog.read(node)
@@ -495,9 +494,9 @@ def export_ref(repo, name, kind, head):
494
print "D %s" % (fix_file_path(f))
495
print
496
498
- count += 1
499
- if (count % 100 == 0):
500
- print "progress revision %d '%s' (%d/%d)" % (rev, name, count, len(revs))
497
+ progress = (rev - tip)
498
+ if (progress % 100 == 0):
499
+ print "progress revision %d '%s' (%d/%d)" % (rev, name, progress, total)
500
501
# make sure the ref is updated
502
print "reset %s/%s" % (prefix, ename)