Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 38381:fce1c17493db
debugbuilddag: use progress helper
Differential Revision: https://phab.mercurial-scm.org/D3776
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 17 Jun 2018 21:44:57 -0700 |
parents | d4fae9a0ab1f |
children | 0d7ec620faef |
comparison
equal
deleted
inserted
replaced
38380:800f5a2c869e | 38381:fce1c17493db |
---|---|
181 initialmergedlines.append("") | 181 initialmergedlines.append("") |
182 | 182 |
183 tags = [] | 183 tags = [] |
184 | 184 |
185 wlock = lock = tr = None | 185 wlock = lock = tr = None |
186 progress = ui.makeprogress(_('building'), unit=_('revisions'), | |
187 total=total) | |
186 try: | 188 try: |
187 wlock = repo.wlock() | 189 wlock = repo.wlock() |
188 lock = repo.lock() | 190 lock = repo.lock() |
189 tr = repo.transaction("builddag") | 191 tr = repo.transaction("builddag") |
190 | 192 |
191 at = -1 | 193 at = -1 |
192 atbranch = 'default' | 194 atbranch = 'default' |
193 nodeids = [] | 195 nodeids = [] |
194 id = 0 | 196 id = 0 |
195 ui.progress(_('building'), id, unit=_('revisions'), total=total) | 197 progress.update(id) |
196 for type, data in dagparser.parsedag(text): | 198 for type, data in dagparser.parsedag(text): |
197 if type == 'n': | 199 if type == 'n': |
198 ui.note(('node %s\n' % pycompat.bytestr(data))) | 200 ui.note(('node %s\n' % pycompat.bytestr(data))) |
199 id, ps = data | 201 id, ps = data |
200 | 202 |
263 ui.note(('tag %s\n' % name)) | 265 ui.note(('tag %s\n' % name)) |
264 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) | 266 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) |
265 elif type == 'a': | 267 elif type == 'a': |
266 ui.note(('branch %s\n' % data)) | 268 ui.note(('branch %s\n' % data)) |
267 atbranch = data | 269 atbranch = data |
268 ui.progress(_('building'), id, unit=_('revisions'), total=total) | 270 progress.update(id) |
269 tr.close() | 271 tr.close() |
270 | 272 |
271 if tags: | 273 if tags: |
272 repo.vfs.write("localtags", "".join(tags)) | 274 repo.vfs.write("localtags", "".join(tags)) |
273 finally: | 275 finally: |
274 ui.progress(_('building'), None) | 276 progress.complete() |
275 release(tr, lock, wlock) | 277 release(tr, lock, wlock) |
276 | 278 |
277 def _debugchangegroup(ui, gen, all=None, indent=0, **opts): | 279 def _debugchangegroup(ui, gen, all=None, indent=0, **opts): |
278 indent_string = ' ' * indent | 280 indent_string = ' ' * indent |
279 if all: | 281 if all: |