hgext/purge.py
changeset 46366 135056e8b5a8
parent 45942 89a2afe31e82
child 46368 bb3a5c0df06b
equal deleted inserted replaced
46365:63dfaca9087f 46366:135056e8b5a8
    59             _(
    59             _(
    60                 b'end filenames with NUL, for use with xargs'
    60                 b'end filenames with NUL, for use with xargs'
    61                 b' (implies -p/--print)'
    61                 b' (implies -p/--print)'
    62             ),
    62             ),
    63         ),
    63         ),
       
    64         (b'', b'confirm', None, _(b'ask before permanently deleting files')),
    64     ]
    65     ]
    65     + cmdutil.walkopts,
    66     + cmdutil.walkopts,
    66     _(b'hg purge [OPTION]... [DIR]...'),
    67     _(b'hg purge [OPTION]... [DIR]...'),
    67     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
    68     helpcategory=command.CATEGORY_WORKING_DIRECTORY,
    68 )
    69 )
   111         ignored = opts.get(b'ignored', False)
   112         ignored = opts.get(b'ignored', False)
   112         unknown = not ignored
   113         unknown = not ignored
   113 
   114 
   114     removefiles = opts.get(b'files')
   115     removefiles = opts.get(b'files')
   115     removedirs = opts.get(b'dirs')
   116     removedirs = opts.get(b'dirs')
       
   117     confirm = opts.get(b'confirm')
   116 
   118 
   117     if not removefiles and not removedirs:
   119     if not removefiles and not removedirs:
   118         removefiles = True
   120         removefiles = True
   119         removedirs = True
   121         removedirs = True
   120 
   122 
   127         ignored=ignored,
   129         ignored=ignored,
   128         removeemptydirs=removedirs,
   130         removeemptydirs=removedirs,
   129         removefiles=removefiles,
   131         removefiles=removefiles,
   130         abortonerror=opts.get(b'abort_on_err'),
   132         abortonerror=opts.get(b'abort_on_err'),
   131         noop=not act,
   133         noop=not act,
       
   134         confirm=confirm,
   132     )
   135     )
   133 
   136 
   134     for path in paths:
   137     for path in paths:
   135         if not act:
   138         if not act:
   136             ui.write(b'%s%s' % (path, eol))
   139             ui.write(b'%s%s' % (path, eol))