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
=== modified file 'bzrlib/status.py'
--- bzrlib/status.py 2011-11-30 01:11:33 +0000
+++ bzrlib/status.py 2011-11-30 01:11:33 +0000
@@ -453,6 +453,10 @@
453453
454 :param params: StatusHookParams.454 :param params: StatusHookParams.
455 """455 """
456 # Don't show shelves if status of specific files is being shown, only if
457 # no file arguments have been passed
458 if params.specific_files:
459 return
456 get_shelf_manager = getattr(params.new_tree, 'get_shelf_manager', None)460 get_shelf_manager = getattr(params.new_tree, 'get_shelf_manager', None)
457 if get_shelf_manager is None:461 if get_shelf_manager is None:
458 return462 return
459463
=== modified file 'bzrlib/tests/blackbox/test_status.py'
--- bzrlib/tests/blackbox/test_status.py 2011-06-03 08:45:36 +0000
+++ bzrlib/tests/blackbox/test_status.py 2011-11-30 01:11:33 +0000
@@ -53,24 +53,25 @@
53 status._show_shelve_summary,53 status._show_shelve_summary,
54 'bzr status')54 'bzr status')
5555
56 def assertStatus(self, expected_lines, working_tree,56 def assertStatus(self, expected_lines, working_tree, specific_files=None,
57 revision=None, short=False, pending=True, verbose=False):57 revision=None, short=False, pending=True, verbose=False):
58 """Run status in working_tree and look for output.58 """Run status in working_tree and look for output.
5959
60 :param expected_lines: The lines to look for.60 :param expected_lines: The lines to look for.
61 :param working_tree: The tree to run status in.61 :param working_tree: The tree to run status in.
62 """62 """
63 output_string = self.status_string(working_tree, revision, short,63 output_string = self.status_string(working_tree, specific_files, revision, short,
64 pending, verbose)64 pending, verbose)
65 self.assertEqual(expected_lines, output_string.splitlines(True))65 self.assertEqual(expected_lines, output_string.splitlines(True))
6666
67 def status_string(self, wt, revision=None, short=False, pending=True,67 def status_string(self, wt, specific_files=None, revision=None,
68 verbose=False):68 short=False, pending=True, verbose=False):
69 # use a real file rather than StringIO because it doesn't handle69 # use a real file rather than StringIO because it doesn't handle
70 # Unicode very well.70 # Unicode very well.
71 tof = codecs.getwriter('utf-8')(TemporaryFile())71 tof = codecs.getwriter('utf-8')(TemporaryFile())
72 show_tree_status(wt, to_file=tof, revision=revision, short=short,72 show_tree_status(wt, specific_files=specific_files, to_file=tof,
73 show_pending=pending, verbose=verbose)73 revision=revision, short=short, show_pending=pending,
74 verbose=verbose)
74 tof.seek(0)75 tof.seek(0)
75 return tof.read().decode('utf-8')76 return tof.read().decode('utf-8')
7677
@@ -569,14 +570,22 @@
569 ],570 ],
570 wt)571 wt)
571 self.run_bzr(['shelve', '--all', '-m', 'bar'])572 self.run_bzr(['shelve', '--all', '-m', 'bar'])
572 self.build_tree(['spam.c'])573 self.build_tree(['eggs.c', 'spam.c'])
574 wt.add('eggs.c')
573 wt.add('spam.c')575 wt.add('spam.c')
574 self.assertStatus([576 self.assertStatus([
575 'added:\n',577 'added:\n',
578 ' eggs.c\n',
576 ' spam.c\n',579 ' spam.c\n',
577 '2 shelves exist. See "bzr shelve --list" for details.\n',580 '2 shelves exist. See "bzr shelve --list" for details.\n',
578 ],581 ],
579 wt)582 wt)
583 self.assertStatus([
584 'added:\n',
585 ' spam.c\n',
586 ],
587 wt,
588 specific_files=['spam.c'])
580589
581590
582class CheckoutStatus(BranchStatus):591class CheckoutStatus(BranchStatus):
583592
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- doc/en/release-notes/bzr-2.5.txt 2011-11-29 12:57:56 +0000
+++ doc/en/release-notes/bzr-2.5.txt 2011-11-30 01:11:33 +0000
@@ -46,6 +46,9 @@
46* Plugins can now register additional "location aliases".46* Plugins can now register additional "location aliases".
47 (Jelmer Vernooij)47 (Jelmer Vernooij)
4848
49* ``bzr status`` no longer shows shelves if files are specified.
50 (Francis Devereux)
51
49Bug Fixes52Bug Fixes
50*********53*********
5154