No subject


Tue Sep 18 20:14:02 UTC 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 
tickets.

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,

thanks

Jan

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

tracenv='/var/local/trac/testing'

def hook(ui, repo, hooktype, node=None, parent1=None, parent2=None, 
**kwargs):
    '''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