Rev 5509: Fix bug #662053, 'bzr status' shouldn't fail in http://bazaar.launchpad.net/~jameinel/bzr/2.3-status-shelf-662053

John Arbash Meinel john at arbash-meinel.com
Mon Oct 18 22:34:21 BST 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.3-status-shelf-662053

------------------------------------------------------------
revno: 5509
revision-id: john at arbash-meinel.com-20101018213405-qn3biq5yu4i0axut
parent: pqm at pqm.ubuntu.com-20101018170637-r2ta5hd72o4ficv4
fixes bug(s): https://launchpad.net/bugs/662053
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-status-shelf-662053
timestamp: Mon 2010-10-18 16:34:05 -0500
message:
  Fix bug #662053, 'bzr status' shouldn't fail
  if the tree doesn't implement get_shelf_manager. Either that or
  RevisionTree should be implementing it, but returning None, or something similar.
-------------- next part --------------
=== modified file 'bzrlib/status.py'
--- a/bzrlib/status.py	2010-09-17 15:15:34 +0000
+++ b/bzrlib/status.py	2010-10-18 21:34:05 +0000
@@ -444,7 +444,10 @@
 
     :param params: StatusHookParams.
     """
-    manager = params.new_tree.get_shelf_manager()
+    get_shelf_manager = getattr(params.new_tree, 'get_shelf_manager', None)
+    if get_shelf_manager is None:
+        return
+    manager = get_shelf_manager()
     shelves = manager.active_shelves()
     if shelves:
         params.to_file.write('%d shelves exist. '

=== modified file 'bzrlib/tests/blackbox/test_status.py'
--- a/bzrlib/tests/blackbox/test_status.py	2010-09-12 05:09:24 +0000
+++ b/bzrlib/tests/blackbox/test_status.py	2010-10-18 21:34:05 +0000
@@ -45,6 +45,14 @@
 
 class BranchStatus(TestCaseWithTransport):
 
+    def setUp(self):
+        super(BranchStatus, self).setUp()
+        # As TestCase.setUp clears all hooks, we install this default
+        # post_status hook handler for the test.
+        status.hooks.install_named_hook('post_status',
+            status._show_shelve_summary,
+            'bzr status')
+
     def assertStatus(self, expected_lines, working_tree,
         revision=None, short=False, pending=True, verbose=False):
         """Run status in working_tree and look for output.
@@ -530,11 +538,6 @@
         self.run_bzr(['shelve', '--all', '-m', 'foo'])
         self.build_tree(['bye.c'])
         wt.add('bye.c')
-        # As TestCase.setUp clears all hooks, we install this default
-        # post_status hook handler for the test.
-        status.hooks.install_named_hook('post_status',
-            status._show_shelve_summary,
-            'bzr status')
         self.assertStatus([
                 'added:\n',
                 '  bye.c\n',

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2010-10-18 12:36:03 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2010-10-18 21:34:05 +0000
@@ -46,6 +46,9 @@
 
 * Always set PATH in start_bzr.bat on Windows. (Matth??us G. Chajdas, #470264)
 
+* ``bzr status -r X..Y`` was failing because RevisionTree didn't implement
+  ``get_shelf_manager``. (John Arbash Meinel, #662053)
+
 * Don't force openssh to use protocol=2, since that is now the default.
   (Neil Martinsen-Burrell, #561061)
 



More information about the bazaar-commits mailing list