Rev 5032: (Jared Hance) 'bzr remove-tree' can now remove multiple working in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Feb 12 07:42:10 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5032 [merge]
revision-id: pqm at pqm.ubuntu.com-20100212074209-ih8sj193z5w0aw2f
parent: pqm at pqm.ubuntu.com-20100211114855-owq7q18cogsdbbpc
parent: andrew.bennetts at canonical.com-20100212043305-ujdbsdoviql2t7i3
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-02-12 07:42:09 +0000
message:
(Jared Hance) 'bzr remove-tree' can now remove multiple working
trees. (#253137)
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 2010-02-11 11:48:55 +0000
+++ b/NEWS 2010-02-12 04:33:05 +0000
@@ -59,6 +59,9 @@
* ``bzr add`` will not add conflict related files unless explicitly required.
(Vincent Ladeuil, #322767, #414589)
+* ``bzr remove-tree`` can now remove multiple working trees.
+ (Jared Hance, Andrew Bennetts, #253137)
+
* Network transfer amounts and rates are now displayed in SI units according
to the Ubuntu Units Policy <https://wiki.ubuntu.com/UnitsPolicy>.
(Gordon Tyler, #514399)
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2010-02-11 09:27:55 +0000
+++ b/bzrlib/builtins.py 2010-02-12 04:33:05 +0000
@@ -453,34 +453,38 @@
To re-create the working tree, use "bzr checkout".
"""
_see_also = ['checkout', 'working-trees']
- takes_args = ['location?']
+ takes_args = ['location*']
takes_options = [
Option('force',
help='Remove the working tree even if it has '
'uncommitted changes.'),
]
- def run(self, location='.', force=False):
- d = bzrdir.BzrDir.open(location)
-
- try:
- working = d.open_workingtree()
- except errors.NoWorkingTree:
- raise errors.BzrCommandError("No working tree to remove")
- except errors.NotLocalUrl:
- raise errors.BzrCommandError("You cannot remove the working tree"
- " of a remote path")
- if not force:
- if (working.has_changes()):
- raise errors.UncommittedChanges(working)
-
- working_path = working.bzrdir.root_transport.base
- branch_path = working.branch.bzrdir.root_transport.base
- if working_path != branch_path:
- raise errors.BzrCommandError("You cannot remove the working tree"
- " from a lightweight checkout")
-
- d.destroy_workingtree()
+ def run(self, location_list, force=False):
+ if not location_list:
+ location_list=['.']
+
+ for location in location_list:
+ d = bzrdir.BzrDir.open(location)
+
+ try:
+ working = d.open_workingtree()
+ except errors.NoWorkingTree:
+ raise errors.BzrCommandError("No working tree to remove")
+ except errors.NotLocalUrl:
+ raise errors.BzrCommandError("You cannot remove the working tree"
+ " of a remote path")
+ if not force:
+ if (working.has_changes()):
+ raise errors.UncommittedChanges(working)
+
+ working_path = working.bzrdir.root_transport.base
+ branch_path = working.branch.bzrdir.root_transport.base
+ if working_path != branch_path:
+ raise errors.BzrCommandError("You cannot remove the working tree"
+ " from a lightweight checkout")
+
+ d.destroy_workingtree()
class cmd_revno(Command):
=== modified file 'bzrlib/tests/blackbox/test_remove_tree.py'
--- a/bzrlib/tests/blackbox/test_remove_tree.py 2009-09-08 16:45:11 +0000
+++ b/bzrlib/tests/blackbox/test_remove_tree.py 2009-11-16 05:57:00 +0000
@@ -43,6 +43,12 @@
self.run_bzr('remove-tree branch1')
self.failIfExists('branch1/foo')
+ def test_remove_tree_multiple_branch_explicit(self):
+ self.tree.bzrdir.sprout('branch2')
+ self.run_bzr('remove-tree branch1 branch2')
+ self.failIfExists('branch1/foo')
+ self.failIfExists('branch2/foo')
+
def test_remove_tree_sprouted_branch(self):
self.tree.bzrdir.sprout('branch2')
self.failUnlessExists('branch2/foo')
More information about the bazaar-commits
mailing list