[PATCH 04 of 11] Clarify error message when removing newly added files

Evan Powers evan.powers+hgdev at gmail.com
Mon Jun 25 14:32:09 CDT 2007


(Sorry about that Matt, I stupidly forgot to reply to the list.)

On 6/25/07, Matt Mackall <mpm at selenic.com> wrote:
> On Mon, Jun 25, 2007 at 05:04:22PM +0200, Markus F.X.J. Oberhumer wrote:
> > Fortunately (!) the file does _not_ get removed when using "hg rm -f" in
> > this situation.
>
> Well that seems like a bug, then? rm -f -really- ought to remove it,
> no?

This might be a user-friendliness issue.

Personally, my first impulse is to use "hg rm" to undo an accidental
"hg add", rather than "hg revert". Remove is the inverse of add,
right?

If this bug is fixed, I recommend using stronger wording in the
remove-on-newly-added file error message. Instead of:
   not removing foo: file has been marked for add (use -f to force removal)
something like:
   not removing foo: file has been marked for add (use -f to force deletion)

Maybe even print a reminder:
   not removing foo: file has been marked for add (use -f to force deletion)
   use revert to merely unschedule an add; remove will delete the file too

I can't think of any situation where a user would issue "hg rm -f" for
a newly-added file and actually desire the file to be unlinked. The
only scenarios I can think of are "rm -fr /"-style accidents.

- Evan


More information about the Mercurial-devel mailing list