Issue #17 open

hooks are not working under Mercurial 2.1

created an issue

Whenever I try to commit the following error message occurs: {{{ ben@medphys206:~/x$ hg fixwhitespace ben@medphys206:~/x$ hg ci -m"Test" unknown exception encountered, please report by visiting Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] Mercurial Distributed SCM (version 2.1) Extensions loaded: graphlog, hgk, churn, convert, purge, transplant, color, fetch, checkfiles Traceback (most recent call last): File "/usr/bin/hg", line 38, in <module> File "/usr/lib/pymodules/python2.6/mercurial/", line 27, in run sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) File "/usr/lib/pymodules/python2.6/mercurial/", line 64, in dispatch return _runcatch(req) File "/usr/lib/pymodules/python2.6/mercurial/", line 87, in _runcatch return _dispatch(req) File "/usr/lib/pymodules/python2.6/mercurial/", line 683, in _dispatch cmdpats, cmdoptions) File "/usr/lib/pymodules/python2.6/mercurial/", line 465, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/lib/pymodules/python2.6/mercurial/", line 184, in wrap return wrapper(origfn, *args, kwargs) File "/usr/lib/pymodules/python2.6/hgext/", line 362, in colorcmd return orig(ui_, opts, cmd, cmdfunc) File "/usr/lib/pymodules/python2.6/mercurial/", line 737, in _runcommand return checkargs() File "/usr/lib/pymodules/python2.6/mercurial/", line 691, in checkargs return cmdfunc() File "/usr/lib/pymodules/python2.6/mercurial/", line 680, in <lambda> d = lambda: util.checksignature(func)(ui, args, cmdoptions) File "/usr/lib/pymodules/python2.6/mercurial/", line 456, in check return func(*args, kwargs) File "/usr/lib/pymodules/python2.6/mercurial/", line 1212, in commit node = cmdutil.commit(ui, repo, commitfunc, pats, opts) File "/usr/lib/pymodules/python2.6/mercurial/", line 1264, in commit scmutil.match(repo[None], pats, opts), opts) File "/usr/lib/pymodules/python2.6/mercurial/", line 1207, in commitfunc editor=e, extra=extra) File "/usr/lib/pymodules/python2.6/mercurial/", line 1184, in commit self.hook("precommit", throw=True, parent1=hookp1, parent2=hookp2) File "/usr/lib/pymodules/python2.6/mercurial/", line 266, in hook return hook.hook(self.ui, self, name, throw, *args) File "/usr/lib/pymodules/python2.6/mercurial/", line 170, in hook hookfn = getattr(mod, cmd) AttributeError: 'module' object has no attribute 'fixup_hook # enables hook to fix files before creating commit'


Comments (7)

  1. Jeremy Brayton

    I naively enabled all the hooks specified in the Hg Wiki and ran into a variant of this issue on hg clone. I'm using Tortoise so I don't quite have the logs shown but the key to the problem lies in the attribute it looks for.

    It appears that the code is looking for "fixup_hook (trailing parts)" not fixup_hook. My fix was to move the # comment lines above each hook versus the end of the same line. I think I'm explaining that correctly but just in case:

    1. enables hook to check incoming changeset pretxnchangegroup.checkfiles = python:/path/to/ (Repeat for the others)...

    I'm using the master and I don't think it's fixed. This should be an adequate workaround and may point you to why it's doing what it is. Unfortunately I don't know enough about python to know what is happening. I would think you could detect the # and trim any whitespace before that to get the method name exactly.

    Hope that helps.

  2. Jeremy Brayton

    arg Markdown! The 1. should be (number sign) above. That should read as 2 lines:

    (comment out) enables hook to check incoming changeset

    pretxnchangegroup.checkfiles = python:/path/to/

    (Repeat for the others)...

  3. Log in to comment