Rev 4892: (mbp) add unshelve --keep in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Dec 14 09:31:22 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4892 [merge]
revision-id: pqm at pqm.ubuntu.com-20091214093120-s9xi50yxgx12vumr
parent: pqm at pqm.ubuntu.com-20091214065227-yx76sxslanytwp6r
parent: mbp at sourcefrog.net-20091211054821-wolkr2xhx5xt37je
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2009-12-14 09:31:20 +0000
message:
  (mbp) add unshelve --keep
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/shelf_ui.py             shelver.py-20081005210102-33worgzwrtdw0yrm-1
  bzrlib/tests/blackbox/test_shelve.py test_ls_shelf.py-20081202053526-thlo8yt0pi1cgor1-1
  bzrlib/tests/script.py         script.py-20090901081155-yk3tiy1nunxg16ne-1
=== modified file 'NEWS'
--- a/NEWS	2009-12-14 06:05:30 +0000
+++ b/NEWS	2009-12-14 09:31:20 +0000
@@ -26,6 +26,9 @@
 * ``bzr commit`` now has a ``--commit-time`` option.
   (Alexander Sack, #459276)
 
+* New option ``bzr unshelve --keep`` applies the changes and leaves them
+  on the shelf.  (Martin Pool, Oscar Fuentes, #492091)
+
 * The ``BZR_COLUMNS`` envrionment variable can be set to force bzr to
   respect a given terminal width. This can be useful when output is
   redirected or in obscure cases where the default value is not

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-12-09 08:38:02 +0000
+++ b/bzrlib/builtins.py	2009-12-11 05:48:21 +0000
@@ -5793,7 +5793,8 @@
             enum_switch=False, value_switches=True,
             apply="Apply changes and remove from the shelf.",
             dry_run="Show changes, but do not apply or remove them.",
-            delete_only="Delete changes without applying them."
+            delete_only="Delete changes without applying them.",
+            keep="Apply changes but don't delete them.",
         )
     ]
     _see_also = ['shelve']

=== modified file 'bzrlib/shelf_ui.py'
--- a/bzrlib/shelf_ui.py	2009-11-26 17:06:32 +0000
+++ b/bzrlib/shelf_ui.py	2009-12-11 05:48:21 +0000
@@ -414,9 +414,12 @@
             if action == 'dry-run':
                 apply_changes = False
                 delete_shelf = False
-            if action == 'delete-only':
+            elif action == 'delete-only':
                 apply_changes = False
                 read_shelf = False
+            elif action == 'keep':
+                apply_changes = True
+                delete_shelf = False
         except:
             tree.unlock()
             raise

=== modified file 'bzrlib/tests/blackbox/test_shelve.py'
--- a/bzrlib/tests/blackbox/test_shelve.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_shelve.py	2009-12-11 05:48:21 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Canonical Ltd
+# Copyright (C) 2008, 2009 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -18,6 +18,8 @@
 
 from bzrlib import shelf
 from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests.script import ScriptRunner
+
 
 class TestShelveList(TestCaseWithTransport):
 
@@ -65,6 +67,27 @@
         self.failIfExists('file')
         self.assertIs(None, tree.get_shelf_manager().last_shelf())
 
+    def test_unshelve_keep(self):
+        # https://bugs.edge.launchpad.net/bzr/+bug/492091
+        tree = self.make_branch_and_tree('.')
+        # shelve apparently unhappy working with a tree with no root yet
+        tree.commit('make root')
+        self.build_tree(['file'])
+
+        sr = ScriptRunner()
+        sr.run_script(self, '''
+$ bzr add file
+$ bzr shelve --all -m Foo
+$ bzr shelve --list
+  1: Foo
+$ bzr unshelve --keep
+$ bzr shelve --list
+  1: Foo
+$ cat file
+contents of file
+''')
+
+
 
 class TestShelveRelpath(TestCaseWithTransport):
 

=== modified file 'bzrlib/tests/script.py'
--- a/bzrlib/tests/script.py	2009-11-08 20:28:36 +0000
+++ b/bzrlib/tests/script.py	2009-12-11 05:29:35 +0000
@@ -107,9 +107,11 @@
                 error = []
             error.append(line[2:] + '\n')
         else:
+            # can happen if the first line is not recognized as a command, eg
+            # if the prompt has leading whitespace
             if output is None:
                 if cmd_cur is None:
-                    raise SyntaxError('No command for that output',
+                    raise SyntaxError('No command for line %r' % (line,),
                                       (file_name, lineno, 1, orig))
                 output = []
             output.append(line + '\n')




More information about the bazaar-commits mailing list