##// END OF EJS Templates
progress: move the singleton logic to the ui module...
Pierre-Yves David -
r25498:7a5335ed default
parent child Browse files
Show More
@@ -36,11 +36,9 b' characters.'
36 """
36 """
37
37
38 from mercurial import progress
38 from mercurial import progress
39
39 from mercurial import ui as uimod
40 _singleton = None
41
40
42 def uisetup(ui):
41 def uisetup(ui):
43 global _singleton
44 class progressui(ui.__class__):
42 class progressui(ui.__class__):
45 _progbar = None
43 _progbar = None
46
44
@@ -73,9 +71,7 b' def uisetup(ui):'
73 # we instantiate one globally-shared progress bar to avoid
71 # we instantiate one globally-shared progress bar to avoid
74 # competing progress bars when multiple UI objects get created
72 # competing progress bars when multiple UI objects get created
75 if not progressui._progbar:
73 if not progressui._progbar:
76 if _singleton is None:
74 progressui._progbar = uimod.getprogbar(ui)
77 _singleton = progress.progbar(ui)
78 progressui._progbar = _singleton
79
75
80 def reposetup(ui, repo):
76 def reposetup(ui, repo):
81 uisetup(repo.ui)
77 uisetup(repo.ui)
@@ -7,7 +7,7 b''
7
7
8 from i18n import _
8 from i18n import _
9 import errno, getpass, os, socket, sys, tempfile, traceback
9 import errno, getpass, os, socket, sys, tempfile, traceback
10 import config, scmutil, util, error, formatter
10 import config, scmutil, util, error, formatter, progress
11 from node import hex
11 from node import hex
12
12
13 samplehgrcs = {
13 samplehgrcs = {
@@ -983,3 +983,15 b' class path(object):'
983 self.name = name
983 self.name = name
984 # We'll do more intelligent things with rawloc in the future.
984 # We'll do more intelligent things with rawloc in the future.
985 self.loc = rawloc
985 self.loc = rawloc
986
987 # we instantiate one globally shared progress bar to avoid
988 # competing progress bars when multiple UI objects get created
989 _progresssingleton = None
990
991 def getprogbar(ui):
992 global _progresssingleton
993 if _progresssingleton is None:
994 # passing 'ui' object to the singleton is fishy,
995 # this is how the extension used to work but feel free to rework it.
996 _progresssingleton = progress.progbar(ui)
997 return _progresssingleton
@@ -31,7 +31,7 b' these may expose other cycles.'
31 relative: config, error, templatefilters, templatekw, util
31 relative: config, error, templatefilters, templatekw, util
32 mercurial/ui.py mixed imports
32 mercurial/ui.py mixed imports
33 stdlib: formatter
33 stdlib: formatter
34 relative: config, error, scmutil, util
34 relative: config, error, progress, scmutil, util
35 Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
35 Import cycle: mercurial.cmdutil -> mercurial.context -> mercurial.subrepo -> mercurial.cmdutil
36 Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
36 Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
37 Import cycle: mercurial.commands -> mercurial.commandserver -> mercurial.dispatch -> mercurial.commands
37 Import cycle: mercurial.commands -> mercurial.commandserver -> mercurial.dispatch -> mercurial.commands
General Comments 0
You need to be logged in to leave comments. Login now