~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to clean_tree.py

  • Committer: Aaron Bentley
  • Date: 2007-07-24 17:10:08 UTC
  • Revision ID: abentley@panoramicfeedback.com-20070724171008-b3ygal61ec5dojub
Better error when shelving binary files

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
               dry_run=False):
48
48
    """Remove files in the specified classes from the tree"""
49
49
    tree = WorkingTree.open_containing(directory)[0]
50
 
    deletables = iter_deletables(tree, unknown=unknown, ignored=ignored, 
51
 
                                 detritus=detritus)
52
 
    delete_items(deletables, dry_run=dry_run)
 
50
    tree.lock_read()
 
51
    try:
 
52
        deletables = iter_deletables(tree, unknown=unknown, ignored=ignored,
 
53
                                     detritus=detritus)
 
54
        delete_items(deletables, dry_run=dry_run)
 
55
    finally:
 
56
        tree.unlock()
53
57
 
54
58
 
55
59
def delete_items(deletables, dry_run=False):