Question

Is it possible to temporarily disable a hook when running a mercurial command? e.g., something like:

hg push --no-hook
Was it helpful?

Solution 2

You can't disable a remote repository's hook. But you could enable or disable a local hook via --config option:

$ hg commit -m test --config 'hooks.commit.info=set | grep "^HG_"'

OTHER TIPS

According to this bugfeature, the following skips local hooks:

hg --config alias._pull=pull _pull

Obviously this is a hack, but it has worked since 2011, and is the only way to skip local hooks given the lack of a '--no-hooks' option.

If this is an outgoing or preoutgoing hook that is locally configured, you can disable it by commenting out its entry under [hooks] in .hg/hgrc. If this is a hook configured on the repository that you are pushing to (changegroup, incoming, prechangegroup, pretxnchangegroup), you will have to comment out its entry under [hooks] in the target repository's .hg/hgrc (if you have access to it).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top