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
=== modified file 'NEWS'
--- NEWS 2009-10-17 04:43:14 +0000
+++ NEWS 2009-10-17 23:17:11 +0000
@@ -22,6 +22,9 @@
22Bug Fixes22Bug Fixes
23*********23*********
2424
25* Added support for removing multiple working trees to "bzr remove-tree"
26 (Jared Hance, #253137)
27
25* TreeTransform.adjust_path updates the limbo paths of descendants of adjusted28* TreeTransform.adjust_path updates the limbo paths of descendants of adjusted
26 files. (Aaron Bentley)29 files. (Aaron Bentley)
2730
2831
=== modified file 'bzrlib/builtins.py'
--- bzrlib/builtins.py 2009-10-12 22:09:19 +0000
+++ bzrlib/builtins.py 2009-10-17 23:17:11 +0000
@@ -446,34 +446,39 @@
446 To re-create the working tree, use "bzr checkout".446 To re-create the working tree, use "bzr checkout".
447 """447 """
448 _see_also = ['checkout', 'working-trees']448 _see_also = ['checkout', 'working-trees']
449 takes_args = ['location?']449 takes_args = ['location*']
450 takes_options = [450 takes_options = [
451 Option('force',451 Option('force',
452 help='Remove the working tree even if it has '452 help='Remove the working tree even if it has '
453 'uncommitted changes.'),453 'uncommitted changes.'),
454 ]454 ]
455455
456 def run(self, location='.', force=False):456 def run(self, location_list, force=False):
457 d = bzrdir.BzrDir.open(location)457
458458 if not location_list:
459 try:459 location_list=['.']
460 working = d.open_workingtree()460
461 except errors.NoWorkingTree:461 for location in location_list:
462 raise errors.BzrCommandError("No working tree to remove")462 d = bzrdir.BzrDir.open(location)
463 except errors.NotLocalUrl:463
464 raise errors.BzrCommandError("You cannot remove the working tree"464 try:
465 " of a remote path")465 working = d.open_workingtree()
466 if not force:466 except errors.NoWorkingTree:
467 if (working.has_changes()):467 raise errors.BzrCommandError("No working tree to remove")
468 raise errors.UncommittedChanges(working)468 except errors.NotLocalUrl:
469469 raise errors.BzrCommandError("You cannot remove the working tree"
470 working_path = working.bzrdir.root_transport.base470 " of a remote path")
471 branch_path = working.branch.bzrdir.root_transport.base471 if not force:
472 if working_path != branch_path:472 if (working.has_changes()):
473 raise errors.BzrCommandError("You cannot remove the working tree"473 raise errors.UncommittedChanges(working)
474 " from a lightweight checkout")474
475475 working_path = working.bzrdir.root_transport.base
476 d.destroy_workingtree()476 branch_path = working.branch.bzrdir.root_transport.base
477 if working_path != branch_path:
478 raise errors.BzrCommandError("You cannot remove the working tree"
479 " from a lightweight checkout")
480
481 d.destroy_workingtree()
477482
478483
479class cmd_revno(Command):484class cmd_revno(Command):