Merge lp:~jameinel/bzr/2.3-status-shelf-662053 into lp:bzr

Proposed by John A Meinel
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 5509
Proposed branch: lp:~jameinel/bzr/2.3-status-shelf-662053
Merge into: lp:bzr
Diff against target: 59 lines (+15/-6)
3 files modified
bzrlib/status.py (+4/-1)
bzrlib/tests/blackbox/test_status.py (+8/-5)
doc/en/release-notes/bzr-2.3.txt (+3/-0)
To merge this branch: bzr merge lp:~jameinel/bzr/2.3-status-shelf-662053
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+38775@code.launchpad.net

Commit message

Don't require 'get_shelf_manager' to exist on Tree objects inside the status code.

Description of the change

This fixes bug #662053. The new code to preview shelf changes relied on "Tree.get_shelf_manager" which is only implemented on WorkingTree.

I felt it was better to make the api optional, rather than make it a required attribute of any "Tree". We could do it differently.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Obviously correct, thanks for fixing it so quickly.

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/status.py'
2--- bzrlib/status.py 2010-09-17 15:15:34 +0000
3+++ bzrlib/status.py 2010-10-18 21:37:41 +0000
4@@ -444,7 +444,10 @@
5
6 :param params: StatusHookParams.
7 """
8- manager = params.new_tree.get_shelf_manager()
9+ get_shelf_manager = getattr(params.new_tree, 'get_shelf_manager', None)
10+ if get_shelf_manager is None:
11+ return
12+ manager = get_shelf_manager()
13 shelves = manager.active_shelves()
14 if shelves:
15 params.to_file.write('%d shelves exist. '
16
17=== modified file 'bzrlib/tests/blackbox/test_status.py'
18--- bzrlib/tests/blackbox/test_status.py 2010-09-12 05:09:24 +0000
19+++ bzrlib/tests/blackbox/test_status.py 2010-10-18 21:37:41 +0000
20@@ -45,6 +45,14 @@
21
22 class BranchStatus(TestCaseWithTransport):
23
24+ def setUp(self):
25+ super(BranchStatus, self).setUp()
26+ # As TestCase.setUp clears all hooks, we install this default
27+ # post_status hook handler for the test.
28+ status.hooks.install_named_hook('post_status',
29+ status._show_shelve_summary,
30+ 'bzr status')
31+
32 def assertStatus(self, expected_lines, working_tree,
33 revision=None, short=False, pending=True, verbose=False):
34 """Run status in working_tree and look for output.
35@@ -530,11 +538,6 @@
36 self.run_bzr(['shelve', '--all', '-m', 'foo'])
37 self.build_tree(['bye.c'])
38 wt.add('bye.c')
39- # As TestCase.setUp clears all hooks, we install this default
40- # post_status hook handler for the test.
41- status.hooks.install_named_hook('post_status',
42- status._show_shelve_summary,
43- 'bzr status')
44 self.assertStatus([
45 'added:\n',
46 ' bye.c\n',
47
48=== modified file 'doc/en/release-notes/bzr-2.3.txt'
49--- doc/en/release-notes/bzr-2.3.txt 2010-10-18 12:36:03 +0000
50+++ doc/en/release-notes/bzr-2.3.txt 2010-10-18 21:37:41 +0000
51@@ -46,6 +46,9 @@
52
53 * Always set PATH in start_bzr.bat on Windows. (Matthäus G. Chajdas, #470264)
54
55+* ``bzr status -r X..Y`` was failing because RevisionTree didn't implement
56+ ``get_shelf_manager``. (John Arbash Meinel, #662053)
57+
58 * Don't force openssh to use protocol=2, since that is now the default.
59 (Neil Martinsen-Burrell, #561061)
60