No subject

Tue Sep 18 15:14:02 CDT 2007

The only solution that I currently see is to use the hook as an external 
script, however this would slow down the whole process of updating 

Actually, the idea is to develope an 'hgtrac' extension, that would allow 
specifying where the trac repository resides and the hooks would then talk 
to this particular repository based on hgrc. I would like to contribute 
this to mercurial as I find this dVC very nice to use.

Any input on this topic is welcome,



---------- trace --------
joe at hp:~/junk/test-hg$ echo asdfasdf >> file1.txt ; hg ci -m "ticket 
ref #1" --traceback
calling hook commit: hgtrac.hook
error: commit hook raised an exception: 'unloaded module' object is not 
Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/mercurial/", line 51, in 
    r = obj(ui=ui, repo=repo, hooktype=name, **args)
  File "/home/capekj/junk/hg-hooks/", line 15, in hook
    CommitHook(project = tracenv, author = user, rev = node)
  File "/home/capekj/junk/hg-hooks/", line 133, in 
    self.env = open_environment(project)
  File "/var/lib/python-support/python2.4/trac/", line 462, in 
    env = Environment(env_path)
  File "/var/lib/python-support/python2.4/trac/", line 142, in 
  File "/var/lib/python-support/python2.4/trac/", line 65, in 
    ws = pkg_resources.working_set
  File "/var/lib/python-support/python2.4/mercurial/", line 
74, in __getattribute__
  File "/var/lib/python-support/python2.4/mercurial/", line 
46, in _load
    mod = _origimport(head, globals, locals)
  File "/usr/lib/python2.4/site-packages/", line 2552, in 
    working_set = WorkingSet()
  File "/usr/lib/python2.4/site-packages/", line 384, in 
  File "/usr/lib/python2.4/site-packages/", line 399, in 
    for dist in find_distributions(entry, True):
  File "/usr/lib/python2.4/site-packages/", line 1614, in 
    importer = get_importer(path_item)
  File "/var/lib/python-support/python2.4/mercurial/", line 
70, in __call__
    raise TypeError("'unloaded module' object is not callable")
TypeError: 'unloaded module' object is not callable

The trac repository has the mercurial plugin. My question is 
whether this trac->mercurial-plugin->mercurial depedency is in 
contradiction with what the 

---------- commit hook ------------------------
#!/usr/bin/env python

import sys
from mercurial import hg
from tracpostcommit import CommitHook


def hook(ui, repo, hooktype, node=None, parent1=None, parent2=None, 
    '''mercurial extension to manipulate track tickets associated
    with particular changeset '''

    user = 'joe'

    CommitHook(project = tracenv, author = user, rev = node)

    print>>sys.stderr, 'Commit hook, type %s, node=%s, parent1=%s, 
parent2=%s ' \
        % (hooktype, node, parent1, parent2)

More information about the Mercurial-devel mailing list