The difference between update and merge (was: Completely baffled)

Isaac Jurado diptongo at gmail.com
Tue Dec 6 19:37:37 UTC 2011


On Tue, Dec 6, 2011 at 10:53 AM, Martin Geisler <mg at aragost.com> wrote:
>
>> Unless there is something I don't know about, updating a dirty
>> working copy is only one way.
>
> You can use 'hg resolve' after the update to re-do the merge and even
> resurrect the old version of your modified files.
>
> I haven't tested this right now, but I would expect
>
>  hg resolve --all --tool internal:local
>  hg update OLDREV
>
> to get you safely back to where you were before you ran 'hg update NEW'.
> Please let us know if you test this.

Well, either one of us is not understanding the other or I wasn't clear
enough from the beginning.  Take the following command sequence:

    hg init killme
    cd killme
    cat >afile <<KAN
    asdf asdf asdf asdf asdf a
    asdf asdf asdf asdf
    poiua pioaiusdf puasf -lqwer
    qer -.qmwe-.q,mweer m
    qwer-,m qwew-r.,m
    KAN
    hg add afile
    hg commit -m "A"
    sed '2 c jjjjjjjjjjjjjjjjjjjjj' afile >bfile
    mv bfile afile
    hg commit -m "AA"
    hg update 0
    sed '2 c kkkkkkkkkkkkkkkkkkkkkkkk' afile >bfile
    cp bfile afile
    hg update

After the last command the merge tool should be launched.  Now, for the
sake of the exercise, screw it up by just editing the conflicting line
manually (in kdiff3, by writing something like "foobar" after selecting
between local, base and other).

And now, imagining that bfile does not exist, tell me how would you
recover afile to have the same contents as bfile.

Cheers.

-- 
Isaac Jurado

"The noblest pleasure is the joy of understanding"
Leonardo da Vinci



More information about the Mercurial mailing list