~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/clean_tree.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
17
18
 
18
19
import errno
19
20
import os
20
21
import shutil
21
22
 
22
23
from bzrlib import (
23
 
    bzrdir,
 
24
    controldir,
24
25
    errors,
25
26
    ui,
26
27
    )
63
64
            return 0
64
65
        if not no_prompt:
65
66
            for path, subp in deletables:
66
 
                # FIXME using print is very bad idea
67
 
                # clean_tree should accept to_file argument to write the output
68
 
                print subp
69
 
            val = raw_input('Are you sure you wish to delete these [y/N]?')
70
 
            if val.lower() not in ('y', 'yes'):
71
 
                print 'Canceled'
 
67
                ui.ui_factory.note(subp)
 
68
            prompt = gettext('Are you sure you wish to delete these')
 
69
            if not ui.ui_factory.get_boolean(prompt):
 
70
                ui.ui_factory.note(gettext('Canceled'))
72
71
                return 0
73
72
        delete_items(deletables, dry_run=dry_run)
74
73
    finally:
85
84
        # directory and therefore delete it. (worth to FIXME?)
86
85
        if isdir(path):
87
86
            try:
88
 
                bzrdir.BzrDir.open(path)
 
87
                controldir.ControlDir.open(path)
89
88
            except errors.NotBranchError:
90
89
                result.append((path,subp))
91
90
            else: