Problems with the "purge" command

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Jun 18 21:36:28 UTC 2023


On 6/16/23 16:58, Dr Rainer Woitok wrote:
> Greetings,
>
> is there a way to have  "hg purge"  just remove  untracked files without
> asking?  I mean apart from the ancient
>
>     purge = !$HG status -nu0 | xargs -0 rm -f
>
> in the "[alias]" section of one's "~/.hgrc" file?
>
> $ hg version
> Mercurial Distributed SCM (version 6.4.3+hg3.660cf5c34820)
> (see https://mercurial-scm.org for more information)
>
> Copyright (C) 2005-2023 Olivia Mackall and others
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> $ hg st
> $ touch xxx
> $ hg st
> ? xxx
> $ HGPLAINEXCEPT= HGRCPATH= hg purge
> permanently delete 1 unknown files? (yN) n
> abort: removal cancelled
> $ HGPLAINEXCEPT= HGRCPATH= hg purge --noninteractive
> permanently delete 1 unknown files? (yN) n
> abort: removal cancelled
> $ HGPLAINEXCEPT= HGRCPATH= hg purge --confirm
> permanently delete 1 unknown files? (yN) n
> abort: removal cancelled
> $
>
> Since there is a "--confirm" option,  I expected not specifying it would
> do the trick,  but apparently  this option  is totally irrelevant.


You can use `hg purge --no-confirm` to achieve what you want.

The help should be pointed at the `-[-no]-confirm` variant 
automatically, but don't. This is a known documentation bug that comes 
from the collaboration with the purge extension.


-- 
Pierre-Yves David



More information about the Mercurial mailing list