Hook to prevent push of merges between named branches?

Greg Ward greg-hg at gerg.ca
Tue Oct 13 01:49:19 UTC 2009


On Fri, Oct 9, 2009 at 9:19 AM, Ringo De Smet <ringo.desmet at gmail.com> wrote:
>>    while rev < len(repo):
>>        fail = _check_notags(ui, repo, ctx) or fail
>>        fail = _check_badmerge(ui, repo, *(ctx.parents())) or fail
>
> One remark though: the above line, especially the part ctx.parents()
> bit me. Tthe parents in the pretxncommit hook are string objects
> representing the hashes of the parents. When calling the
> pretxnchangegroup hook, ctx.parents() returns 2 changectx objects, not
> the textual hashes. The code crashes later on in Mercurial internals
> because it expects two textual hashes. Does this code work for you as
> a pretxnchangegroup hook?

Oops.  I have been procrastinating on writing tests for my push hooks
for 2 or 3 weeks now.  Looks like I really should do that.  Then I
would not have posted buggy code!  Thanks for catching that --

Greg




More information about the Mercurial mailing list