# HG changeset patch # User Martin Geisler # Date 1304944849 -7200 # Node ID b039b667515d472a7ce456ab78a47069b0306a1b # Parent 59c820a6ca79112bb025928bf42336b11206eb02 debugbuilddag: output progress information diff -r 59c820a6ca79 -r b039b667515d mercurial/commands.py --- a/mercurial/commands.py Mon May 09 14:33:08 2011 +0200 +++ b/mercurial/commands.py Mon May 09 14:40:49 2011 +0200 @@ -1005,15 +1005,16 @@ if len(cl) > 0: raise util.Abort(_('repository is not empty')) + # determine number of revs in DAG + total = 0 + for type, data in dagparser.parsedag(text): + if type == 'n': + total += 1 + if mergeable_file: linesperrev = 2 - # determine number of revs in DAG - n = 0 - for type, data in dagparser.parsedag(text): - if type == 'n': - n += 1 # make a file with k lines per rev - initialmergedlines = [str(i) for i in xrange(0, n * linesperrev)] + initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)] initialmergedlines.append("") tags = [] @@ -1024,6 +1025,7 @@ at = -1 atbranch = 'default' nodeids = [] + ui.progress(_('building'), 0, unit=_('revisions'), total=total) for type, data in dagparser.parsedag(text): if type == 'n': ui.note('node %s\n' % str(data)) @@ -1092,8 +1094,10 @@ elif type == 'a': ui.note('branch %s\n' % data) atbranch = data + ui.progress(_('building'), id, unit=_('revisions'), total=total) tr.close() finally: + ui.progress(_('building'), None) tr.release() if tags: diff -r 59c820a6ca79 -r b039b667515d tests/test-debugbuilddag.t --- a/tests/test-debugbuilddag.t Mon May 09 14:33:08 2011 +0200 +++ b/tests/test-debugbuilddag.t Mon May 09 14:40:49 2011 +0200 @@ -4,7 +4,48 @@ plain $ hg init - $ hg debugbuilddag '+2:f +3:p2 @temp --config extensions.progress= --config progress.assume-tty=1 \ + > --config progress.delay=0 --config progress.refresh=0 \ + > --config progress.width=60 2>&1 | \ + > python $TESTDIR/filtercr.py + + building [ ] 0/12 + building [ ] 0/12 + building [ ] 0/12 + building [ ] 0/12 + building [==> ] 1/12 + building [==> ] 1/12 + building [==> ] 1/12 + building [==> ] 1/12 + building [======> ] 2/12 + building [======> ] 2/12 + building [=========> ] 3/12 + building [=========> ] 3/12 + building [=============> ] 4/12 + building [=============> ] 4/12 + building [=============> ] 4/12 + building [=============> ] 4/12 + building [=============> ] 4/12 + building [=============> ] 4/12 + building [================> ] 5/12 + building [================> ] 5/12 + building [====================> ] 6/12 + building [====================> ] 6/12 + building [=======================> ] 7/12 + building [=======================> ] 7/12 + building [===========================> ] 8/12 + building [===========================> ] 8/12 + building [===========================> ] 8/12 + building [===========================> ] 8/12 + building [==============================> ] 9/12 + building [==============================> ] 9/12 + building [==================================> ] 10/12 + building [==================================> ] 10/12 + building [=====================================> ] 11/12 + building [=====================================> ] 11/12 + \r (esc) + tags $ cat .hg/localtags 66f7d451a68b85ed82ff5fcc254daf50c74144bd f