From a94a6c2d087a43df352b7c1be0a9e231d9213512 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 15 May 2008 19:27:34 +0200 Subject: Use newer API in bzr plugin. --- debian/changelog | 6 ++++++ etckeeper-bzr/__init__.py | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3670a91..8ab9a70 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +etckeeper (0.16) UNRELEASED; urgency=low + + * Use new API in bzr plugin. + + -- Jelmer Vernooij Thu, 15 May 2008 19:26:00 +0200 + etckeeper (0.15) unstable; urgency=low [ Daniel Hahler ] 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 -- cgit v1.2.3