Mercurial > hg
changeset 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 | 6de96cb31176 |
children | fb04372d7b38 |
files | hgext/progress.py tests/test-archive.t tests/test-debugbuilddag.t tests/test-patchbomb.t tests/test-subrepo-recursion.t |
diffstat | 5 files changed, 15 insertions(+), 74 deletions(-) [+] |
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)
--- a/tests/test-archive.t Wed May 27 05:28:40 2015 -0700 +++ b/tests/test-archive.t Sun Jun 07 18:11:23 2015 -0700 @@ -282,18 +282,11 @@ $ hg archive ../with-progress \r (no-eol) (esc) archiving [ ] 0/6\r (no-eol) (esc) - archiving [ ] 0/6\r (no-eol) (esc) archiving [======> ] 1/6\r (no-eol) (esc) - archiving [======> ] 1/6\r (no-eol) (esc) - archiving [=============> ] 2/6\r (no-eol) (esc) archiving [=============> ] 2/6\r (no-eol) (esc) archiving [====================> ] 3/6\r (no-eol) (esc) - archiving [====================> ] 3/6\r (no-eol) (esc) - archiving [===========================> ] 4/6\r (no-eol) (esc) archiving [===========================> ] 4/6\r (no-eol) (esc) archiving [==================================> ] 5/6\r (no-eol) (esc) - archiving [==================================> ] 5/6\r (no-eol) (esc) - archiving [==========================================>] 6/6\r (no-eol) (esc) archiving [==========================================>] 6/6\r (no-eol) (esc) \r (no-eol) (esc)
--- a/tests/test-debugbuilddag.t Wed May 27 05:28:40 2015 -0700 +++ b/tests/test-debugbuilddag.t Sun Jun 07 18:11:23 2015 -0700 @@ -10,37 +10,20 @@ \r (no-eol) (esc) building [ ] 0/12\r (no-eol) (esc) building [ ] 0/12\r (no-eol) (esc) - building [ ] 0/12\r (no-eol) (esc) - building [ ] 0/12\r (no-eol) (esc) - building [==> ] 1/12\r (no-eol) (esc) - building [==> ] 1/12\r (no-eol) (esc) building [==> ] 1/12\r (no-eol) (esc) building [==> ] 1/12\r (no-eol) (esc) building [======> ] 2/12\r (no-eol) (esc) - building [======> ] 2/12\r (no-eol) (esc) - building [=========> ] 3/12\r (no-eol) (esc) building [=========> ] 3/12\r (no-eol) (esc) building [=============> ] 4/12\r (no-eol) (esc) building [=============> ] 4/12\r (no-eol) (esc) building [=============> ] 4/12\r (no-eol) (esc) - building [=============> ] 4/12\r (no-eol) (esc) - building [=============> ] 4/12\r (no-eol) (esc) - building [=============> ] 4/12\r (no-eol) (esc) - building [================> ] 5/12\r (no-eol) (esc) building [================> ] 5/12\r (no-eol) (esc) building [====================> ] 6/12\r (no-eol) (esc) - building [====================> ] 6/12\r (no-eol) (esc) - building [=======================> ] 7/12\r (no-eol) (esc) building [=======================> ] 7/12\r (no-eol) (esc) building [===========================> ] 8/12\r (no-eol) (esc) building [===========================> ] 8/12\r (no-eol) (esc) - building [===========================> ] 8/12\r (no-eol) (esc) - building [===========================> ] 8/12\r (no-eol) (esc) - building [==============================> ] 9/12\r (no-eol) (esc) building [==============================> ] 9/12\r (no-eol) (esc) building [==================================> ] 10/12\r (no-eol) (esc) - building [==================================> ] 10/12\r (no-eol) (esc) - building [=====================================> ] 11/12\r (no-eol) (esc) building [=====================================> ] 11/12\r (no-eol) (esc) \r (no-eol) (esc)
--- a/tests/test-patchbomb.t Wed May 27 05:28:40 2015 -0700 +++ b/tests/test-patchbomb.t Sun Jun 07 18:11:23 2015 -0700 @@ -289,18 +289,11 @@ \r (no-eol) (esc) sending [ ] 0/3\r (no-eol) (esc) - sending [ ] 0/3\r (no-eol) (esc) - \r (no-eol) (esc) - \r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) sending [==============> ] 1/3\r (no-eol) (esc) - sending [==============> ] 1/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) - \r (no-eol) (esc) - \r (no-eol) (esc) - sending [=============================> ] 2/3\r (no-eol) (esc) sending [=============================> ] 2/3\r (no-eol) (esc) \r (esc) sending [PATCH 0 of 2] test ...
--- a/tests/test-subrepo-recursion.t Wed May 27 05:28:40 2015 -0700 +++ b/tests/test-subrepo-recursion.t Sun Jun 07 18:11:23 2015 -0700 @@ -273,29 +273,19 @@ $ hg archive --subrepos ../archive \r (no-eol) (esc) archiving [ ] 0/3\r (no-eol) (esc) - archiving [ ] 0/3\r (no-eol) (esc) - archiving [=============> ] 1/3\r (no-eol) (esc) archiving [=============> ] 1/3\r (no-eol) (esc) archiving [===========================> ] 2/3\r (no-eol) (esc) - archiving [===========================> ] 2/3\r (no-eol) (esc) - archiving [==========================================>] 3/3\r (no-eol) (esc) archiving [==========================================>] 3/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) archiving (foo) [ ] 0/3\r (no-eol) (esc) - archiving (foo) [ ] 0/3\r (no-eol) (esc) - archiving (foo) [===========> ] 1/3\r (no-eol) (esc) archiving (foo) [===========> ] 1/3\r (no-eol) (esc) archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) - archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) - archiving (foo) [====================================>] 3/3\r (no-eol) (esc) archiving (foo) [====================================>] 3/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) - archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) + archiving (foo/bar) [ ] 0/1\r (no-eol) (esc) + archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc) \r (no-eol) (esc) $ find ../archive | sort ../archive @@ -315,29 +305,19 @@ $ hg archive --subrepos --prefix '.' ../archive.zip \r (no-eol) (esc) archiving [ ] 0/3\r (no-eol) (esc) - archiving [ ] 0/3\r (no-eol) (esc) - archiving [=============> ] 1/3\r (no-eol) (esc) archiving [=============> ] 1/3\r (no-eol) (esc) archiving [===========================> ] 2/3\r (no-eol) (esc) - archiving [===========================> ] 2/3\r (no-eol) (esc) - archiving [==========================================>] 3/3\r (no-eol) (esc) archiving [==========================================>] 3/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) archiving (foo) [ ] 0/3\r (no-eol) (esc) - archiving (foo) [ ] 0/3\r (no-eol) (esc) - archiving (foo) [===========> ] 1/3\r (no-eol) (esc) archiving (foo) [===========> ] 1/3\r (no-eol) (esc) archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) - archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) - archiving (foo) [====================================>] 3/3\r (no-eol) (esc) archiving (foo) [====================================>] 3/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) - archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) + archiving (foo/bar) [ ] 0/1\r (no-eol) (esc) + archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc) \r (no-eol) (esc) (unzip date formating is unstable, we do not care about it and glob it out) @@ -383,12 +363,8 @@ $ hg archive --subrepos -r tip --prefix './' ../archive.tar.gz \r (no-eol) (esc) archiving [ ] 0/3\r (no-eol) (esc) - archiving [ ] 0/3\r (no-eol) (esc) - archiving [=============> ] 1/3\r (no-eol) (esc) archiving [=============> ] 1/3\r (no-eol) (esc) archiving [===========================> ] 2/3\r (no-eol) (esc) - archiving [===========================> ] 2/3\r (no-eol) (esc) - archiving [==========================================>] 3/3\r (no-eol) (esc) archiving [==========================================>] 3/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) @@ -403,12 +379,8 @@ \r (no-eol) (esc) \r (no-eol) (esc) archiving (foo) [ ] 0/3\r (no-eol) (esc) - archiving (foo) [ ] 0/3\r (no-eol) (esc) - archiving (foo) [===========> ] 1/3\r (no-eol) (esc) archiving (foo) [===========> ] 1/3\r (no-eol) (esc) archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) - archiving (foo) [=======================> ] 2/3\r (no-eol) (esc) - archiving (foo) [====================================>] 3/3\r (no-eol) (esc) archiving (foo) [====================================>] 3/3\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) @@ -420,10 +392,8 @@ linking [ <=> ] 6\r (no-eol) (esc) \r (no-eol) (esc) \r (no-eol) (esc) - archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [ ] 0/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) - archiving (foo/bar) [================================>] 1/1\r (no-eol) (glob) (esc) + archiving (foo/bar) [ ] 0/1\r (no-eol) (esc) + archiving (foo/bar) [================================>] 1/1\r (no-eol) (esc) \r (no-eol) (esc) cloning subrepo foo from $TESTTMP/repo/foo cloning subrepo foo/bar from $TESTTMP/repo/foo/bar (glob)