summaryrefslogtreecommitdiff
path: root/etckeeper-bzr
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-05-15 19:27:34 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-05-15 19:27:34 +0200
commita94a6c2d087a43df352b7c1be0a9e231d9213512 (patch)
tree18d81e328971a2f8b3462a1ac6e80d88c6fddee5 /etckeeper-bzr
parent7ec9cb9061e580733a6f4b45bbde5f6db670c5c9 (diff)
Use newer API in bzr plugin.
Diffstat (limited to 'etckeeper-bzr')
-rwxr-xr-xetckeeper-bzr/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/etckeeper-bzr/__init__.py b/etckeeper-bzr/__init__.py
index a656dc5..54d160d 100755
--- a/etckeeper-bzr/__init__.py
+++ b/etckeeper-bzr/__init__.py
@@ -20,8 +20,12 @@ def etckeeper_startcommit_hook(tree):
if ret != 0:
raise BzrError("etckeeper pre-commit failed")
-MutableTree.hooks.install_hook('start_commit', etckeeper_startcommit_hook)
-MutableTree.hooks.name_hook(etckeeper_startcommit_hook, "etckeeper")
+install_named_hook = getattr(MutableTree.hooks, 'install_named_hook', None)
+if install_named_hook is not None:
+ install_named_hook('start_commit', etckeeper_startcommit_hook, 'etckeeper')
+else:
+ MutableTree.hooks.install_hook('start_commit', etckeeper_startcommit_hook)
+ MutableTree.hooks.name_hook(etckeeper_startcommit_hook, "etckeeper")
if __name__ == "__main__":
from distutils.core import setup