Problem with importing a merge changeset

Adrian Buehlmann adrian at cadifra.com
Sun May 18 08:58:04 UTC 2008


On 18.05.2008 07:45, Julian Cowley wrote:
> I'm having a problem with the hg import command.  Say I have a repo with 
> the following:
> 
>     o    changeset:   3:aed80a0542a6
>     |\
>     | o  changeset:   2:43201c19d28d
>     | |
>     o |  changeset:   1:258012f5089c
>     |/
>     o    changeset:   0:0518cfc51257
> 
> After changeset 0, the repo is cloned.  Changeset 2 is committed to the 
> original.  Changesets 1 and 3 are committed to the clone and then exported 
> using hg export.

There is a contradiction here, IMHO:

You say cset 3 has been committed to the clone. From your picture above
I gather that cset 3 is a merge cset (it has two parents).

Cset 3 can only have been committed to the clone if cset 2 has been
committed to the clone as well, since 3 depends on 2 per your graph.
But you say the clone was cloned from the original before cset 2 had
been committed to the original, from which I infer that 2 should be missing
in the clone. But if you have a 3 as shown in the graph (a merge of
2 and 1) then both 2 and 1 must have been present in the clone when
committing merge cset 3 to the clone.

Either your graph or your text or both or wrong.

If your original repo would have had csets 0 and 2 and your clone would
have had csets 0 and 1 (not 3!), it would have had made sense to export 1
from the clone using hg export and to hg import that into the original.

As a general note (as I understand it, the real hg gurus might correct me
please if I'm wrong) hg export/import isn't meant to be used as a transfer
method for *merge* changesets, since the patch format in the output of hg
export does the diff against the first parent only.

Quote from "hg help export":
'''
    NOTE: export may generate unexpected diff output for merge changesets,
    as it will compare the merge changeset against its first parent only.
'''

To transfer merge changesets, you should either use "hg pull" from one repo
into the other or use "hg bundle" to create a bundle file and "hg pull" from
that bundle file into the target repo.




More information about the Mercurial mailing list