Rev 3637: Stop passing specific_file lists to show_tree_status when the specific in http://people.ubuntu.com/~robertc/baz2.0/status
Robert Collins
robertc at robertcollins.net
Sat Aug 16 23:29:17 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/status
------------------------------------------------------------
revno: 3637
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-14 20:42:22 +0000
+++ b/NEWS 2008-08-16 22:28:01 +0000
@@ -20,6 +20,13 @@
BUG FIXES:
+ * 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-14 17:08:56 +0000
+++ b/bzrlib/builtins.py 2008-08-16 22:28:01 +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