changeset 14837:ec4ba216ddef

progress: make progress bar a singleton to avoid double-progress ui bugs This helps issue2698 a little, but isn't a complete fix, since generators still can produce some weird progress bar switching.
author Augie Fackler <durin42@gmail.com>
date Thu, 23 Jun 2011 14:55:09 -0500
parents 925cab23d7d5
children 5d261fd00446
files hgext/progress.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/progress.py	Thu Jun 02 14:33:01 2011 -0500
+++ b/hgext/progress.py	Thu Jun 23 14:55:09 2011 -0500
@@ -251,7 +251,10 @@
                 self.lastprint = now
                 self.show(now, topic, *self.topicstates[topic])
 
+_singleton = None
+
 def uisetup(ui):
+    global _singleton
     class progressui(ui.__class__):
         _progbar = None
 
@@ -278,7 +281,9 @@
         # we instantiate one globally shared progress bar to avoid
         # competing progress bars when multiple UI objects get created
         if not progressui._progbar:
-            progressui._progbar = progbar(ui)
+            if _singleton is None:
+                _singleton = progbar(ui)
+            progressui._progbar = _singleton
 
 def reposetup(ui, repo):
     uisetup(repo.ui)