Script for automated pull+merge

Greg Ward greg at gerg.ca
Mon Apr 12 15:00:13 CDT 2010


On Mon, Apr 12, 2010 at 11:25 AM, Benjamin Pollack
<benjamin at bitquabit.com> wrote:
> Let's say we have the tree A -> B -> C.  When B pulls A, it can't merge, so there are multiple heads.  But now, since there are multiple heads, when C pulls B, it also can't merge.  And the poor sap who pulls from C will probably now have four heads in his repo--and because they're all anonymous, since Mercurial lacks Git-style named heads, there is no sane way for him to figure out what on Earth he should be merging with.  In fact, his only recourse is going to be to hit up "hg web" or run a series of "hg in"/"hg out" requests to figure out which heads are in B that aren't in A, etc.  This is assuming that he even knows that C is autopulling from A and B; otherwise, he's really screwed.

Ouch.  That sure sounds messy.  You have convinced me *not* to push
unmerged heads: my autopull script will abort if any merge fails.
(And I'm taking a very conservative approach right now by using
HGMERGE=internal:fail: i.e. abort if any file-level merges are
required.)

> The above isn't a random example, by the way.  It happened fairly often during Kiln's own development, when we had the repository hierarchy stable -> QA-devel -> devel -> [personal repositories].  Bug fixes going into stable didn't always merge cleanly with the up-and-coming version QA was working with, which would stop the bug fixes going into QA-devel from propagating backwards to devel, and finally a random intern would be faced with trying to merge a bunch of nitty-gritty Kiln crap that they have no knowledge about.
>
> I really want this idea to work.  I really haven't figured out how to make that happen yet.

As you may have guessed, I am going ahead and implementing an autopull
script for internal use here.  I was planning on only running it
manually with close supervision for the first week or so, and with
your warnings I'm going to be even more careful.  (For example, I'm
going to make darn sure that it sends a very clear, concise, detailed,
correct, useful email message after any failed autopull.  Maybe after
any successful pull too, although that will quickly become inbox noise
for everyone except me and the one or two other people who care about
this stuff.)

Thanks for the feedback.  I'll report back on how this pans out in our
environment.

Greg


More information about the Mercurial mailing list