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.
This commit is contained in:
Pierre-Yves David 2015-06-07 18:11:23 -07:00
parent 2f30e7a692
commit 77d8baf9e3
5 changed files with 15 additions and 74 deletions

View File

@ -312,13 +312,15 @@ def uisetup(ui):
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)

View File

@ -282,18 +282,11 @@ enable progress extension:
$ 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)

View File

@ -10,37 +10,20 @@ plain
\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)

View File

@ -289,18 +289,11 @@ Test breaking format changes aren't
\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 ...

View File

@ -273,29 +273,19 @@ only show up in the test output, not in real usage):
$ 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 @@ Test archiving to zip file (unzip output is unstable):
$ 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 @@ cloned:
$ 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 @@ cloned:
\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 @@ cloned:
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)