0

We have a bazaar server, to which many people connect. I'd like to run some pre-commit hooks for every user and to me it'd make most sense to run these hooks on the server, since I can't control all computers connecting. I was assuming this was a simple task but I'm stuck now.

My current status is:

  • If I install the script on my workstation will the hook work.
  • If I install the script on the server will it work for commits done there.
  • With it installed on the server and I commit on my workstation it's being loaded but ignored.

I've tried having the script in both BZR_PLUGIN_PATH and ~/.bazaar/plugin on the server, and if I do that I see this in the log:

0.112  looking for plugins in /home/me/.bazaar/plugins
0.122  looking for plugins in /usr/local/lib64/python2.6/site-packages/bzrlib/plugins
0.123  Plugin name my_test_hook already loaded

And that's from a remote workstation so the plugin obviously gets loaded, but not executed. I've dumbed it down so what it's curretly doing is:

def my_test_hook (local, master, old_revno, old_revid,
    future_revno, future_revid, tree_delta, future_tree):
    raise TipChangeRejected("Rejected")

So it's kind of obvious when it's being executed. Can someone please tell me what I need to do to get this working? Ie when I do "bzr ci -m '...'" on my workstation do I want the hook in my server to cancel the commit and say "Rejected".

The documentation hasn't really helped me much unfortunately.

djot
  • 2,952
  • 4
  • 19
  • 28
Jon
  • 188
  • 1
  • 8

1 Answers1

0

The answer is: You can't.

The remote host only sees a post-push and then it's too late to stop the commit so such a hook has to run locally on every client.

Jon
  • 188
  • 1
  • 8