/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/clean_tree.py

Use new context stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
               dry_run=False, no_prompt=False):
55
55
    """Remove files in the specified classes from the tree"""
56
56
    tree = WorkingTree.open_containing(directory)[0]
57
 
    tree.lock_read()
58
 
    try:
 
57
    with tree.lock_read():
59
58
        deletables = list(iter_deletables(tree, unknown=unknown,
60
59
            ignored=ignored, detritus=detritus))
61
60
        deletables = _filter_out_nested_controldirs(deletables)
70
69
                ui.ui_factory.note(gettext('Canceled'))
71
70
                return 0
72
71
        delete_items(deletables, dry_run=dry_run)
73
 
    finally:
74
 
        tree.unlock()
75
72
 
76
73
 
77
74
def _filter_out_nested_controldirs(deletables):