Non-graft merge hook

Mathias De Maré mathias.demare at gmail.com
Tue Jan 29 09:50:32 UTC 2013


On Thu, Jan 24, 2013 at 9:34 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Thu, 2013-01-24 at 13:28 -0500, Greg Ward wrote:
>> On 18 January 2013, Mathias De Maré said:
>> > Hello,
>> >
>> > I'm trying to write a preupdate hook forbidding merges between
>> > specific branches.
>> > Doing so seems to work fine and is not too hard.
>> >
>> > However, it seems forbidding merges also forbids grafting.
>>
>> That doesn't sound right. Merges have two parents, grafts do not.
>> Perhaps you could show us your code, and then sample output
>> demonstrating how it fails.
>>
>> > Is there a way to detect if a merge or a graft is going on?
>>
>> Like I said: merges have >1 parent.
>
> Graft, like rebase, calls merge internally with two parents (and a
> "magic" ancestor). And merge internally calls the hook.

That's indeed what I'm experiencing. I attached my hook (a slightly
simplified version).

Perhaps it's possible to work around this issue? If I could detect
that one of the ancestors is 'special', I could ignore that merge.

Greetings,
Mathias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hook.py
Type: application/octet-stream
Size: 627 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20130129/1aa42a1b/attachment-0002.obj>


More information about the Mercurial mailing list