Mercurial > public > mercurial-scm > hg
diff hgext/progress.py @ 25482:95f490136e75
progress: stop double-wrapping of ui class
We were wrapping the ui class again and again (uisetup, reposetup,
subrepo setup, remote repo setup, etc). We now avoid that. This has
impact on tests that were double-printing data because of this.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sun, 07 Jun 2015 18:11:23 -0700 |
parents | 80c5b2666a96 |
children | 93b8b0049932 |
line wrap: on
line diff
--- a/hgext/progress.py Wed May 27 05:28:40 2015 -0700 +++ b/hgext/progress.py Sun Jun 07 18:11:23 2015 -0700 @@ -312,13 +312,15 @@ if ui.configbool('progress', 'disable'): return if shouldprint(ui) and not ui.debugflag and not ui.quiet: - ui.__class__ = progressui - # we instantiate one globally shared progress bar to avoid - # competing progress bars when multiple UI objects get created - if not progressui._progbar: - if _singleton is None: - _singleton = progbar(ui) - progressui._progbar = _singleton + dval = object() + if getattr(ui, '_progbar', dval) is dval: + ui.__class__ = progressui + # we instantiate one globally-shared progress bar to avoid + # competing progress bars when multiple UI objects get created + if not progressui._progbar: + if _singleton is None: + _singleton = progbar(ui) + progressui._progbar = _singleton def reposetup(ui, repo): uisetup(repo.ui)