Temporarily disable a hook?
Asked Answered
S

3

5

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

hg push --no-hook
Shardashare answered 14/2, 2013 at 23:45 Comment(0)
L
4

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_"'
Laundrywoman answered 15/2, 2013 at 12:45 Comment(0)
R
7

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.

Rhodesia answered 22/1, 2015 at 19:9 Comment(3)
In case this wasn't obvious, replace all instances of pull with other commands (e.g. commit) to run those without their local hooks.Vlad
hg --config alias.fpush=push fpush doesn't appear to work. It's still running my preoutgoing hook.Sanfred
@mpen, see this answer - for obvious reasons you are not able to disable hooks on the remote side. That is why the hack can only work with pull and not push.Sixteenth
L
4

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_"'
Laundrywoman answered 15/2, 2013 at 12:45 Comment(0)
R
1

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).

Ridgeway answered 14/2, 2013 at 23:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.