Skip to content

Commit

Permalink
remote-bzr: improve progress reporting
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed May 1, 2013
1 parent 248663c commit a397699
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions contrib/remote-helpers/git-remote-bzr
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,16 @@ def export_branch(repo, name):

branch.lock_read()
revs = branch.iter_merge_sorted_revisions(None, tip, 'exclude', 'forward')
count = 0
tip_revno = branch.revision_id_to_revno(tip)
last_revno, _ = branch.last_revision_info()
total = last_revno - tip_revno

revs = [revid for revid, _, _, _ in revs if not marks.is_marked(revid)]
revs = [revid, seq for revid, _, seq, _ in revs if not marks.is_marked(revid)]

for revid in revs:
for revid, seq in revs:

rev = repo.get_revision(revid)
revno = seq[0]

parents = rev.parent_ids
time = rev.timestamp
Expand Down Expand Up @@ -343,10 +346,13 @@ def export_branch(repo, name):
print "M %s :%u %s" % f
print

count += 1
if (count % 100 == 0):
print "progress revision %s '%s' (%d/%d)" % (revid, name, count, len(revs))
print "#############################################################"
if len(seq) > 1:
# let's skip branch revisions from the progress report
continue

progress = (revno - tip_revno)
if (progress % 100 == 0):
print "progress revision %d '%s' (%d/%d)" % (revno, name, progress, total)

branch.unlock()

Expand Down

0 comments on commit a397699

Please sign in to comment.