python - ignore certain mercurial commands in mercurial hook -


i have mercurial hook so:

[hooks] pretxncommit.myhook = python:path/to/file:myhook 

with code looking this:

def myhook(ui, repo, **kwargs):     #do stuff 

but hook runs on commands use commit logic else, in case hg shelve. there way command user has input avoid running hook on command?

perhaps this:

def myhook(ui, repo, command, **kwargs):       if command "hg shelve"            return 0       #do stuff 

unfortunately answer seems no. debugged hook mechanism of hg 3.1, , information command issued not propagated hook function. way can think of hack ugly debugger api extract informations call stack.

another hack inspect sys.argv, fear unreliable (as can't detect if executed via command server).

btw used snippet attach debugger:

def myhook(ui, repo, **kwargs):     print kwargs     pdb import set_trace     set_trace() 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -