[bzr-email:MERGED] use install_named_hook if available
John Arbash Meinel
john at arbash-meinel.com
Thu May 1 23:48:22 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
| On Thu, 2008-05-01 at 15:03 -0500, John Arbash Meinel wrote:
| Just a simple compatibility thing so we don't get deprecation warnings.
| It follows the code we already had there, so I just went ahead and committed it.
|
| John
| =:->
...
=== modified file '__init__.py'
- --- __init__.py 2007-07-08 06:57:27 +0000
+++ __init__.py 2008-05-01 20:01:21 +0000
@@ -89,9 +89,13 @@
~ def install_hooks():
~ """Install CommitSender to send after commits with bzr >= 0.15 """
- - Branch.hooks.install_hook('post_commit', branch_commit_hook)
- - if getattr(Branch.hooks, 'name_hook', None):
- - Branch.hooks.name_hook(branch_commit_hook, "bzr-email")
+ install_named_hook = getattr(Branch.hooks, 'install_named_hook', None)
+ if install_named_hook:
+ install_named_hook('post_commit', branch_commit_hook, 'bzr-email')
+ else:
+ Branch.hooks.install_hook('post_commit', branch_commit_hook)
+ if getattr(Branch.hooks, 'name_hook', None):
+ Branch.hooks.name_hook(branch_commit_hook, "bzr-email")
| Please use 'is not None' here, there is no telling what
| install_named_hook might be :).
| -Rob
I can, but if it isn't a proper function or None, then we are going to have
problems anyway.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkgaSLUACgkQJdeBCYSNAANrnQCfVypSoifk3a3IFnCaDqJtIw/x
YkcAoM5Y8R4DzE5G/EpWPI45PigR7/zY
=Xzbk
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list