comparison mercurial/commands.py @ 14279:b039b667515d

debugbuilddag: output progress information
author Martin Geisler <mg@aragost.com>
date Mon, 09 May 2011 14:40:49 +0200
parents 4030630fb59c
children 035489c9ea53
comparison
equal deleted inserted replaced
14278:59c820a6ca79 14279:b039b667515d
1003 1003
1004 cl = repo.changelog 1004 cl = repo.changelog
1005 if len(cl) > 0: 1005 if len(cl) > 0:
1006 raise util.Abort(_('repository is not empty')) 1006 raise util.Abort(_('repository is not empty'))
1007 1007
1008 # determine number of revs in DAG
1009 total = 0
1010 for type, data in dagparser.parsedag(text):
1011 if type == 'n':
1012 total += 1
1013
1008 if mergeable_file: 1014 if mergeable_file:
1009 linesperrev = 2 1015 linesperrev = 2
1010 # determine number of revs in DAG
1011 n = 0
1012 for type, data in dagparser.parsedag(text):
1013 if type == 'n':
1014 n += 1
1015 # make a file with k lines per rev 1016 # make a file with k lines per rev
1016 initialmergedlines = [str(i) for i in xrange(0, n * linesperrev)] 1017 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)]
1017 initialmergedlines.append("") 1018 initialmergedlines.append("")
1018 1019
1019 tags = [] 1020 tags = []
1020 1021
1021 tr = repo.transaction("builddag") 1022 tr = repo.transaction("builddag")
1022 try: 1023 try:
1023 1024
1024 at = -1 1025 at = -1
1025 atbranch = 'default' 1026 atbranch = 'default'
1026 nodeids = [] 1027 nodeids = []
1028 ui.progress(_('building'), 0, unit=_('revisions'), total=total)
1027 for type, data in dagparser.parsedag(text): 1029 for type, data in dagparser.parsedag(text):
1028 if type == 'n': 1030 if type == 'n':
1029 ui.note('node %s\n' % str(data)) 1031 ui.note('node %s\n' % str(data))
1030 id, ps = data 1032 id, ps = data
1031 1033
1090 ui.note('tag %s\n' % name) 1092 ui.note('tag %s\n' % name)
1091 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) 1093 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
1092 elif type == 'a': 1094 elif type == 'a':
1093 ui.note('branch %s\n' % data) 1095 ui.note('branch %s\n' % data)
1094 atbranch = data 1096 atbranch = data
1097 ui.progress(_('building'), id, unit=_('revisions'), total=total)
1095 tr.close() 1098 tr.close()
1096 finally: 1099 finally:
1100 ui.progress(_('building'), None)
1097 tr.release() 1101 tr.release()
1098 1102
1099 if tags: 1103 if tags:
1100 repo.opener.write("localtags", "".join(tags)) 1104 repo.opener.write("localtags", "".join(tags))
1101 1105