hg update and deleted files

Martin Geisler mg at lazybytes.net
Fri Jul 9 10:42:49 UTC 2010


"Tom Karzes" <Tom.Karzes at magnumsemi.com> writes:

Hi Tom,

(I hope you realize that I'm not arguing that people don't do what you
say they do -- I'm just talking about how I see things.)

> No! You do *not* do "hg revert --all". That only works if you want to
> discard *all* changes. That is not the way most people work. If they
> want to discard some, but not all changes, then they remove the files
> they don't want to keep, then they do "hg update" to restore the
> original versions.

This is the part that I do not understand: in my mind, 'hg update' feels
completely wrong here since it is inherently a repository-centric
command. It updates the working copy parent revision -- which has
nothing to do with individual files, it's a repository-wide operation.

Compare this with 'hg revert' -- that command is inherently file based
and so it is the first command that comes to my mind when I want to deal
with files. Restoring files I deleted while leaving other modified files
in place is a very file-centric operation.

> And yes, I know they could do "hg revert --no-backup" individually.
> They don't.

> This isn't a philosophical question about what people should or
> shouldn't do. It's a simple reality that this is the way most people
> who are used to working in CVS or whatever end up working, and even if
> they know how to do "hg revert --no-backup", they would much rather
> just remove the file and then restore all missing files with a single
> update. It's more convenient and it's less error prone.

You could perhaps make a 'hg undelete' command as I suggested using
Steve's patches.

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/



More information about the Mercurial mailing list