[PATCH 2 of 3] progress: make progress bar a singleton to avoid double-progress ui bugs
Augie Fackler
durin42 at gmail.com
Sun Jul 3 09:55:30 CDT 2011
# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1308858909 18000
# Node ID eb39d79604093aaa7696f573e98128c7d0bcc31f
# Parent 3b70b555ef40d4ae6c9b482d6f76c21b784da573
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.
diff --git a/hgext/progress.py b/hgext/progress.py
--- a/hgext/progress.py
+++ b/hgext/progress.py
@@ -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)
More information about the Mercurial-devel
mailing list