Merge lp:~mbp/bzr/492091-unshelve-keep into lp:bzr

Proposed by Martin Pool
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~mbp/bzr/492091-unshelve-keep
Merge into: lp:bzr
Diff against target: 109 lines (+36/-4)
5 files modified
NEWS (+3/-0)
bzrlib/builtins.py (+2/-1)
bzrlib/shelf_ui.py (+4/-1)
bzrlib/tests/blackbox/test_shelve.py (+24/-1)
bzrlib/tests/script.py (+3/-1)
To merge this branch: bzr merge lp:~mbp/bzr/492091-unshelve-keep
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+16001@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pool (mbp) wrote :

Adds 'unshelve --keep'. Thanks to Oscar Fuentes for research.

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

> Adds 'unshelve --keep'. Thanks to Oscar Fuentes for research.
... and, I should say, Dan Nicolaescu.

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

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

Martin Pool wrote:
> Martin Pool has proposed merging lp:~mbp/bzr/492091-unshelve-keep into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> #492091 Option for not removing shelve after `unshelve'
> https://bugs.launchpad.net/bugs/492091
>
>
> Adds 'unshelve --keep'. Thanks to Oscar Fuentes for research.
>

I'm impressed that all the internals were already hooked up for it.

 review: approve
 merge: approve

John
=:->

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

iEYEARECAAYFAksiAlQACgkQJdeBCYSNAAOXLACgvsOUBiiQK3af6pGYzaZlKMFU
0hgAn0hcgBaOMwVYjs/DiAVNezWRkH7x
=Tjx7
-----END PGP SIGNATURE-----

review: Approve

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-10 21:49:20 +0000
3+++ NEWS 2009-12-11 05:52:13 +0000
4@@ -26,6 +26,9 @@
5 * ``bzr commit`` now has a ``--commit-time`` option.
6 (Alexander Sack, #459276)
7
8+* New option ``bzr unshelve --keep`` applies the changes and leaves them
9+ on the shelf. (Martin Pool, Oscar Fuentes, #492091)
10+
11 * The ``BZR_COLUMNS`` envrionment variable can be set to force bzr to
12 respect a given terminal width. This can be useful when output is
13 redirected or in obscure cases where the default value is not
14
15=== modified file 'bzrlib/builtins.py'
16--- bzrlib/builtins.py 2009-12-09 08:38:02 +0000
17+++ bzrlib/builtins.py 2009-12-11 05:52:13 +0000
18@@ -5793,7 +5793,8 @@
19 enum_switch=False, value_switches=True,
20 apply="Apply changes and remove from the shelf.",
21 dry_run="Show changes, but do not apply or remove them.",
22- delete_only="Delete changes without applying them."
23+ delete_only="Delete changes without applying them.",
24+ keep="Apply changes but don't delete them.",
25 )
26 ]
27 _see_also = ['shelve']
28
29=== modified file 'bzrlib/shelf_ui.py'
30--- bzrlib/shelf_ui.py 2009-11-26 17:06:32 +0000
31+++ bzrlib/shelf_ui.py 2009-12-11 05:52:13 +0000
32@@ -414,9 +414,12 @@
33 if action == 'dry-run':
34 apply_changes = False
35 delete_shelf = False
36- if action == 'delete-only':
37+ elif action == 'delete-only':
38 apply_changes = False
39 read_shelf = False
40+ elif action == 'keep':
41+ apply_changes = True
42+ delete_shelf = False
43 except:
44 tree.unlock()
45 raise
46
47=== modified file 'bzrlib/tests/blackbox/test_shelve.py'
48--- bzrlib/tests/blackbox/test_shelve.py 2009-03-23 14:59:43 +0000
49+++ bzrlib/tests/blackbox/test_shelve.py 2009-12-11 05:52:13 +0000
50@@ -1,4 +1,4 @@
51-# Copyright (C) 2008 Canonical Ltd
52+# Copyright (C) 2008, 2009 Canonical Ltd
53 #
54 # This program is free software; you can redistribute it and/or modify
55 # it under the terms of the GNU General Public License as published by
56@@ -18,6 +18,8 @@
57
58 from bzrlib import shelf
59 from bzrlib.tests import TestCaseWithTransport
60+from bzrlib.tests.script import ScriptRunner
61+
62
63 class TestShelveList(TestCaseWithTransport):
64
65@@ -65,6 +67,27 @@
66 self.failIfExists('file')
67 self.assertIs(None, tree.get_shelf_manager().last_shelf())
68
69+ def test_unshelve_keep(self):
70+ # https://bugs.edge.launchpad.net/bzr/+bug/492091
71+ tree = self.make_branch_and_tree('.')
72+ # shelve apparently unhappy working with a tree with no root yet
73+ tree.commit('make root')
74+ self.build_tree(['file'])
75+
76+ sr = ScriptRunner()
77+ sr.run_script(self, '''
78+$ bzr add file
79+$ bzr shelve --all -m Foo
80+$ bzr shelve --list
81+ 1: Foo
82+$ bzr unshelve --keep
83+$ bzr shelve --list
84+ 1: Foo
85+$ cat file
86+contents of file
87+''')
88+
89+
90
91 class TestShelveRelpath(TestCaseWithTransport):
92
93
94=== modified file 'bzrlib/tests/script.py'
95--- bzrlib/tests/script.py 2009-11-08 20:28:36 +0000
96+++ bzrlib/tests/script.py 2009-12-11 05:52:13 +0000
97@@ -107,9 +107,11 @@
98 error = []
99 error.append(line[2:] + '\n')
100 else:
101+ # can happen if the first line is not recognized as a command, eg
102+ # if the prompt has leading whitespace
103 if output is None:
104 if cmd_cur is None:
105- raise SyntaxError('No command for that output',
106+ raise SyntaxError('No command for line %r' % (line,),
107 (file_name, lineno, 1, orig))
108 output = []
109 output.append(line + '\n')