Rev 4350: Add -Dprogress to assist in debugging progress bar jumping. in http://people.ubuntu.com/~robertc/baz2.0/check

Robert Collins robertc at robertcollins.net
Tue May 12 07:31:00 BST 2009


At http://people.ubuntu.com/~robertc/baz2.0/check

------------------------------------------------------------
revno: 4350
revision-id: robertc at robertcollins.net-20090512063056-hdoh46ea7gxqek5c
parent: robertc at robertcollins.net-20090512053415-20rkucg2p211zdui
committer: Robert Collins <robertc at robertcollins.net>
branch nick: check
timestamp: Tue 2009-05-12 16:30:56 +1000
message:
  Add -Dprogress to assist in debugging progress bar jumping.
=== modified file 'NEWS'
--- a/NEWS	2009-05-08 02:06:36 +0000
+++ b/NEWS	2009-05-12 06:30:56 +0000
@@ -108,6 +108,9 @@
   cause mismatched physical locks to cause test errors rather than just
   reporting to the screen. (Robert Collins)
 
+* -Dprogress will cause pdb to start up if a progress view jumps
+  backwards. (Robert Collins)
+
 * Fallback ``CredentialStore`` instances registered with ``fallback=True``
   are now be able to provide credentials if obtaining credentials 
   via ~/.bazaar/authentication.conf fails. (Jelmer Vernooij, 

=== modified file 'bzrlib/help_topics/en/debug-flags.txt'
--- a/bzrlib/help_topics/en/debug-flags.txt	2009-03-18 23:43:51 +0000
+++ b/bzrlib/help_topics/en/debug-flags.txt	2009-05-12 06:30:56 +0000
@@ -19,6 +19,7 @@
 -Dindex           Trace major index operations.
 -Dknit            Trace knit operations.
 -Dlock            Trace when lockdir locks are taken or released.
+-Dprogress        Trace progress bar operations.
 -Dmerge           Emit information for debugging merges.
 -Dpack            Emit information about pack operations.
 -Dsftp            Trace SFTP internals.

=== modified file 'bzrlib/ui/text.py'
--- a/bzrlib/ui/text.py	2009-04-10 19:37:20 +0000
+++ b/bzrlib/ui/text.py	2009-05-12 06:30:56 +0000
@@ -26,6 +26,7 @@
 from bzrlib.lazy_import import lazy_import
 lazy_import(globals(), """
 from bzrlib import (
+    debug,
     progress,
     osutils,
     symbol_versioning,
@@ -128,6 +129,7 @@
         self._last_task = None
         self._total_byte_count = 0
         self._bytes_since_update = 0
+        self._fraction = 0
 
     def _show_line(self, s):
         n = self._width - 1
@@ -151,9 +153,14 @@
             cols = 20
             if self._last_task is None:
                 completion_fraction = 0
+                self._fraction = 0
             else:
                 completion_fraction = \
                     self._last_task._overall_completion_fraction() or 0
+            if (completion_fraction < self._fraction and 'progress' in
+                debug.debug_flags):
+                import pdb;pdb.set_trace()
+            self._fraction = completion_fraction
             markers = int(round(float(cols) * completion_fraction)) - 1
             bar_str = '[' + ('#' * markers + spin_str).ljust(cols) + '] '
             return bar_str




More information about the bazaar-commits mailing list