Decorating the pull operation to accept an extra argument -- can you help improve an ugly solution?
Yoav Blau
yoav.blau at bhive.net
Wed May 21 19:24:03 BST 2008
We are trying to get "bzr pull" to send a mail. One of the arguments
will be "originating user" (this is the user that *requested* the pull,
not the one who is doing the pull, which is always the build manager).
Our solution was two-fold:
* Decorate the pull command to accept an additional argument
(--originating-user) and put it in a global variable (in our own module)
* Write a post-pull hook which uses both the "result" object
(which the hook gets as an argument) and the above global variable to
create and send a mail
This solution is obviously hackish :-(
It would be ideal if the pull command returned the result of the
"_to.pull()" operation, not merely sent it to the hooks. Then we would
do away with the hook, and do everything in the decorator. If there is
some other, saner, solution, it would be interesting to see it...
Thanks,
Yoav Blau & Moshe Zadka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20080521/b8586fb1/attachment.htm
More information about the bazaar
mailing list