Non-graft merge hook

Matt Mackall mpm at selenic.com
Tue Jan 29 10:03:53 UTC 2013


On Tue, 2013-01-29 at 10:50 +0100, Mathias De Maré wrote:
> 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.

You could perhaps look for the existence of graft's state-tracking file.

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list