'hg help revert' is misleading
mpm at selenic.com
Thu Sep 22 12:56:24 CDT 2005
On Thu, Sep 22, 2005 at 04:58:18PM +0200, Zbynek Winkler wrote:
> Hello, IMHO the output of 'hg help revert' is misleading or the revert
> command does not do what it is supposed to.
Does for me. You haven't said why you think it's not working though.
> $ hg help revert
> hg revert [-n] [-r REV] [NAME]...
> revert modified files or dirs back to their unmodified states
> -n --nonrecursive don't recurse into subdirs
> -r --rev revision
> According to this description I would expect it to behave like
> (fictious) 'hg update -C [NAME]'. I would expect it to revert all
> changes pending in my working copy. I don't understand what the '-r REV'
> is for...
Revert and update are different. Update checks out a revision, records
the revision checked out and marks all files as clean. Revert restores
some or all files to a given revision (the current first parent by
default) and doesn't mark them clean. Iff your working directory only
has one parent and you revert to that parent (the default), then they
will become clean by themselves.
> How do I return part of my working tree to an unmodified state?
hg revert [files]
>From the FAQ:
I did an hg revert and my working directory still has changes in it!
You've probably done an hg update -m, which means your working
directory now has two parents according to hg parents. A subsequent hg
revert will revert your working directory back to the primary parent,
thus leaving you with the differences between the two parents. hg
update -C will revert the left files.
If you're trying to switch between revisions in history, you probably
want hg update -C.
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial