Rev 5465: (vila) add 'bzr rm --no-backup' and deprecate the --force opting to be in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 7 10:59:47 BST 2010


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

------------------------------------------------------------
revno: 5465 [merge]
revision-id: pqm at pqm.ubuntu.com-20101007095940-gxv0029giim7oti3
parent: pqm at pqm.ubuntu.com-20101007075509-u808nnwozm7hlt2x
parent: marius.kruger at enerweb.co.za-20101002181006-yl1vvwor52ttr6fe
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2010-10-07 10:59:40 +0100
message:
  (vila) add 'bzr rm --no-backup' and deprecate the --force opting to be
   consitent with revert (Marius Kruger)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_remove.py test_remove.py-20060530011439-fika5rm84lon0goe-1
=== modified file 'NEWS'
--- a/NEWS	2010-10-07 07:55:09 +0000
+++ b/NEWS	2010-10-07 09:59:40 +0000
@@ -60,6 +60,11 @@
 Improvements
 ************
 
+* ``bzr remove`` now takes a ``--no-backup`` option for when you don't want it
+  to backup anything, just delete it. This option used to be called ``--force``
+  which is now deprecated.
+  (Marius Kruger, #400554)
+
 Documentation
 *************
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2010-10-06 04:14:52 +0000
+++ b/bzrlib/builtins.py	2010-10-07 09:59:40 +0000
@@ -1507,13 +1507,20 @@
             title='Deletion Strategy', value_switches=True, enum_switch=False,
             safe='Backup changed files (default).',
             keep='Delete from bzr but leave the working copy.',
+            no_backup='Don\'t backup changed files.',
             force='Delete all the specified files, even if they can not be '
-                'recovered and even if they are non-empty directories.')]
+                'recovered and even if they are non-empty directories. '
+                '(deprecated, use no-backup)')]
     aliases = ['rm', 'del']
     encoding_type = 'replace'
 
     def run(self, file_list, verbose=False, new=False,
         file_deletion_strategy='safe'):
+        if file_deletion_strategy == 'force':
+            note("(The --force option is deprecated, rather use --no-backup "
+                "in future.)")
+            file_deletion_strategy = 'no-backup'
+
         tree, file_list = WorkingTree.open_containing_paths(file_list)
 
         if file_list is not None:
@@ -1540,7 +1547,7 @@
             file_deletion_strategy = 'keep'
         tree.remove(file_list, verbose=verbose, to_file=self.outf,
             keep_files=file_deletion_strategy=='keep',
-            force=file_deletion_strategy=='force')
+            force=(file_deletion_strategy=='no-backup'))
 
 
 class cmd_file_id(Command):

=== modified file 'bzrlib/tests/blackbox/test_remove.py'
--- a/bzrlib/tests/blackbox/test_remove.py	2010-07-09 23:09:39 +0000
+++ b/bzrlib/tests/blackbox/test_remove.py	2010-10-02 18:10:06 +0000
@@ -18,8 +18,12 @@
 import os
 import sys
 
-from bzrlib.tests import SymlinkFeature, TestSkipped
-from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests import (
+    script,
+    SymlinkFeature,
+    TestCaseWithTransport,
+    TestSkipped,
+    )
 from bzrlib.workingtree import WorkingTree
 from bzrlib import osutils
 
@@ -200,12 +204,29 @@
         self.run_bzr('remove --keep a', error_regexes=["a is not versioned."])
         self.assertFilesUnversioned(files)
 
+    def test_remove_no_backup_unversioned_files(self):
+        self.build_tree(files)
+        tree = self.make_branch_and_tree('.')
+        script.ScriptRunner().run_script(self, '''
+        $ bzr remove --no-backup a b/ b/c d/
+        2>deleted d
+        2>removed b/c (but kept a copy: b/c.~1~)
+        2>deleted b
+        2>deleted a
+        ''')
+        self.assertFilesDeleted(files)
+
     def test_remove_force_unversioned_files(self):
         self.build_tree(files)
         tree = self.make_branch_and_tree('.')
-        self.run_bzr(['remove', '--force'] + list(files),
-                     error_regexes=["deleted a", "deleted b",
-                                    "removed b/c", "deleted d"])
+        script.ScriptRunner().run_script(self, '''
+        $ bzr remove --force a b/ b/c d/
+        2>(The --force option is deprecated, rather use --no-backup in future.)
+        2>deleted d
+        2>removed b/c (but kept a copy: b/c.~1~)
+        2>deleted b
+        2>deleted a
+        ''')
         self.assertFilesDeleted(files)
 
     def test_remove_deleted_files(self):




More information about the bazaar-commits mailing list