~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to clean_tree.py

  • Committer: Aaron Bentley
  • Date: 2006-06-27 14:36:32 UTC
  • Revision ID: abentley@panoramicfeedback.com-20060627143632-0f4114d7b0a8d7d9
Fix zap for checkouts of branches with no parents

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        subp.endswith('.OTHER') or subp.endswith('~') or subp.endswith('.tmp')
30
30
 
31
31
 
32
 
def iter_deletables(tree, unknown=False, ignored=False, detritus=False):
 
32
def iter_deletables(tree, unknown=True, ignored=False, detritus=False):
33
33
    """Iterate through files that may be deleted"""
34
34
    for subp in tree.extras():
35
35
        if detritus and is_detritus(subp):
43
43
                yield tree.abspath(subp), subp
44
44
 
45
45
 
46
 
def clean_tree(directory, unknown=False, ignored=False, detritus=False, 
47
 
               dry_run=False):
 
46
def clean_tree(directory, ignored=False, detritus=False, dry_run=False):
48
47
    """Remove files in the specified classes from the tree"""
49
48
    tree = WorkingTree.open_containing(directory)[0]
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()
 
49
    deletables = iter_deletables(tree, ignored=ignored, detritus=detritus)
 
50
    delete_items(deletables, dry_run=dry_run)
57
51
 
58
52
 
59
53
def delete_items(deletables, dry_run=False):