Merge lp:~mathepic/bzr/remove-tree-multi into lp:bzr

Proposed by Jared Hance
Status: Merged
Merged at revision: not available
Proposed branch: lp:~mathepic/bzr/remove-tree-multi
Merge into: lp:bzr
Diff against target: 79 lines
2 files modified
NEWS (+3/-0)
bzrlib/builtins.py (+27/-22)
To merge this branch: bzr merge lp:~mathepic/bzr/remove-tree-multi
Reviewer Review Type Date Requested Status
Andrew Bennetts Needs Fixing
Ian Clatworthy Approve
Review via email: mp+13451@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jared Hance (mathepic) wrote :

This branch aims to add support for removing multiple working trees at once with "bzr remove-tree", fixing Bug #253137 (https://bugs.edge.launchpad.net/bzr/+bug/253137)

Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Nice. Thanks.

review: Approve
Revision history for this message
Andrew Bennetts (spiv) wrote :

This patch broke the existing blackbox tests for test_remove_tree. It turns out that you accidentally moved some code inside the "if not force:" block. I've fixed that and added a test. My branch is at lp:~spiv/bzr/remove-tree-multi-253137

All that's left is for you to sign the contributor agreement: <http://www.canonical.com/contributors>

review: Needs Fixing
Revision history for this message
Robert Collins (lifeless) wrote :

Mathepic, we're still waiting on your contributor agreement.

Ian, just a quick meta item- please don't mark whole merges 'approved' till they really are (perhaps you were exercising discretion here in which case you can ignore this meta comment of mine... but note that it broke tests :))

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2009-10-17 04:43:14 +0000
3+++ NEWS 2009-10-17 23:17:11 +0000
4@@ -22,6 +22,9 @@
5 Bug Fixes
6 *********
7
8+* Added support for removing multiple working trees to "bzr remove-tree"
9+ (Jared Hance, #253137)
10+
11 * TreeTransform.adjust_path updates the limbo paths of descendants of adjusted
12 files. (Aaron Bentley)
13
14
15=== modified file 'bzrlib/builtins.py'
16--- bzrlib/builtins.py 2009-10-12 22:09:19 +0000
17+++ bzrlib/builtins.py 2009-10-17 23:17:11 +0000
18@@ -446,34 +446,39 @@
19 To re-create the working tree, use "bzr checkout".
20 """
21 _see_also = ['checkout', 'working-trees']
22- takes_args = ['location?']
23+ takes_args = ['location*']
24 takes_options = [
25 Option('force',
26 help='Remove the working tree even if it has '
27 'uncommitted changes.'),
28 ]
29
30- def run(self, location='.', force=False):
31- d = bzrdir.BzrDir.open(location)
32-
33- try:
34- working = d.open_workingtree()
35- except errors.NoWorkingTree:
36- raise errors.BzrCommandError("No working tree to remove")
37- except errors.NotLocalUrl:
38- raise errors.BzrCommandError("You cannot remove the working tree"
39- " of a remote path")
40- if not force:
41- if (working.has_changes()):
42- raise errors.UncommittedChanges(working)
43-
44- working_path = working.bzrdir.root_transport.base
45- branch_path = working.branch.bzrdir.root_transport.base
46- if working_path != branch_path:
47- raise errors.BzrCommandError("You cannot remove the working tree"
48- " from a lightweight checkout")
49-
50- d.destroy_workingtree()
51+ def run(self, location_list, force=False):
52+
53+ if not location_list:
54+ location_list=['.']
55+
56+ for location in location_list:
57+ d = bzrdir.BzrDir.open(location)
58+
59+ try:
60+ working = d.open_workingtree()
61+ except errors.NoWorkingTree:
62+ raise errors.BzrCommandError("No working tree to remove")
63+ except errors.NotLocalUrl:
64+ raise errors.BzrCommandError("You cannot remove the working tree"
65+ " of a remote path")
66+ if not force:
67+ if (working.has_changes()):
68+ raise errors.UncommittedChanges(working)
69+
70+ working_path = working.bzrdir.root_transport.base
71+ branch_path = working.branch.bzrdir.root_transport.base
72+ if working_path != branch_path:
73+ raise errors.BzrCommandError("You cannot remove the working tree"
74+ " from a lightweight checkout")
75+
76+ d.destroy_workingtree()
77
78
79 class cmd_revno(Command):