help modifying custom hook script to avoid commits to the wrong branch

Faheem Mitha faheem at faheem.info
Sun Dec 1 10:44:04 UTC 2013


Hi,

I created a custom hook script, which uses the "_committingpatch" 
attribute, which was removed in

###################################################################

changeset:   19752:11fdf9f754b7
parent:      19750:d4ed26beae0e
user:        Brodie Rao <brodie at sf.io>
date:        Mon Sep 16 01:08:29 2013 -0700
files:       hgext/mq.py
description:
mq: remove unused repo._committingpatch-related code

This was introduced in 20ad8f0512a2 but its usage was removed in
46cc3b74e1c5.

###################################################################

This code uses "_committingpatch" atribute to check whether a commit is an 
mq commit. Since a `qpush` looks to mercurial like a commit, I check for 
this attribute to decide whether to allow a push even to the "wrong" 
branch.

I'm writing to ask whether I can replace this method with something else. 
Is there some other way to check for an mq commit programmatically?

This code is at https://bitbucket.org/faheem/mercurial_hooks and I invoke 
it using

[hooks]
pretxncommit.foo = python:mercurial_hooks.abort_commit_to_wrong_branch
pre-qfinish.bar = python:mercurial_hooks.qfinish_abort_commit_to_wrong_branch

Please CC me on any reply. Thanks.

                                                             Regards, Faheem



More information about the Mercurial mailing list