remote-bzr: improve progress reporting
No need to manually count the revisions, and also, this would help to iterate more properly. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Apr 30, 2013 at 20:10 UTC
a39769995050f5fe1d4907514caf9eb32ef6185a
1 file changed
+13
-7
contrib/remote-helpers/git-remote-bzr
+13
-7
@@ -282,13 +282,16 @@ def export_branch(repo, name):
282
283
branch.lock_read()
284
revs = branch.iter_merge_sorted_revisions(None, tip, 'exclude', 'forward')
285
- count = 0
285
+ tip_revno = branch.revision_id_to_revno(tip)
286
+ last_revno, _ = branch.last_revision_info()
287
+ total = last_revno - tip_revno
288
287
- revs = [revid for revid, _, _, _ in revs if not marks.is_marked(revid)]
289
+ revs = [revid, seq for revid, _, seq, _ in revs if not marks.is_marked(revid)]
290
289
- for revid in revs:
291
+ for revid, seq in revs:
292
293
rev = repo.get_revision(revid)
294
+ revno = seq[0]
295
296
parents = rev.parent_ids
297
time = rev.timestamp
@@ -343,10 +346,13 @@ def export_branch(repo, name):
346
print "M %s :%u %s" % f
347
print
348
346
- count += 1
347
- if (count % 100 == 0):
348
- print "progress revision %s '%s' (%d/%d)" % (revid, name, count, len(revs))
349
- print "#############################################################"
349
+ if len(seq) > 1:
350
+ # let's skip branch revisions from the progress report
351
+ continue
352
+
353
+ progress = (revno - tip_revno)
354
+ if (progress % 100 == 0):
355
+ print "progress revision %d '%s' (%d/%d)" % (revno, name, progress, total)
356
357
branch.unlock()
358