How to pull/merge selective changesets

Bruce Frederiksen dangyogi at gmail.com
Wed Aug 19 15:33:17 CDT 2009


On Wed, Aug 19, 2009 at 3:01 PM, Martin Geisler <mg at lazybytes.net> wrote:

> Bruce Frederiksen <dangyogi at gmail.com> writes:
>
> > I would like to set up two shared hg repos for the same project:
> > release_1 and dev.
> >
> > Then after the following sequence of events:
> >
> >    1. Push a changeset to release_1 that should only ever be seen in
> >    release_1.
> >    2. Push a changeset to dev that should only ever be seen in dev.
> >
> > Now I want to push a changeset to both repos.
> >
> > My understanding is that if I start with either repo (say release_1)
> > and simply clone, commit and push back to that repo, and then
> > push/pull, merge from that repo to the other repo (dev), that *all* of
> > the prior changesets from the first repo are copied over and merged
> > into the second repo (including those from step 1).
>
>
> You should instead pull them into dev and merge the resulting heads
> while *ignoring* everything from release_1. So you make a dummy-merge
> and keep the invariant that dev is always a superset of release_1.
>
> You do a dummy merge like this:
>
>  $ HGMERGE=true hg merge
>  $ hg revert --all old-dev-head
>
> The first command will merge everything and let Mercurial believe that
> it was done succesfully -- the second command resets all files to their
> state in the dev head you want to preserve. Now commit and you're done.
>
>
OK, a couple of questions to be sure I understand this correctly:

1. I only do the above procedure on dev for changesets that are release_1
only.  Then after that the changesets targeting both repos go to release_1
first (the subset repo), and are then pulled/merged into dev normally
(Mercurial thinking it already has the first release_1-only changeset in dev
when the second pull into dev is done).  Is this correct?

2. The HGMERGE=true causes the merge to not do anything.  So I'm a little
confused on the need for the revert (though suppose it can't hurt)?  Does
the merge end up with the files just pulled from release_1 in the working
dir, rather than what was in the dev working dir before the merge?

3. I only need one commit at the end for the above procedure?

Again, Thanks in advance!

-Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://selenic.com/pipermail/mercurial/attachments/20090819/b455ab0c/attachment.htm 


More information about the Mercurial mailing list