~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/clean_tree.py

  • Committer: Jelmer Vernooij
  • Date: 2011-06-16 11:57:36 UTC
  • mto: This revision was merged to the branch mainline in revision 5987.
  • Revision ID: jelmer@samba.org-20110616115736-5xuzwdf87qb81su4
Use iter_ancestry rather than get_ancestry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import shutil
21
21
 
22
22
from bzrlib import (
23
 
    controldir,
 
23
    bzrdir,
24
24
    errors,
25
25
    ui,
26
26
    )
27
27
from bzrlib.osutils import isdir
28
28
from bzrlib.trace import note
29
29
from bzrlib.workingtree import WorkingTree
30
 
from bzrlib.i18n import gettext
 
30
 
31
31
 
32
32
def is_detritus(subp):
33
33
    """Return True if the supplied path is detritus, False otherwise"""
59
59
            ignored=ignored, detritus=detritus))
60
60
        deletables = _filter_out_nested_bzrdirs(deletables)
61
61
        if len(deletables) == 0:
62
 
            note(gettext('Nothing to delete.'))
 
62
            note('Nothing to delete.')
63
63
            return 0
64
64
        if not no_prompt:
65
65
            for path, subp in deletables:
85
85
        # directory and therefore delete it. (worth to FIXME?)
86
86
        if isdir(path):
87
87
            try:
88
 
                controldir.ControlDir.open(path)
 
88
                bzrdir.BzrDir.open(path)
89
89
            except errors.NotBranchError:
90
90
                result.append((path,subp))
91
91
            else:
105
105
        # Other errors are re-raised.
106
106
        if function is not os.remove or excinfo[1].errno != errno.EACCES:
107
107
            raise
108
 
        ui.ui_factory.show_warning(gettext('unable to remove %s') % path)
 
108
        ui.ui_factory.show_warning('unable to remove %s' % path)
109
109
    has_deleted = False
110
110
    for path, subp in deletables:
111
111
        if not has_deleted:
112
 
            note(gettext("deleting paths:"))
 
112
            note("deleting paths:")
113
113
            has_deleted = True
114
114
        if not dry_run:
115
115
            if isdir(path):
122
122
                    # We handle only permission error here
123
123
                    if e.errno != errno.EACCES:
124
124
                        raise e
125
 
                    ui.ui_factory.show_warning(gettext(
126
 
                        'unable to remove "{0}": {1}.').format(
127
 
                                                    path, e.strerror))
 
125
                    ui.ui_factory.show_warning(
 
126
                        'unable to remove "%s": %s.' % (path, e.strerror))
128
127
        else:
129
128
            note('  ' + subp)
130
129
    if not has_deleted:
131
 
        note(gettext("No files deleted."))
 
130
        note("No files deleted.")