Rev 3640: (robertc) Fix performance regression in status PATH. (Robert Collins) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Aug 19 04:44:43 BST 2008


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

------------------------------------------------------------
revno: 3640
revision-id: pqm at pqm.ubuntu.com-20080819034437-8cr7y59abr4wemaz
parent: pqm at pqm.ubuntu.com-20080818180008-9488xkn2acyv2obu
parent: robertc at robertcollins.net-20080819030837-gt22111eeu4dw6m3
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-08-19 04:44:37 +0100
message:
  (robertc) Fix performance regression in status PATH. (Robert Collins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
  bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
  bzrlib/tests/test_status.py    test_status.py-20060516190614-fbf6432e4a6e8aa5
    ------------------------------------------------------------
    revno: 3636.1.2
    revision-id: robertc at robertcollins.net-20080819030837-gt22111eeu4dw6m3
    parent: robertc at robertcollins.net-20080816222801-pnbv5wkg3rrsjko0
    parent: pqm at pqm.ubuntu.com-20080818180008-9488xkn2acyv2obu
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: integration
    timestamp: Tue 2008-08-19 13:08:37 +1000
    message:
      Resolve NEWS.
    removed:
      tools/win32/survey.txt         survey.txt-20070809075950-sf265mgu9oog8jjb-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_remove.py test_remove.py-20060530011439-fika5rm84lon0goe-1
      bzrlib/tests/blackbox/test_uncommit.py test_uncommit.py-20051027212835-84944b63adae51be
      tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
    ------------------------------------------------------------
    revno: 3636.1.1
    revision-id: robertc at robertcollins.net-20080816222801-pnbv5wkg3rrsjko0
    parent: pqm at pqm.ubuntu.com-20080815025810-eguaiqf0kwwqo4yp
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: status
    timestamp: Sun 2008-08-17 08:28:01 +1000
    message:
      Stop passing specific_file lists to show_tree_status when the specific
      file list refers to an entire tree - that is wasteful and has significant
      performance impact. (Robert Collins, #225204)
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
      bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
      bzrlib/tests/test_status.py    test_status.py-20060516190614-fbf6432e4a6e8aa5
=== modified file 'NEWS'
--- a/NEWS	2008-08-16 00:09:54 +0000
+++ b/NEWS	2008-08-19 03:08:37 +0000
@@ -32,6 +32,13 @@
     * ``bzr rm`` is now aliased to ``bzr del`` for the convenience of svn
       users. (Robert Collins, #205416)
 
+    * Running ``bzr st PATH_TO_TREE`` will no longer suppress merge
+      status. Status is also about 7% faster on mozilla sized trees
+      when the path to the root of the tree has been given. Users of
+      the internal ``show_tree_status`` function should be aware that
+      the show_pending flag is now authoritative for showing pending
+      merges, as it was originally. (Robert Collins, #225204)
+
     * ``WorkingTree4`` trees will now correctly report missing-and-new
       paths in the output of ``iter_changes``. (Robert Collins)
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-08-16 00:09:54 +0000
+++ b/bzrlib/builtins.py	2008-08-19 03:08:37 +0000
@@ -184,12 +184,20 @@
             raise errors.BzrCommandError('bzr status --revision takes exactly'
                                          ' one or two revision specifiers')
 
-        tree, file_list = tree_files(file_list)
-            
+        tree, relfile_list = tree_files(file_list)
+        # Avoid asking for specific files when that is not needed.
+        if relfile_list == ['']:
+            relfile_list = None
+            # Don't disable pending merges for full trees other than '.'.
+            if file_list == ['.']:
+                no_pending = True
+        # A specific path within a tree was given.
+        elif relfile_list is not None:
+            no_pending = True
         show_tree_status(tree, show_ids=show_ids,
-                         specific_files=file_list, revision=revision,
+                         specific_files=relfile_list, revision=revision,
                          to_file=self.outf, short=short, versioned=versioned,
-                         show_pending=not no_pending)
+                         show_pending=(not no_pending))
 
 
 class cmd_cat_revision(Command):

=== modified file 'bzrlib/status.py'
--- a/bzrlib/status.py	2008-06-03 17:51:14 +0000
+++ b/bzrlib/status.py	2008-08-16 22:28:01 +0000
@@ -137,8 +137,7 @@
                 else:
                     prefix = ' '
                 to_file.write("%s %s\n" % (prefix, conflict))
-            if (new_is_working_tree and show_pending
-                and specific_files is None):
+            if (new_is_working_tree and show_pending):
                 show_pending_merges(new, to_file, short)
         finally:
             old.unlock()

=== modified file 'bzrlib/tests/blackbox/test_status.py'
--- a/bzrlib/tests/blackbox/test_status.py	2008-07-30 07:52:22 +0000
+++ b/bzrlib/tests/blackbox/test_status.py	2008-08-16 22:28:01 +0000
@@ -442,6 +442,22 @@
         out, err = self.run_bzr('status --no-pending', working_dir='a')
         self.assertEquals(out, "added:\n  b\n")
 
+    def test_pending_specific_files(self):
+        """With a specific file list, pending merges are not shown."""
+        tree = self.make_branch_and_tree('tree')
+        self.build_tree_contents([('tree/a', 'content of a\n')])
+        tree.add('a')
+        r1_id = tree.commit('one')
+        alt = tree.bzrdir.sprout('alt').open_workingtree()
+        self.build_tree_contents([('alt/a', 'content of a\nfrom alt\n')])
+        alt_id = alt.commit('alt')
+        tree.merge_from_branch(alt.branch)
+        output = StringIO()
+        show_tree_status(tree, to_file=output)
+        self.assertContainsRe(output.getvalue(), 'pending merges:')
+        out, err = self.run_bzr('status tree/a')
+        self.assertNotContainsRe(out, 'pending merges:')
+
 
 class TestStatusEncodings(TestCaseWithTransport):
     

=== modified file 'bzrlib/tests/test_status.py'
--- a/bzrlib/tests/test_status.py	2008-06-02 16:09:09 +0000
+++ b/bzrlib/tests/test_status.py	2008-08-16 22:28:01 +0000
@@ -112,20 +112,3 @@
                      revision=[RevisionSpec.from_string("revid:%s" % r1_id),
                                RevisionSpec.from_string("revid:%s" % r2_id)])
         # return does not matter as long as it did not raise.
-
-    def test_pending_specific_files(self):
-        """With a specific file list, pending merges are not shown."""
-        tree = self.make_branch_and_tree('tree')
-        self.build_tree_contents([('tree/a', 'content of a\n')])
-        tree.add('a')
-        r1_id = tree.commit('one')
-        alt = tree.bzrdir.sprout('alt').open_workingtree()
-        self.build_tree_contents([('alt/a', 'content of a\nfrom alt\n')])
-        alt_id = alt.commit('alt')
-        tree.merge_from_branch(alt.branch)
-        output = StringIO()
-        show_tree_status(tree, to_file=output)
-        self.assertContainsRe(output.getvalue(), 'pending merges:')
-        output = StringIO()
-        show_tree_status(tree, to_file=output, specific_files=['a'])
-        self.assertNotContainsRe(output.getvalue(), 'pending merges:')




More information about the bazaar-commits mailing list