~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to clean_tree.py

  • Committer: Aaron Bentley
  • Date: 2006-07-13 13:12:22 UTC
  • mfrom: (415.1.1 bzrtools)
  • Revision ID: abentley@panoramicfeedback.com-20060713131222-2bfdeff06434967b
clean-tree --detritus no longer implies --unknown

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=True, ignored=False, detritus=False):
 
32
def iter_deletables(tree, unknown=False, 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, ignored=False, detritus=False, dry_run=False):
 
46
def clean_tree(directory, unknown=False, ignored=False, detritus=False, 
 
47
               dry_run=False):
47
48
    """Remove files in the specified classes from the tree"""
48
49
    tree = WorkingTree.open_containing(directory)[0]
49
 
    deletables = iter_deletables(tree, ignored=ignored, detritus=detritus)
 
50
    deletables = iter_deletables(tree, unknown=unknown, ignored=ignored, 
 
51
                                 detritus=detritus)
50
52
    delete_items(deletables, dry_run=dry_run)
51
53
 
52
54