[PATCH] remove: fix --force option help description (issue5177)

Sean Farley sean at farley.io
Wed Apr 13 12:49:38 EDT 2016


liscju <piotr.listkiewicz at gmail.com> writes:

> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1460534211 -7200
> #      Wed Apr 13 09:56:51 2016 +0200
> # Node ID 8636e5421aeae9457fc298f0af3268f371484e03
> # Parent  02be5fc18c0c70c087a9d1ab5ffe5afce926f227
> remove: fix --force option help description (issue5177)
>
> Before this commit --force option help description stated
> that file was removed and deleted even if file was added
> or modified which is not true. Force option removes added
> file only from dirstate, it doesn't delete it from the
> filesystem.

I did not realize this. Ok, so this is a bit confusing to me, I must
admit. The following is what I observed:

$ echo foo>foo
$ hg add foo
$ hg rm -f foo
$ hg st
? foo

So, the file is left on disk if we never committed it. I guess that
makes sense to leave a backup.

$ echo foo>foo
$ hg add foo
$ hg ci -m foo
$ echo foo>>foo
$ hg rm -f foo
$ hg st
R foo

So, we removed the file from disk and lost our changes.

> diff -r 02be5fc18c0c -r 8636e5421aea mercurial/commands.py
> --- a/mercurial/commands.py	Wed Mar 09 10:47:33 2016 -0500
> +++ b/mercurial/commands.py	Wed Apr 13 09:56:51 2016 +0200
> @@ -5975,7 +5975,7 @@ def recover(ui, repo):
>  @command('^remove|rm',
>      [('A', 'after', None, _('record delete for missing files')),
>      ('f', 'force', None,
> -     _('remove (and delete) file even if added or modified')),
> +     _('remove file if added and also delete if modified')),

This seems too terse to me. Maybe something (verbose) like,

removes file from disk if file has been committed, otherwise removes
file from dirstate (see `forget')

I don't know if I like what I just wrote, though. Others, please chime
in.


More information about the Mercurial-devel mailing list