mercurial/commands.py
changeset 50845 e674941ad4eb
parent 50844 fb0f07c64304
child 50846 1d9ba5b40093
equal deleted inserted replaced
50844:fb0f07c64304 50845:e674941ad4eb
  5631     Be careful with purge, as you could irreversibly delete some files
  5631     Be careful with purge, as you could irreversibly delete some files
  5632     you forgot to add to the repository. If you only want to print the
  5632     you forgot to add to the repository. If you only want to print the
  5633     list of files that this program would delete, use the --print
  5633     list of files that this program would delete, use the --print
  5634     option.
  5634     option.
  5635     """
  5635     """
  5636     opts = pycompat.byteskwargs(opts)
  5636     cmdutil.check_at_most_one_arg(opts, 'all', 'ignored')
  5637     cmdutil.check_at_most_one_arg(opts, b'all', b'ignored')
  5637 
  5638 
  5638     act = not opts.get('print')
  5639     act = not opts.get(b'print')
       
  5640     eol = b'\n'
  5639     eol = b'\n'
  5641     if opts.get(b'print0'):
  5640     if opts.get('print0'):
  5642         eol = b'\0'
  5641         eol = b'\0'
  5643         act = False  # --print0 implies --print
  5642         act = False  # --print0 implies --print
  5644     if opts.get(b'all', False):
  5643     if opts.get('all', False):
  5645         ignored = True
  5644         ignored = True
  5646         unknown = True
  5645         unknown = True
  5647     else:
  5646     else:
  5648         ignored = opts.get(b'ignored', False)
  5647         ignored = opts.get('ignored', False)
  5649         unknown = not ignored
  5648         unknown = not ignored
  5650 
  5649 
  5651     removefiles = opts.get(b'files')
  5650     removefiles = opts.get('files')
  5652     removedirs = opts.get(b'dirs')
  5651     removedirs = opts.get('dirs')
  5653     confirm = opts.get(b'confirm')
  5652     confirm = opts.get('confirm')
  5654     if confirm is None:
  5653     if confirm is None:
  5655         try:
  5654         try:
  5656             extensions.find(b'purge')
  5655             extensions.find(b'purge')
  5657             confirm = False
  5656             confirm = False
  5658         except KeyError:
  5657         except KeyError:
  5660 
  5659 
  5661     if not removefiles and not removedirs:
  5660     if not removefiles and not removedirs:
  5662         removefiles = True
  5661         removefiles = True
  5663         removedirs = True
  5662         removedirs = True
  5664 
  5663 
  5665     match = scmutil.match(repo[None], dirs, opts)
  5664     match = scmutil.match(repo[None], dirs, pycompat.byteskwargs(opts))
  5666 
  5665 
  5667     paths = mergemod.purge(
  5666     paths = mergemod.purge(
  5668         repo,
  5667         repo,
  5669         match,
  5668         match,
  5670         unknown=unknown,
  5669         unknown=unknown,
  5671         ignored=ignored,
  5670         ignored=ignored,
  5672         removeemptydirs=removedirs,
  5671         removeemptydirs=removedirs,
  5673         removefiles=removefiles,
  5672         removefiles=removefiles,
  5674         abortonerror=opts.get(b'abort_on_err'),
  5673         abortonerror=opts.get('abort_on_err'),
  5675         noop=not act,
  5674         noop=not act,
  5676         confirm=confirm,
  5675         confirm=confirm,
  5677     )
  5676     )
  5678 
  5677 
  5679     for path in paths:
  5678     for path in paths: