comparison hgext/fastannotate/commands.py @ 40838:901f6ef670ca

debugbuildannotatecache: use progress helper Differential Revision: https://phab.mercurial-scm.org/D5373
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 04 Dec 2018 15:57:11 -0800
parents fa88170c10bb
children 566daffc607d
comparison
equal deleted inserted replaced
40837:64051af15596 40838:901f6ef670ca
259 if opts.get('REV'): 259 if opts.get('REV'):
260 raise error.Abort(_('--rev cannot be used for client')) 260 raise error.Abort(_('--rev cannot be used for client'))
261 repo.prefetchfastannotate(paths) 261 repo.prefetchfastannotate(paths)
262 else: 262 else:
263 # server, or full repo 263 # server, or full repo
264 progress = ui.makeprogress(_('building'), total=len(paths))
264 for i, path in enumerate(paths): 265 for i, path in enumerate(paths):
265 ui.progress(_('building'), i, total=len(paths)) 266 progress.update(i)
266 with facontext.annotatecontext(repo, path) as actx: 267 with facontext.annotatecontext(repo, path) as actx:
267 try: 268 try:
268 if actx.isuptodate(rev): 269 if actx.isuptodate(rev):
269 continue 270 continue
270 actx.annotate(rev, rev) 271 actx.annotate(rev, rev)
279 except Exception as ex: 280 except Exception as ex:
280 # possibly a bug, but should not stop us from building 281 # possibly a bug, but should not stop us from building
281 # cache for other files. 282 # cache for other files.
282 ui.warn(_('fastannotate: %s: failed to ' 283 ui.warn(_('fastannotate: %s: failed to '
283 'build cache: %r\n') % (path, ex)) 284 'build cache: %r\n') % (path, ex))
284 # clear the progress bar 285 progress.complete()
285 ui.write()