Is this the expected revert behaviour ?

Christian Boos cboos at neuf.fr
Fri May 5 03:20:14 CDT 2006


Vadim Gelfer wrote:
> On 5/4/06, Sébastien Pierre <sebastien at xprima.com> wrote:
>> > > Is it just me or do others think that this behaviour is
>> > > counter-intuitive ?
>> >
>> > I have also been fooled by this.
>>
>> I just saw that there is an entry for this precise problem in the FAQ "I
>> did an hg revert and my working directory still has changes in it!".
>
> i have changed doc comments for revert. here is what "hg help revert" 
> says now.
>
> revert modified files or dirs to their states as of some revision
>
> By default, revert the named files or directories to the contents
> they had in the parent of the working directory. This restores
> the contents of the affected files to an unmodified state.

This bit made me think we should clarify the Mercurial terminology:
here we speak of "the parent of the working directory", but that's
not done consistently across the documentation.

I've checked the current docs, and that notion is only used in the
"hg parents", "hg backout" and the current help for "hg revert".
It's not mentioned in the Wiki tutorial nor in the Glossary,
and more importantly not mentioned in the "hg update" help.

I think it could be important to be consistent and promote that terminology,
especially for the "hg update" command. Actually, emphasizing the fact that
"hg update" changes the parent(s) but "hg revert" does not, is the best way
to disambiguate them, as they both can change the file content to match the
state of a given revision.

So I'd propose something like:

revert [-r REV] [NAME]…
    Change the content of the working directory to match the specified
    revision. without changing the working directory parent

update [-b TAG] [-m] [-C] [-f] [REV]
    Change the working directory parent to the specified revision. The
    content of the working directory will change depending on the options.


Also, we should mention in the WorkingDirectory glossary page that the
working directory has at any time a current parent revision, possibly two
after a merge.

More related to the original topic, also add a note that after an "hg 
merge",
"hg revert" will pick one of the working directory parent (the first?)
as the revision it should revert to.

-- Christian



More information about the Mercurial mailing list