Rev 4123: (mbp) small progress improvements in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Mar 12 03:39:14 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4123
revision-id: pqm at pqm.ubuntu.com-20090312033910-9umj7rwjo98zl7up
parent: pqm at pqm.ubuntu.com-20090312025908-v6s9pjhxubuqrnxe
parent: mbp at sourcefrog.net-20090312024517-43rws5frloylav7b
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-03-12 03:39:10 +0000
message:
  (mbp) small progress improvements
modified:
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
  bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
  bzrlib/transport/sftp.py       sftp.py-20051019050329-ab48ce71b7e32dfe
  bzrlib/ui/text.py              text.py-20051130153916-2e438cffc8afc478
    ------------------------------------------------------------
    revno: 4103.3.5
    revision-id: mbp at sourcefrog.net-20090312024517-43rws5frloylav7b
    parent: mbp at sourcefrog.net-20090311065111-zqt1ccsft210eq1u
    parent: pqm at pqm.ubuntu.com-20090312021804-624908fcy28eisfn
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: progress
    timestamp: Thu 2009-03-12 12:45:17 +1000
    message:
      merge trunk
    added:
      bzrlib/tests/per_repository_reference/test_default_stacking.py test_default_stackin-20090311055345-9ajahgm58oq3wh6h-1
      tools/check-newsbugs.py        checknewsbugs.py-20090128204947-lsdwd8nlswm1yrwv-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/_dirstate_helpers_c.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/hooks.py                hooks.py-20070325015548-ix4np2q0kd8452au-1
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/lock.py                 lock.py-20050527050856-ec090bb51bc03349
      bzrlib/lockable_files.py       control_files.py-20051111201905-bb88546e799d669f
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
      bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
      bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
      bzrlib/tests/interrepository_implementations/test_fetch.py test_fetch.py-20080425213627-j60cjh782ufm83ry-1
      bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
      bzrlib/tests/per_repository/test_fileid_involved.py test_file_involved.py-20051215205901-728a172d1014daaa
      bzrlib/tests/per_repository_reference/__init__.py __init__.py-20080220025549-nnm2s80it1lvcwnc-2
      bzrlib/tests/test__dirstate_helpers.py test_dirstate_helper-20070504035751-jsbn00xodv0y1eve-2
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_hooks.py     test_hooks.py-20070628030849-89rtsbe5dmer5npz-1
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/tests/test_source.py    test_source.py-20051207061333-a58dea6abecc030d
      bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
      bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
      bzrlib/tests/workingtree_implementations/test_mkdir.py test_mkdir.py-20060907214856-4omn6hf1u7fvrart-3
      bzrlib/tests/workingtree_implementations/test_nested_specifics.py test_nested_specific-20070306004443-qut978c488jr11sg-1
      bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
      bzrlib/urlutils.py             urlutils.py-20060502195429-e8a161ecf8fac004
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
      bzrlib/weave.py                knit.py-20050627021749-759c29984154256b
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      doc/developers/releasing.txt   releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
      tools/doc_generate/autodoc_man.py bzrman.py-20050601153041-0ff7f74de456d15e
    ------------------------------------------------------------
    revno: 4103.3.4
    revision-id: mbp at sourcefrog.net-20090311065111-zqt1ccsft210eq1u
    parent: mbp at sourcefrog.net-20090310065549-kwkxp2fcui3p8qy8
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: progress
    timestamp: Wed 2009-03-11 16:51:11 +1000
    message:
      Update test that depends on progress bar strings
    modified:
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
    ------------------------------------------------------------
    revno: 4103.3.3
    revision-id: mbp at sourcefrog.net-20090310065549-kwkxp2fcui3p8qy8
    parent: mbp at sourcefrog.net-20090310062434-dh86l8fm5o92eq2d
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: progress
    timestamp: Tue 2009-03-10 16:55:49 +1000
    message:
      Show the progress bar part when showing activity by default
    modified:
      bzrlib/ui/text.py              text.py-20051130153916-2e438cffc8afc478
    ------------------------------------------------------------
    revno: 4103.3.2
    revision-id: mbp at sourcefrog.net-20090310062434-dh86l8fm5o92eq2d
    parent: mbp at sourcefrog.net-20090310055644-jel2ngqsl204p0ds
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: progress
    timestamp: Tue 2009-03-10 16:24:34 +1000
    message:
      Remove trailing punctuation from progress messages
    modified:
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 4103.3.1
    revision-id: mbp at sourcefrog.net-20090310055644-jel2ngqsl204p0ds
    parent: pqm at pqm.ubuntu.com-20090310052823-5h4znt0j8j5ak38o
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: progress
    timestamp: Tue 2009-03-10 15:56:44 +1000
    message:
      More sftp progress hooks
    modified:
      bzrlib/transport/sftp.py       sftp.py-20051019050329-ab48ce71b7e32dfe
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2009-03-11 07:59:06 +0000
+++ b/bzrlib/knit.py	2009-03-12 02:45:17 +0000
@@ -1681,7 +1681,7 @@
                         key_records.append((key, details[0]))
                 records_iter = enumerate(self._read_records_iter(key_records))
                 for (key_idx, (key, data, sha_value)) in records_iter:
-                    pb.update('Walking content.', key_idx, total)
+                    pb.update('Walking content', key_idx, total)
                     compression_parent = build_details[key][1]
                     if compression_parent is None:
                         # fulltext
@@ -1717,7 +1717,7 @@
                 source_keys.add(key)
                 yield line, key
             keys.difference_update(source_keys)
-        pb.update('Walking content.', total, total)
+        pb.update('Walking content', total, total)
 
     def _make_line_delta(self, delta_seq, new_content):
         """Generate a line delta from delta_seq and new_content."""

=== modified file 'bzrlib/reconcile.py'
--- a/bzrlib/reconcile.py	2009-01-17 01:30:58 +0000
+++ b/bzrlib/reconcile.py	2009-03-10 06:24:34 +0000
@@ -213,7 +213,7 @@
         # local because needing to know about WeaveFile is a wart we want to hide
         from bzrlib.weave import WeaveFile, Weave
         transaction = self.repo.get_transaction()
-        self.pb.update('Reading inventory data.')
+        self.pb.update('Reading inventory data')
         self.inventory = self.repo.inventories
         self.revisions = self.repo.revisions
         # the total set of revisions to process
@@ -235,9 +235,9 @@
             (not self.garbage_inventories or not self.thorough)):
             self.pb.note('Inventory ok.')
             return
-        self.pb.update('Backing up inventory...', 0, 0)
+        self.pb.update('Backing up inventory', 0, 0)
         self.repo._backup_inventory()
-        self.pb.note('Backup Inventory created.')
+        self.pb.note('Backup inventory created.')
         new_inventories = self.repo._temp_inventories()
 
         # we have topological order of revisions and non ghost parents ready.
@@ -351,24 +351,24 @@
     def _load_indexes(self):
         """Load indexes for the reconciliation."""
         self.transaction = self.repo.get_transaction()
-        self.pb.update('Reading indexes.', 0, 2)
+        self.pb.update('Reading indexes', 0, 2)
         self.inventory = self.repo.inventories
-        self.pb.update('Reading indexes.', 1, 2)
+        self.pb.update('Reading indexes', 1, 2)
         self.repo._check_for_inconsistent_revision_parents()
         self.revisions = self.repo.revisions
-        self.pb.update('Reading indexes.', 2, 2)
+        self.pb.update('Reading indexes', 2, 2)
 
     def _gc_inventory(self):
         """Remove inventories that are not referenced from the revision store."""
-        self.pb.update('Checking unused inventories.', 0, 1)
+        self.pb.update('Checking unused inventories', 0, 1)
         self._check_garbage_inventories()
-        self.pb.update('Checking unused inventories.', 1, 3)
+        self.pb.update('Checking unused inventories', 1, 3)
         if not self.garbage_inventories:
             self.pb.note('Inventory ok.')
             return
-        self.pb.update('Backing up inventory...', 0, 0)
+        self.pb.update('Backing up inventory', 0, 0)
         self.repo._backup_inventory()
-        self.pb.note('Backup Inventory created.')
+        self.pb.note('Backup Inventory created')
         # asking for '' should never return a non-empty weave
         new_inventories = self.repo._temp_inventories()
         # we have topological order of revisions and non ghost parents ready.

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2009-03-10 01:58:52 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2009-03-12 02:45:17 +0000
@@ -2085,12 +2085,12 @@
                 pos, length = value[1:].split(' ')
                 index_positions.append((index, int(pos), key[0],
                     tuple(parent[0] for parent in refs[0])))
-                pb.update("Reading revision index.", 0, 0)
+                pb.update("Reading revision index", 0, 0)
             index_positions.sort()
             batch_count = len(index_positions) / 1000 + 1
-            pb.update("Checking cached revision graph.", 0, batch_count)
+            pb.update("Checking cached revision graph", 0, batch_count)
             for offset in xrange(batch_count):
-                pb.update("Checking cached revision graph.", offset)
+                pb.update("Checking cached revision graph", offset)
                 to_query = index_positions[offset * 1000:(offset + 1) * 1000]
                 if not to_query:
                     break

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-03-10 07:47:23 +0000
+++ b/bzrlib/repository.py	2009-03-12 02:45:17 +0000
@@ -1605,7 +1605,7 @@
         batch_size = 10 # should be ~150MB on a 55K path tree
         batch_count = len(revision_order) / batch_size + 1
         processed_texts = 0
-        pb.update("Calculating text parents.", processed_texts, text_count)
+        pb.update("Calculating text parents", processed_texts, text_count)
         for offset in xrange(batch_count):
             to_query = revision_order[offset * batch_size:(offset + 1) *
                 batch_size]
@@ -1615,7 +1615,7 @@
                 revision_id = rev_tree.get_revision_id()
                 parent_ids = ancestors[revision_id]
                 for text_key in revision_keys[revision_id]:
-                    pb.update("Calculating text parents.", processed_texts)
+                    pb.update("Calculating text parents", processed_texts)
                     processed_texts += 1
                     candidate_parents = []
                     for parent_id in parent_ids:

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-03-10 01:29:23 +0000
+++ b/bzrlib/tests/__init__.py	2009-03-10 06:24:34 +0000
@@ -363,7 +363,7 @@
         self.pb.show_bar = False
 
     def report_starting(self):
-        self.pb.update('[test 0/%d] starting...' % (self.num_tests))
+        self.pb.update('[test 0/%d] Starting' % (self.num_tests))
 
     def _progress_prefix_text(self):
         # the longer this text, the less space we have to show the test
@@ -428,7 +428,7 @@
         """test cannot be run because feature is missing."""
 
     def report_cleaning_up(self):
-        self.pb.update('cleaning up...')
+        self.pb.update('Cleaning up')
 
     def finished(self):
         if not self._supplied_pb:

=== modified file 'bzrlib/tests/test_versionedfile.py'
--- a/bzrlib/tests/test_versionedfile.py	2009-03-12 00:28:59 +0000
+++ b/bzrlib/tests/test_versionedfile.py	2009-03-12 03:39:10 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005 Canonical Ltd
+# Copyright (C) 2005, 2009 Canonical Ltd
 #
 # Authors:
 #   Johan Rydberg <jrydberg at gnu.org>
@@ -746,21 +746,21 @@
                 self.assertEqual(expected, progress.updates)
             return lines
         lines = iter_with_versions(['child', 'otherchild'],
-                                   [('Walking content.', 0, 2),
-                                    ('Walking content.', 1, 2),
-                                    ('Walking content.', 2, 2)])
+                                   [('Walking content', 0, 2),
+                                    ('Walking content', 1, 2),
+                                    ('Walking content', 2, 2)])
         # we must see child and otherchild
         self.assertTrue(lines[('child\n', 'child')] > 0)
         self.assertTrue(lines[('otherchild\n', 'otherchild')] > 0)
         # we dont care if we got more than that.
 
         # test all lines
-        lines = iter_with_versions(None, [('Walking content.', 0, 5),
-                                          ('Walking content.', 1, 5),
-                                          ('Walking content.', 2, 5),
-                                          ('Walking content.', 3, 5),
-                                          ('Walking content.', 4, 5),
-                                          ('Walking content.', 5, 5)])
+        lines = iter_with_versions(None, [('Walking content', 0, 5),
+                                          ('Walking content', 1, 5),
+                                          ('Walking content', 2, 5),
+                                          ('Walking content', 3, 5),
+                                          ('Walking content', 4, 5),
+                                          ('Walking content', 5, 5)])
         # all lines must be seen at least once
         self.assertTrue(lines[('base\n', 'base')] > 0)
         self.assertTrue(lines[('lancestor\n', 'lancestor')] > 0)
@@ -2304,9 +2304,9 @@
             return lines
         lines = iter_with_keys(
             [self.get_simple_key('child'), self.get_simple_key('otherchild')],
-            [('Walking content.', 0, 2),
-             ('Walking content.', 1, 2),
-             ('Walking content.', 2, 2)])
+            [('Walking content', 0, 2),
+             ('Walking content', 1, 2),
+             ('Walking content', 2, 2)])
         # we must see child and otherchild
         self.assertTrue(lines[('child\n', self.get_simple_key('child'))] > 0)
         self.assertTrue(
@@ -2315,12 +2315,12 @@
 
         # test all lines
         lines = iter_with_keys(files.keys(),
-            [('Walking content.', 0, 5),
-             ('Walking content.', 1, 5),
-             ('Walking content.', 2, 5),
-             ('Walking content.', 3, 5),
-             ('Walking content.', 4, 5),
-             ('Walking content.', 5, 5)])
+            [('Walking content', 0, 5),
+             ('Walking content', 1, 5),
+             ('Walking content', 2, 5),
+             ('Walking content', 3, 5),
+             ('Walking content', 4, 5),
+             ('Walking content', 5, 5)])
         # all lines must be seen at least once
         self.assertTrue(lines[('base\n', self.get_simple_key('base'))] > 0)
         self.assertTrue(

=== modified file 'bzrlib/transport/sftp.py'
--- a/bzrlib/transport/sftp.py	2009-02-23 15:29:35 +0000
+++ b/bzrlib/transport/sftp.py	2009-03-10 05:56:44 +0000
@@ -406,6 +406,8 @@
         """
         try:
             self._get_sftp().stat(self._remote_path(relpath))
+            # stat result is about 20 bytes, let's say
+            self._report_activity(20, 'read')
             return True
         except IOError:
             return False
@@ -416,6 +418,11 @@
         :param relpath: The relative path to the file
         """
         try:
+            # FIXME: by returning the file directly, we don't pass this
+            # through to report_activity.  We could try wrapping the object
+            # before it's returned.  For readv and get_bytes it's handled in
+            # the higher-level function.
+            # -- mbp 20090126
             path = self._remote_path(relpath)
             f = self._get_sftp().file(path, mode='rb')
             if self._do_prefetch and (getattr(f, 'prefetch', None) is not None):
@@ -612,6 +619,7 @@
 
     def iter_files_recursive(self):
         """Walk the relative paths of all files in this transport."""
+        # progress is handled by list_dir
         queue = list(self.list_dir('.'))
         while queue:
             relpath = queue.pop(0)
@@ -628,7 +636,9 @@
         else:
             local_mode = mode
         try:
+            self._report_activity(len(abspath), 'write')
             self._get_sftp().mkdir(abspath, local_mode)
+            self._report_activity(1, 'read')
             if mode is not None:
                 # chmod a dir through sftp will erase any sgid bit set
                 # on the server side.  So, if the bit mode are already
@@ -779,6 +789,7 @@
         path = self._remote_path(relpath)
         try:
             entries = self._get_sftp().listdir(path)
+            self._report_activity(sum(map(len, entries)), 'read')
         except (IOError, paramiko.SSHException), e:
             self._translate_io_exception(e, path, ': failed to list_dir')
         return [urlutils.escape(entry) for entry in entries]

=== modified file 'bzrlib/ui/text.py'
--- a/bzrlib/ui/text.py	2009-03-03 02:13:14 +0000
+++ b/bzrlib/ui/text.py	2009-03-10 06:55:49 +0000
@@ -146,7 +146,12 @@
 
     def _render_bar(self):
         # return a string for the progress bar itself
-        if (self._last_task is not None) and self._last_task.show_bar:
+        if (self._last_task is None) or self._last_task.show_bar:
+            # If there's no task object, we show space for the bar anyhow.
+            # That's because most invocations of bzr will end showing progress
+            # at some point, though perhaps only after doing some initial IO.
+            # It looks better to draw the progress bar initially rather than
+            # to have what looks like an incomplete progress bar.
             spin_str =  r'/-\|'[self._spin_pos % 4]
             self._spin_pos += 1
             f = self._task_fraction or 0
@@ -155,7 +160,8 @@
             markers = int(round(float(cols) * f)) - 1
             bar_str = '[' + ('#' * markers + spin_str).ljust(cols) + '] '
             return bar_str
-        elif (self._last_task is None) or self._last_task.show_spinner:
+        elif self._last_task.show_spinner:
+            # The last task wanted just a spinner, no bar
             spin_str =  r'/-\|'[self._spin_pos % 4]
             self._spin_pos += 1
             return spin_str + ' '




More information about the bazaar-commits mailing list