pisoir
pisoir

Reputation: 226

Bazaar pre-commit hook with parameter

I wrote a pre-commit hook for bazaar which checks some syntax issues in our code. Something similar to:

http://bazaar.launchpad.net/~bialix/%2Bjunk/checkeol/annotate/head%3A/__init__.py

Everything works, however, I would like to additionally add a command line option, which could disable this hook, e.g.,

If I called bzr commit --ignore-my-hook it would skip my pre-commit hook.

I know that there exists also option --no-plugins but that disables all plugins. I would really like to know if this is possible. Any ideas? Thank you.

Upvotes: 0

Views: 135

Answers (1)

jelmer
jelmer

Reputation: 2450

You can set the environment variable:

BZR_DISABLE_PLUGIN=yourplugin

to disable one specific plugin.

Or alternatively, you can add functionality to your hook to not do anything if a certain option or environment variable is set. You can set configuration options from the command line, which you can access from the hook. T

There is no other custom command line input you can provide to the hook.

Upvotes: 0

Related Questions