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

------------------------------------------------------------
revno: 3719
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Canonical.com Patch Queue Manager <[EMAIL PROTECTED]>
branch nick: +trunk
timestamp: Sun 2008-09-21 02:21:05 +0100
message:
  make  halt on uncommitted changes (luks)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_remove_tree.py 
test_remove_tree.py-20061110192919-5j3xjciiaqbs2dvo-1
    ------------------------------------------------------------
    revno: 3667.2.1
    revision-id: [EMAIL PROTECTED]
    parent: [EMAIL PROTECTED]
    committer: Lukáš Lalinský <[EMAIL PROTECTED]>
    branch nick: remove_tree_changed_wt
    timestamp: Sun 2008-08-31 08:51:42 +0200
    message:
      Make `bzr remove-tree` not remove trees with uncommitted changes by 
default
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/tests/blackbox/test_remove_tree.py 
test_remove_tree.py-20061110192919-5j3xjciiaqbs2dvo-1
=== modified file 'NEWS'
--- a/NEWS      2008-09-20 19:31:18 +0000
+++ b/NEWS      2008-09-21 01:21:05 +0000
@@ -95,6 +95,10 @@
     * ``bzr export`` can now export a subdirectory of a project.
       (Robert Collins)
 
+    * ``bzr remove-tree`` will now refuse to remove a tree with uncommitted
+      changes, unless the ``--force`` option is specified.
+      (Lukáš Lalinský, #74101)
+
     * ``bzr rm`` will now scan for files that are missing and remove just
       them automatically, much as ``bzr add`` scans for new files that
       are not ignored and adds them automatically. (Robert Collins)

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py        2008-09-20 18:41:58 +0000
+++ b/bzrlib/builtins.py        2008-09-21 01:21:05 +0000
@@ -250,10 +250,14 @@
     To re-create the working tree, use "bzr checkout".
     """
     _see_also = ['checkout', 'working-trees']
-
     takes_args = ['location?']
+    takes_options = [
+        Option('force',
+               help='Remove the working tree even if it has '
+                    'uncommitted changes.'),
+        ]
 
-    def run(self, location='.'):
+    def run(self, location='.', force=False):
         d = bzrdir.BzrDir.open(location)
         
         try:
@@ -263,7 +267,11 @@
         except errors.NotLocalUrl:
             raise errors.BzrCommandError("You cannot remove the working tree 
of a "
                                          "remote path")
-        
+        if not force:
+            changes = working.changes_from(working.basis_tree())
+            if changes.has_changed():
+                raise errors.UncommittedChanges(working)
+
         working_path = working.bzrdir.root_transport.base
         branch_path = working.branch.bzrdir.root_transport.base
         if working_path != branch_path:

=== modified file 'bzrlib/tests/blackbox/test_remove_tree.py'
--- a/bzrlib/tests/blackbox/test_remove_tree.py 2007-06-26 20:32:49 +0000
+++ b/bzrlib/tests/blackbox/test_remove_tree.py 2008-08-31 06:51:42 +0000
@@ -109,3 +109,16 @@
     def test_remove_tree_remote_path(self):
         # TODO: I can't think of a way to implement this...
         pass
+
+    def test_remove_tree_uncommitted_changes(self):
+        self.build_tree(['branch1/bar'])
+        self.tree.add('bar')
+        output = self.run_bzr_error(["Working tree .* has uncommitted 
changes"],
+                                    'remove-tree branch1', retcode=3)
+
+    def test_remove_tree_uncommitted_changes_force(self):
+        self.build_tree(['branch1/bar'])
+        self.tree.add('bar')
+        self.run_bzr('remove-tree branch1 --force')
+        self.failIfExists('branch1/foo')
+        self.failUnlessExists('branch1/bar')


-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to