Rev 3719: make halt on uncommitted changes (luks) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Sun Sep 21 02:21:10 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3719
revision-id: pqm at pqm.ubuntu.com-20080921012105-ote1u11mokjim9ir
parent: pqm at pqm.ubuntu.com-20080920200119-5q2m3kn9foc56quu
parent: lalinsky at gmail.com-20080831065142-dmj7vbnryqqid1tb
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
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: lalinsky at gmail.com-20080831065142-dmj7vbnryqqid1tb
parent: pqm at pqm.ubuntu.com-20080829214033-n9tclw44g7b42hsc
committer: Lukáš Lalinský <lalinsky at gmail.com>
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')
More information about the bazaar-commits
mailing list