Merge lp://staging/~nmb/bzr/fix-496917 into lp://staging/bzr

Proposed by Neil Martinsen-Burrell
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~nmb/bzr/fix-496917
Merge into: lp://staging/bzr
Diff against target: 109 lines (+51/-1)
3 files modified
NEWS (+6/-0)
bzrlib/shelf_ui.py (+2/-1)
bzrlib/tests/test_shelf_ui.py (+43/-0)
To merge this branch: bzr merge lp://staging/~nmb/bzr/fix-496917
Reviewer Review Type Date Requested Status
Martin Pool Approve
Alexander Belchenko Approve
Review via email: mp+16211@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

This adds better feedback to the unshelve command. When it reads the shelf, it prints out which shelf it is using and then if it does delete the shelf, it prints that it is deleting the shelf. With the four action options to unshelve, this covers all of the bases fairly well, I think. New shell-like tests in bzrlib/tests/blackbox/test_shelf_ui.py.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Thanks. I'll let the pilots and core devs to judge wording.

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

nice, and nice tests too

review: Approve
Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

On 2009-12-16 00:33 , Martin Pool wrote:
> Review: Approve
> nice, and nice tests too

Thanks there go to Vincent for the shell-like tests. They are
pitch-perfect for blackbox testing of things like this that have
complicated object-based APIs, but that we want to test holistically.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil Martinsen-Burrell wrote:
> On 2009-12-16 00:33 , Martin Pool wrote:
>> Review: Approve
>> nice, and nice tests too
>
> Thanks there go to Vincent for the shell-like tests. They are
> pitch-perfect for blackbox testing of things like this that have
> complicated object-based APIs, but that we want to test holistically.

One comment, I thought there was a:

self.run_script() helper, so you don't have to call script.ScriptRunner
directly. It would clean up the tests slightly, but probably worthwhile.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkso+yIACgkQJdeBCYSNAAPergCgy7b9Ys1bgyUkaP6JkqfICMBg
WaAAnicj4xH6aC6SBEiymCfQITlX9CAL
=ZBIB
-----END PGP SIGNATURE-----

Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

Now using TestCaseWithTransportAndScript. Should be ready for merging.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-12-16 10:54:55 +0000
3+++ NEWS 2009-12-16 16:00:31 +0000
4@@ -20,6 +20,7 @@
5 Bug Fixes
6 *********
7
8+<<<<<<< TREE
9 * Listen to the SIGWINCH signal to update the terminal width.
10 (Vincent Ladeuil, #316357)
11
12@@ -53,6 +54,11 @@
13 Bug Fixes
14 *********
15
16+=======
17+* ``bzr unshelve`` has improved messages about what it is doing.
18+ (Neil Martinsen-Burrell, #496917)
19+
20+>>>>>>> MERGE-SOURCE
21 Improvements
22 ************
23
24
25=== modified file 'bzrlib/shelf_ui.py'
26--- bzrlib/shelf_ui.py 2009-12-11 05:48:21 +0000
27+++ bzrlib/shelf_ui.py 2009-12-16 16:00:31 +0000
28@@ -407,7 +407,6 @@
29 shelf_id = manager.last_shelf()
30 if shelf_id is None:
31 raise errors.BzrCommandError('No changes are shelved.')
32- trace.note('Unshelving changes with id "%d".' % shelf_id)
33 apply_changes = True
34 delete_shelf = True
35 read_shelf = True
36@@ -452,6 +451,7 @@
37 cleanups = [self.tree.unlock]
38 try:
39 if self.read_shelf:
40+ trace.note('Using changes with id "%d".' % self.shelf_id)
41 unshelver = self.manager.get_unshelver(self.shelf_id)
42 cleanups.append(unshelver.finalize)
43 if unshelver.message is not None:
44@@ -469,6 +469,7 @@
45 task.finished()
46 if self.delete_shelf:
47 self.manager.delete_shelf(self.shelf_id)
48+ trace.note('Deleted changes with id "%d".' % self.shelf_id)
49 finally:
50 for cleanup in reversed(cleanups):
51 cleanup()
52
53=== modified file 'bzrlib/tests/test_shelf_ui.py'
54--- bzrlib/tests/test_shelf_ui.py 2009-10-23 03:35:32 +0000
55+++ bzrlib/tests/test_shelf_ui.py 2009-12-16 16:00:31 +0000
56@@ -25,6 +25,7 @@
57 revision,
58 tests,
59 )
60+from bzrlib.tests import script
61
62
63 class ExpectShelver(shelf_ui.Shelver):
64@@ -530,3 +531,45 @@
65 self.assertRaises(errors.InvalidShelfId,
66 shelf_ui.Unshelver.from_args, directory='tree',
67 action='delete-only', shelf_id='foo')
68+
69+
70+class TestUnshelveScripts(TestUnshelver,
71+ script.TestCaseWithTransportAndScript):
72+
73+ def test_unshelve_messages_keep(self):
74+ self.create_tree_with_shelf()
75+ self.run_script("""
76+$ cd tree
77+$ bzr unshelve --keep
78+2>Using changes with id "1".
79+2> M foo
80+2>All changes applied successfully.
81+""")
82+
83+ def test_unshelve_messages_delete(self):
84+ self.create_tree_with_shelf()
85+ self.run_script("""
86+$ cd tree
87+$ bzr unshelve --delete-only
88+2>Deleted changes with id "1".
89+""")
90+
91+ def test_unshelve_messages_apply(self):
92+ self.create_tree_with_shelf()
93+ self.run_script("""
94+$ cd tree
95+$ bzr unshelve --apply
96+2>Using changes with id "1".
97+2> M foo
98+2>All changes applied successfully.
99+2>Deleted changes with id "1".
100+""")
101+
102+ def test_unshelve_messages_dry_run(self):
103+ self.create_tree_with_shelf()
104+ self.run_script("""
105+$ cd tree
106+$ bzr unshelve --dry-run
107+2>Using changes with id "1".
108+2> M foo
109+""")