Skip to content

Commit a397699

Browse files
felipecgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 248663c commit a397699

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

contrib/remote-helpers/git-remote-bzr

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,16 @@ def export_branch(repo, name):
282282

283283
branch.lock_read()
284284
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
286288

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)]
288290

289-
for revid in revs:
291+
for revid, seq in revs:
290292

291293
rev = repo.get_revision(revid)
294+
revno = seq[0]
292295

293296
parents = rev.parent_ids
294297
time = rev.timestamp
@@ -343,10 +346,13 @@ def export_branch(repo, name):
343346
print "M %s :%u %s" % f
344347
print
345348

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)
350356

351357
branch.unlock()
352358

0 commit comments

Comments
 (0)