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

Dennis Brakhane brakhane at googlemail.com
Wed Dec 7 10:53:24 UTC 2011


On Wed, Dec 7, 2011 at 11:29 AM, Isaac Jurado <diptongo at gmail.com> wrote:
> Please follow these steps:
>
>    1. Execute the command sequence of the previous email.
>    2. When merging "afile" choose something DIFFERENT to the sequence
>       of k's, or write whatever else.
>    3. Remerge using whatever method you mentioned and TRY TO FIND A
>       SEQUENCE OF k's

$ 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
adding afile
$ hg commit -m "A"
afile
committed changeset 0:9c6c3173fc76
$ sed '2 c jjjjjjjjjjjjjjjjjjjjj' afile >bfile
$ mv bfile afile
$ hg commit -m "AA"
afile
committed changeset 1:2ccb8851646e
$ hg update 0
resolving manifests
getting afile
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ sed '2 c kkkkkkkkkkkkkkkkkkkkkkkk' afile >bfile
$ cp bfile afile
$ hg update
resolving manifests
merging afile
[writing foobar in line 2 in kdiff]
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
$ cat afile
asdf asdf asdf asdf asdf a
foobar
poiua pioaiusdf puasf -lqwer
qer -.qmwe-.q,mweer m
qwer-,m qwew-r.,m
$ hg resolve -u afile # IMPORTANT, as mentioned in Martin's and my second email
$ hg resolve afile --tool internal:local
$ cat afile
asdf asdf asdf asdf asdf a
kkkkkkkkkkkkkkkkkkkkkkkk
poiua pioaiusdf puasf -lqwer
qer -.qmwe-.q,mweer m
qwer-,m qwew-r.,m

> If you cannnot find it, you have lost work.

I can, therefore I haven't. ;-)

> I'm not blaming mercurial, I'm just warning from a BAD PRACTICE.  I've
> lost a lot of work before learning that the proper way is commiting
> before and NOT letting "hg update" merge my dirty working copy.

As Martin said, it might not be the best practice to update a dirty copy,
but hg (as always) tries hard to prevent you from losing work.

Greetings



More information about the Mercurial mailing list