about hg merge

Thomas Arendsen Hein thomas at intevation.de
Tue Aug 30 00:47:23 CDT 2005


* Ling, Xiaofeng <xiaofeng.ling at intel.com> [20050830 06:18]:
> for example, after pull, I have a tree with two head
> 1-2-3-4
>  \5-6-7

I assume 2-3-4 are your changes and 5-6-7 are made my others in a
different repository.

> I hope to get a new tree
> 1-2-3-4-8-9-10
>  \5-6-7
> here 8,9,10 is 5,6,7's new changeset based on the new revision.
>
> currently, I can do with hg export and hg import one by one for
> these changeset.
> But can I get such a command like
> hg merge  5-7
> to do it more conveniently?

With this you would duplicate 5-7 to 8-10, this is not merging. What
you really want is to merge 4 and 7 to a new changeset 8, so just do
"hg co -m" to do it:

1-2-3-4-8
 \     /
  5-6-7
When you continue your work on 8 and the other repo continues on 7:

1-2-3-4-8-9-10
 \     /
  5-6-7-11-12

So you keep the two heads.

If you pushed your above merge, the everyone will continue work on 8:

1-2-3-4-8-9-10
 \     / \
  5-6-7   11-12

So still two heads, unless you push your 10 before anyone else adds
changeset.

> further, It will be more helpful if I can do like merge 5 and 6 to
> changeset 8, 7 to 9
> 1-2-3-4-8-9
>  \5-6-7
> by command hg merge
> hg merge -m 5,6 7

Do you want to _combine_ the patches of 5 and 6 to a new patch or
changeset? This can't be done with changesets, but only with 'hg export'
and patch.

Now the good news: You can do many things you describe here with the
'mq' extension from ftp://ftp.suse.com/pub/people/mason/mercurial

Thomas

-- 
Email: thomas at intevation.de
http://intevation.de/~thomas/


More information about the Mercurial mailing list