Tutorial questions

Patrick Waugh ptwaugh at gmail.com
Fri Jun 11 17:39:47 UTC 2010


Mads,

On Fri, Jun 11, 2010 at 11:39 AM, Mads Kiilerich <mads at kiilerich.com> wrote:
> On 06/11/2010 06:14 PM, Patrick Waugh wrote:
>>
>> Oh the TutorialMerge (http://mercurial.selenic.com/wiki/TutorialMerge)
>> page it says this:
>>
>> ---
>> Note that if you change your mind and you want to undo this merge
>> before comitting anything, just doing a hg revert -r2 --all  will only
>> revert the state of the files in the working dir to revision 2 and not
>> change the parents of the working dir back to a single parent (see
>> Revert). You should do a "hg update -C -r." instead to undo the merge
>> in this case.
>> ---
>>
>> And after reviewing the man page for update (hg -v help update), I do
>> not understand the "-r" as there is no revision number given.
>
> See "hg help revisions":
> The reserved name "." indicates the working directory parent. If no working
> directory is checked out, it is equivalent to null. If an uncommitted merge
> is in progress, "." is the revision of the first
> parent.

Ok, understood, but I'm going to suggest that since the -r {implicit
.} syntax is more advanced than and explicit -r 2, or -r . that the
example be changed to either explain it, or use the explicit syntax in
the example.



> Also,
>>
>> if the first command was executed, given the dual parents, what would
>> happen then?  How could that be fixed?  It doesn't seem intuitive that
>> the revert command wouldn't work.  I'd like to understand the parents
>> thing better conceptually.
>
> The revert command works just fine - but it probably doesn't do what you
> want. It changes the content of the working directory to that of revision 2,
> but it doesn't change the parent(s) of the working directory. A commit will
> thus commit the content of revision 2 as the result of the merge.

Did you mean rev 3???  Rev 2 was the original parent, then 3 was made
the tip after the merge (right?) and thus we would go back to rev 2
with:

hg revert -r2 --all

and it would be rev 3 that would still be a 2nd parent.  In other
words, I would fully expect 2 to be the head and tip after the above
command, and 3 to be gone.  What I don't get is why the parents aren't
reverted too.

patrick



More information about the Mercurial mailing list