Opened 16 years ago
Last modified 8 years ago
#7346 closed defect
Unsupported version control system "hg" — at Version 15
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | plugin/mercurial | Version: | 0.12dev |
Severity: | normal | Keywords: | mercurial tracmercurial hg plugin |
Cc: | sajith@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
The complete error message is:
Unsupported version control system "hg": Can't find an appropriate component, maybe the corresponding plugin was not enabled?
trac.log seems to indicate that that the plugin is found:
2008-06-17 11:17:10,217 Trac[loader] DEBUG: Adding plugin TracMercurial 0.11.0.3 from /Library/Python/2.5/site-packages/TracMercurial-0.11.0.3-py2.5.egg ... 2008-06-17 11:17:11,106 Trac[loader] DEBUG: Loading hg from /Library/Python/2.5/site-packages/TracMercurial-0.11.0.3-py2.5.egg
- OS X 10.5.3
- Python 2.5.1 installed via ports
- Trac 0.11rc2
- TracMercurial 0.11 from svn
Change History (15)
comment:1 by , 16 years ago
Milestone: | 0.11 → not applicable |
---|
comment:3 by , 16 years ago
Cc: | added |
---|
Same problem here. (Trac 0.10.3, TracMercurial 0.10.0.2.) Here's the log:
2008-06-19 00:10:41,613 Trac[__init__] ERROR: Unsupported version control system "hg" Traceback (most recent call last): File "/var/lib/python-support/python2.4/trac/web/main.py", line 387, in dispatch_request dispatcher.dispatch(req) File "/var/lib/python-support/python2.4/trac/web/main.py", line 191, in dispatch chosen_handler = self._pre_process_request(req, chosen_handler) File "/var/lib/python-support/python2.4/trac/web/main.py", line 263, in _pre_process_request chosen_handler = f.pre_process_request(req, chosen_handler) File "/var/lib/python-support/python2.4/trac/versioncontrol/api.py", line 73, in pre_process_request self.get_repository(req.authname) # triggers a sync if applicable File "/var/lib/python-support/python2.4/trac/versioncontrol/api.py", line 91, in get_repository raise TracError('Unsupported version control system "%s"' TracError: Unsupported version control system "hg"
comment:4 by , 16 years ago
sajith: from the same environment where you're running Trac from (e.g. using tracd), are you able to load the mercurial modules from the command line? Try to emulate the sequence of imports done by the hg/backend.py (relevant to your version), e.g. for 0.10 see sandbox/mercurial-plugin/tracvc/hg/backend.py@7218#L37.
jross: it's quite puzzling, as the error message you reported ("… maybe the corresponding plugin was not enabled?" - from the patches on #6796) corresponds to the case where the MercurialConnector is not active. Short of inserting more debug statements manually, I don't know what to suggest next…
Are you sure there's no typo in your backend.py and that the get_supported_types
method returns "hg"?
comment:5 by , 16 years ago
I haven't modified the hg plugin. I checked it out from the head a couple of days ago. I'm not a python hacker, but here's my failed attempt to perform the test:
>>> import backend >>> print backend.has_mercurial False >>> conn = backend.MercurialConnector() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.5/site-packages/Trac-0.11rc2-py2.5.egg/trac/core.py", line 147, in __new__ compmgr = args[0] IndexError: tuple index out of range
And here's a snippet from backend.py:
def get_supported_types(self): """Support for `repository_type = hg`""" global has_mercurial if has_mercurial: yield ("hg", 8)
comment:6 by , 16 years ago
All imports works except this:
>>> from mercurial.revlog import LookupError Traceback (most recent call last): File "<stdin>", line 1, in ? ImportError: cannot import name LookupError
Also:
>>> revlog.REVLOG_DEFAULT_VERSION 65537
This is mercurial 0.9.1-1+etch1, on Debian Etch (4.0, stable). I'll try a new package and update.
comment:7 by , 16 years ago
So I rebuilt mercurial 1.0.1 debian packages from testing/unstable and installed them. It works now. Thanks!
In case anyone is wondering, this is what I did:
dget -x http://ftp.debian.org/debian/pool/main/m/mercurial/mercurial_1.0.1-1.dsc cd mercurial-1.0.1; debuild; cd -; dpkg -i mercurial*.deb
comment:8 by , 16 years ago
Now there's a new problem: I changed repository_dir once to an incorrect directory. After which trac says: "Trac detected an internal error", with this traceback:
Traceback (most recent call last): File "/var/lib/python-support/python2.4/trac/web/main.py", line 387, in dispatch_request dispatcher.dispatch(req) File "/var/lib/python-support/python2.4/trac/web/main.py", line 191, in dispatch chosen_handler = self._pre_process_request(req, chosen_handler) File "/var/lib/python-support/python2.4/trac/web/main.py", line 263, in _pre_process_request chosen_handler = f.pre_process_request(req, chosen_handler) File "/var/lib/python-support/python2.4/trac/versioncontrol/api.py", line 73, in pre_process_request self.get_repository(req.authname) # triggers a sync if applicable File "/var/lib/python-support/python2.4/trac/versioncontrol/api.py", line 101, in get_repository repos = self._connector.get_repository(rtype, rdir, authname) File "build/bdist.linux-i686/egg/tracvc/hg/backend.py", line 82, in get_repository File "build/bdist.linux-i686/egg/tracvc/hg/backend.py", line 148, in __init__ File "/var/lib/python-support/python2.4/mercurial/hg.py", line 60, in repository repo = _lookup(path).instance(ui, path, create) File "/var/lib/python-support/python2.4/mercurial/localrepo.py", line 2135, in instance return localrepository(ui, util.drop_scheme('file', path), create) File "/var/lib/python-support/python2.4/mercurial/localrepo.py", line 46, in __init__ raise repo.RepoError(_("repository %s not found") % path) RepoError: repository /home/scm/hg/ not found
I switched repository_type back to svn, updated repository_dir, and found the same error again. Did a resync, trac still shows the same taceback. Should I file a new bug or is this a known problem?
Thanks.
comment:9 by , 16 years ago
Ok, it's gone away now. Weird, I should have seen the update trac.ini/resync results sooner.
comment:10 by , 16 years ago
Christian,
Are there any scripts, or commands I can run to help diagnose this? You mentioned inserting some print statements. Please let me know what I can do to help.
thanks
comment:11 by , 16 years ago
Hi Jeremy,
You were on the right way with experimenting on the command line. Try the following:
$ PYTHONPATH=. python25 >>> from trac.test import EnvironmentStub >>> env = EnvironmentStub() >>> from tracext.hg.backend import MercurialConnector >>> mc = MercurialConnector(env) >>> list(mc.get_supported_types()) [('hg', 8)] >>> from tracext.hg import backend >>> backend.has_mercurial True
(Note that you don't need the PYTHONPATH=. part if you have installed trac; I use it to run trac from the svn working copy)
comment:12 by , 16 years ago
Thanks for providing this info. Here are the results:
Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from trac.test import EnvironmentStub >>> env = EnvironmentStub() >>> from tracext.hg.backend import MercurialConnector >>> mc = MercurialConnector(env) >>> list(mc.get_supported_types()) [] >>> from tracext.hg import backend >>> backend.has_mercurial False
comment:13 by , 16 years ago
OK - should have guessed it earlier. You only applied one of the patches on #6796, the one for Trac. This enables you to get more info about an load error in Subversion only. You should have applied the second one (attachment:ticket:6796:unsupported-vcs-hg-r7031.diff) to the Mercurial plugin as well and only then the actual import error can be reported (hopefully!).
It's probably something similar to what Sajith had. One of these days, someone should really update the compatibility matrix (Trac plugin versions vs. Mercurial versions) in TracMercurial …
comment:14 by , 16 years ago
I forgot to patch again after I did a fresh svn co to get the latest code. Here ya go:
>>> from trac.test import EnvironmentStub >>> env = EnvironmentStub() >>> from tracext.hg.backend import MercurialConnector >>> mc = MercurialConnector(env) >>> list(mc.get_supported_types()) [('hg', -1)] >>> from tracext.hg import backend >>> backend.has_mercurial Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'has_mercurial'
comment:15 by , 16 years ago
Description: | modified (diff) |
---|
We're getting closer :-)
In the above, replace
>>> backend.has_mercurial
by:
>>> backend.error
and you should see the actual error message, the one you should now also get in Trac itself.
The trac.log output doesn't tell you whether the plugin is enabled or not. For that, you have to log in as an user with TRAC_ADMIN permission, and look in the Admin pages, General / Plugins. Do you see the entry for the TracMercurial plugin there? If yes, is the MercurialConnector component enabled?