Merge lp:~frankoid/bzr/status-shelve-message into lp:bzr

Proposed by Martin Pool
Status: Merged
Approved by: Martin Pool
Approved revision: no longer in the source branch.
Merged at revision: 6339
Proposed branch: lp:~frankoid/bzr/status-shelve-message
Merge into: lp:bzr
Prerequisite: lp:~frankoid/bzr/status-hook-params-specific-files
Diff against target: 87 lines (+23/-7)
3 files modified
bzrlib/status.py (+4/-0)
bzrlib/tests/blackbox/test_status.py (+16/-7)
doc/en/release-notes/bzr-2.5.txt (+3/-0)
To merge this branch: bzr merge lp:~frankoid/bzr/status-shelve-message
Reviewer Review Type Date Requested Status
Martin Pool Pending
Review via email: mp+83884@code.launchpad.net

This proposal supersedes a proposal from 2011-11-18.

Commit message

don't show shelf info when status is asked about specific files

Description of the change

Make "bzr status" only output the "x shelves exist" message when no files are specified.

If you run a plain "bzr status" then you are asking bzr about the status of the whole tree, so it is reasonable for it to report shelves, but if you run "bzr status myfile" then you are just asking it about the status of myfile, so it shouldn't tell you about shelves. Also, this change will prevent the annoying Emacs warnings that happen when you visit a file inside a branch with shelves.

If a file is specified and that file is in a shelve then the shelves message is still not output. This behaviour is to keep "bzr status" fast and to keep the logic simple (there has been some discussion about this on the <email address hidden>).

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote : Posted in a previous version of this proposal

Hi Francis,

There seem to be two parts to this change:

1) passing the specified_files to all the post_status hooks
2) changing the behaviour of one of the post_status hooks, which reports shelve status

(1) seems like a good idea in any case.

Perhaps it would make sense to split this branch up into two. The hook changes should be able to land pretty quickly, the second (in whatever form) can land once we decide on the correct behaviour for status when a file is specified.

(personally, I would prefer to keep the existing behaviour of "bzr status FILE" reporting shelves, but let's keep that discussion on the mailing list - I'll follow up there)

Revision history for this message
Francis Devereux (frankoid) wrote : Posted in a previous version of this proposal

Hi Jelmer,

I've separated (1) into lp:~frankoid/bzr/status-hook-params-specific-files

So far nobody on the mailing list has objected to "bzr status FILE" not reporting shelves as long as FILE isn't in a shelf, and most people seemed to want it to not report shelves in that case too, so it would be good to hear your thoughts on the mailing list.

Thanks,

Francis

Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

I think this is an improvement as it is. I won't send it right away, so Jelmer can have his say if he wants to. Thanks, frankoid.

review: Approve
Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

Francis, could you please do the Canonical contributor agreement at http://canonical.com/contributors

Revision history for this message
Francis Devereux (frankoid) wrote : Posted in a previous version of this proposal

I think I signed the Canonical contributor agreement last week (on the 24th of November). Let me know if I need to try again.

Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

Thanks, Francis.

Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

Could you please merge up trunk and fix the conflicts? Also it may be worth mentioning in the news that there is new information available to the hooks.

Revision history for this message
Francis Devereux (frankoid) wrote : Posted in a previous version of this proposal

I've merged from trunk and fixed the conflicts.

I separated out the new attribute of StatusHookParams into its own branch and merge proposal at https://code.launchpad.net/~frankoid/bzr/status-hook-params-specific-files/+merge/82930, and that branch has release notes and more tests. I thought it might be good to mark this MP as depending on 82930, but I couldn't find a way to do so (it looked like I could only indicate dependencies when creating a merge proposal, not afterwards). I can merge the other branch into this one if you like.

On 30 Nov 2011, at 00:50, Martin Pool wrote:

> Could you please merge up trunk and fix the conflicts? Also it may be worth mentioning in the news that there is new information available to the hooks.
> --
> https://code.launchpad.net/~frankoid/bzr/status-shelve-message/+merge/82728
> You are the owner of lp:~frankoid/bzr/status-shelve-message.
>

Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

You can change the prerequisite branch by clicking 'resubmit' -
there's no need to do that now though,I'll just send both.

Revision history for this message
Francis Devereux (frankoid) wrote : Posted in a previous version of this proposal

Thanks :-)

Martin Pool <email address hidden> wrote:

You can change the prerequisite branch by clicking 'resubmit' -
there's no need to do that now though,I'll just send both.

--
https://code.launchpad.net/~frankoid/bzr/status-shelve-message/+merge/82728
You are the owner of lp:~frankoid/bzr/status-shelve-message.

Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

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 2011-11-30 01:11:33 +0000
3+++ bzrlib/status.py 2011-11-30 01:11:33 +0000
4@@ -453,6 +453,10 @@
5
6 :param params: StatusHookParams.
7 """
8+ # Don't show shelves if status of specific files is being shown, only if
9+ # no file arguments have been passed
10+ if params.specific_files:
11+ return
12 get_shelf_manager = getattr(params.new_tree, 'get_shelf_manager', None)
13 if get_shelf_manager is None:
14 return
15
16=== modified file 'bzrlib/tests/blackbox/test_status.py'
17--- bzrlib/tests/blackbox/test_status.py 2011-06-03 08:45:36 +0000
18+++ bzrlib/tests/blackbox/test_status.py 2011-11-30 01:11:33 +0000
19@@ -53,24 +53,25 @@
20 status._show_shelve_summary,
21 'bzr status')
22
23- def assertStatus(self, expected_lines, working_tree,
24+ def assertStatus(self, expected_lines, working_tree, specific_files=None,
25 revision=None, short=False, pending=True, verbose=False):
26 """Run status in working_tree and look for output.
27
28 :param expected_lines: The lines to look for.
29 :param working_tree: The tree to run status in.
30 """
31- output_string = self.status_string(working_tree, revision, short,
32+ output_string = self.status_string(working_tree, specific_files, revision, short,
33 pending, verbose)
34 self.assertEqual(expected_lines, output_string.splitlines(True))
35
36- def status_string(self, wt, revision=None, short=False, pending=True,
37- verbose=False):
38+ def status_string(self, wt, specific_files=None, revision=None,
39+ short=False, pending=True, verbose=False):
40 # use a real file rather than StringIO because it doesn't handle
41 # Unicode very well.
42 tof = codecs.getwriter('utf-8')(TemporaryFile())
43- show_tree_status(wt, to_file=tof, revision=revision, short=short,
44- show_pending=pending, verbose=verbose)
45+ show_tree_status(wt, specific_files=specific_files, to_file=tof,
46+ revision=revision, short=short, show_pending=pending,
47+ verbose=verbose)
48 tof.seek(0)
49 return tof.read().decode('utf-8')
50
51@@ -569,14 +570,22 @@
52 ],
53 wt)
54 self.run_bzr(['shelve', '--all', '-m', 'bar'])
55- self.build_tree(['spam.c'])
56+ self.build_tree(['eggs.c', 'spam.c'])
57+ wt.add('eggs.c')
58 wt.add('spam.c')
59 self.assertStatus([
60 'added:\n',
61+ ' eggs.c\n',
62 ' spam.c\n',
63 '2 shelves exist. See "bzr shelve --list" for details.\n',
64 ],
65 wt)
66+ self.assertStatus([
67+ 'added:\n',
68+ ' spam.c\n',
69+ ],
70+ wt,
71+ specific_files=['spam.c'])
72
73
74 class CheckoutStatus(BranchStatus):
75
76=== modified file 'doc/en/release-notes/bzr-2.5.txt'
77--- doc/en/release-notes/bzr-2.5.txt 2011-11-29 12:57:56 +0000
78+++ doc/en/release-notes/bzr-2.5.txt 2011-11-30 01:11:33 +0000
79@@ -46,6 +46,9 @@
80 * Plugins can now register additional "location aliases".
81 (Jelmer Vernooij)
82
83+* ``bzr status`` no longer shows shelves if files are specified.
84+ (Francis Devereux)
85+
86 Bug Fixes
87 *********
88