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
=== modified file 'NEWS'
--- NEWS 2009-12-10 21:49:20 +0000
+++ NEWS 2009-12-11 05:52:13 +0000
@@ -26,6 +26,9 @@
26* ``bzr commit`` now has a ``--commit-time`` option.26* ``bzr commit`` now has a ``--commit-time`` option.
27 (Alexander Sack, #459276)27 (Alexander Sack, #459276)
2828
29* New option ``bzr unshelve --keep`` applies the changes and leaves them
30 on the shelf. (Martin Pool, Oscar Fuentes, #492091)
31
29* The ``BZR_COLUMNS`` envrionment variable can be set to force bzr to32* The ``BZR_COLUMNS`` envrionment variable can be set to force bzr to
30 respect a given terminal width. This can be useful when output is33 respect a given terminal width. This can be useful when output is
31 redirected or in obscure cases where the default value is not34 redirected or in obscure cases where the default value is not
3235
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py 2009-12-09 08:38:02 +0000
+++ bzrlib/builtins.py 2009-12-11 05:52:13 +0000
@@ -5793,7 +5793,8 @@
5793 enum_switch=False, value_switches=True,5793 enum_switch=False, value_switches=True,
5794 apply="Apply changes and remove from the shelf.",5794 apply="Apply changes and remove from the shelf.",
5795 dry_run="Show changes, but do not apply or remove them.",5795 dry_run="Show changes, but do not apply or remove them.",
5796 delete_only="Delete changes without applying them."5796 delete_only="Delete changes without applying them.",
5797 keep="Apply changes but don't delete them.",
5797 )5798 )
5798 ]5799 ]
5799 _see_also = ['shelve']5800 _see_also = ['shelve']
58005801
=== modified file 'bzrlib/shelf_ui.py'
--- bzrlib/shelf_ui.py 2009-11-26 17:06:32 +0000
+++ bzrlib/shelf_ui.py 2009-12-11 05:52:13 +0000
@@ -414,9 +414,12 @@
414 if action == 'dry-run':414 if action == 'dry-run':
415 apply_changes = False415 apply_changes = False
416 delete_shelf = False416 delete_shelf = False
417 if action == 'delete-only':417 elif action == 'delete-only':
418 apply_changes = False418 apply_changes = False
419 read_shelf = False419 read_shelf = False
420 elif action == 'keep':
421 apply_changes = True
422 delete_shelf = False
420 except:423 except:
421 tree.unlock()424 tree.unlock()
422 raise425 raise
423426
=== modified file 'bzrlib/tests/blackbox/test_shelve.py'
--- bzrlib/tests/blackbox/test_shelve.py 2009-03-23 14:59:43 +0000
+++ bzrlib/tests/blackbox/test_shelve.py 2009-12-11 05:52:13 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2008 Canonical Ltd1# Copyright (C) 2008, 2009 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -18,6 +18,8 @@
1818
19from bzrlib import shelf19from bzrlib import shelf
20from bzrlib.tests import TestCaseWithTransport20from bzrlib.tests import TestCaseWithTransport
21from bzrlib.tests.script import ScriptRunner
22
2123
22class TestShelveList(TestCaseWithTransport):24class TestShelveList(TestCaseWithTransport):
2325
@@ -65,6 +67,27 @@
65 self.failIfExists('file')67 self.failIfExists('file')
66 self.assertIs(None, tree.get_shelf_manager().last_shelf())68 self.assertIs(None, tree.get_shelf_manager().last_shelf())
6769
70 def test_unshelve_keep(self):
71 # https://bugs.edge.launchpad.net/bzr/+bug/492091
72 tree = self.make_branch_and_tree('.')
73 # shelve apparently unhappy working with a tree with no root yet
74 tree.commit('make root')
75 self.build_tree(['file'])
76
77 sr = ScriptRunner()
78 sr.run_script(self, '''
79$ bzr add file
80$ bzr shelve --all -m Foo
81$ bzr shelve --list
82 1: Foo
83$ bzr unshelve --keep
84$ bzr shelve --list
85 1: Foo
86$ cat file
87contents of file
88''')
89
90
6891
69class TestShelveRelpath(TestCaseWithTransport):92class TestShelveRelpath(TestCaseWithTransport):
7093
7194
=== modified file 'bzrlib/tests/script.py'
--- bzrlib/tests/script.py 2009-11-08 20:28:36 +0000
+++ bzrlib/tests/script.py 2009-12-11 05:52:13 +0000
@@ -107,9 +107,11 @@
107 error = []107 error = []
108 error.append(line[2:] + '\n')108 error.append(line[2:] + '\n')
109 else:109 else:
110 # can happen if the first line is not recognized as a command, eg
111 # if the prompt has leading whitespace
110 if output is None:112 if output is None:
111 if cmd_cur is None:113 if cmd_cur is None:
112 raise SyntaxError('No command for that output',114 raise SyntaxError('No command for line %r' % (line,),
113 (file_name, lineno, 1, orig))115 (file_name, lineno, 1, orig))
114 output = []116 output = []
115 output.append(line + '\n')117 output.append(line + '\n')