Hi All,

I am getting the following errors while trying to use the patch safety 
dispatcher script as a bazaar pre-commit hook. It seems that the current file 
(hook) works with the latest bzr and is not compatible with the older ones like 
bazaar v1.3.1 (older than v1.5 which is released on May, 2008).  

0.118  encoding stdout as sys.stdout encoding 'UTF-8'
0.120  bzr arguments: [u'hooks']
0.120  looking for plugins in /root/.bazaar/plugins
[32240] 2009-07-30 15:34:36.171 WARNING: Unable to load plugin 
'patch_safety_dispatcher' from '/root/.bazaar/plugins'
0.143  Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/plugin.py", line 195, in 
load_from_dir
    exec "import bzrlib.plugins.%s" % name in {}
  File "<string>", line 1, in <module>
  File "/root/.bazaar/plugins/patch_safety_dispatcher.py", line 50, in <module>
    branch.Branch.hooks.install_named_hook('pre_commit', pre_commit_hook,
AttributeError: 'BranchHooks' object has no attribute 'install_named_hook'

0.143  looking for plugins in /usr/lib/python2.5/site-packages/bzrlib/plugins
0.143  Plugin name __init__ already loaded
0.143  Plugin name __init__ already loaded
0.173  encoding stdout as sys.stdout encoding 'UTF-8'
0.244  return code 0

I am aware of the fact that, it is an additional tool and in no way affect the 
product performance directly, but still I believe that adding a line in the 
docs that this file will work with bazaar rev 1.5 or later may be helpful. BTW, 
to make it work on the older bazaar, you just need to replace this line:

branch.Branch.hooks.install_named_hook('pre_commit', pre_commit_hook,
                                'Patch safety scripts hook')

with these lines

branch.Branch.hooks.install_hook('pre_commit', pre_commit_hook)
branch.Branch.hooks.name_hook(pre_commit_hook, 'Patch safety scripts hook')

--
Regards,
Gaurav Aggarwal

REFERENCE: <http://doc.bazaar-vcs.org/bzr.dev/en/release-notes/NEWS.html>
Search for term install_named_hook in the above document.

PS: Fedora 8 still provides bzr 1.3.1 system with it. So, anyone using Fedora 8 
or older version very likely face this problem.



      Yahoo! recommends that you upgrade to the new and safer Internet Explorer 
8. http://downloads.yahoo.com/in/internetexplorer/

Reply via email to