#10851 closed defect (fixed)
Mercurial 2.3.1 seems to be broken with trac 1.0 — at Version 16
Reported by: | anonymous | Owned by: | Christian Boos |
---|---|---|---|
Priority: | high | Milestone: | plugin - mercurial |
Component: | plugin/mercurial | Version: | 1.0 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Added compatibility with Mercurial 2.3 (hg:1ac628cd7113) |
||
API Changes: | |||
Internal Changes: |
Description
I used mercurial all the time with trac 0.12 and it worked.
I updated from trac 0.12 to trac 1.0 the last days.
Unfortunately I didnt realise the exact moment when the repository browser did stop to work.
In the trac log I see:
2012-09-12 15:31:46,782 Trac[loader] ERROR: Skipping "trac.mimeview.rst = trac.mimeview.rst [rest]": Traceback (most recent call last): File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\loader.py", line 68, in _load_eggs entry.load(require=True) File "d:\Programme\python27\lib\site-packages\distribute-0.6.28-py2.7.egg\pkg_resources.py", line 2017, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "d:\Programme\python27\lib\site-packages\mercurial\demandimport.py", line 114, in _demandimport mod = _origimport(name, globals, locals) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\mimeview\rst.py", line 157, in <module> rst.directives.register_directive('trac', trac_directive) File "d:\Programme\python27\lib\site-packages\mercurial\demandimport.py", line 87, in __getattribute__ return getattr(self._module, attr) AttributeError: 'module' object has no attribute 'directives'
My platform:
- windows 7 64 bit
- python 2.7.3 (32 bit)
I reinstalled the following packages in exact that order:
- 'distribute-0.6.28.tar.gz'
- 'Babel-0.9.6.zip'
- 'docutils-0.9.1.tar.gz'
- 'Genshi-0.6.zip'
- 'Jinja2-2.6.tar.gz'
- 'Pygments-1.5.tar.gz'
- 'Sphinx-1.1.3.tar.gz'
- 'pyreadline-1.7.1.zip'
- 'ipython-0.13.zip'
- 'mercurial-2.3.1.tar.gz
- 'Trac-1.0.zip'
I use the plugins:
- TracAccountManager-0.4dev-py2.7.egg
- TracWysiwyg-0.12.0.3-py2.7.egg
- TracMercurial-1.0.0.1dev-py2.7.egg
But the error remains.
If I try to sync my hg repo called util in trac-admin I get the following error:
Trac [U:\trac]> repository sync util TracError: Unsupported version control system "hg": No module named repo Trac [U:\trac]>
Any hints?
Change History (16)
comment:1 by , 12 years ago
follow-up: 3 comment:2 by , 12 years ago
Weird. I couldn't reproduce, with the following:
- distribute-0.6.25 (vs .28)
- docutils-0.9.1
- mercurial-2.3.1
However, if I comment out the demandimport.disable()
line in tracext/hg/backend.py, then I get the same error:
9840 Trac[cblaptop-trac:_log_error() in c:\Trac\repos\trunk\trac\loader.py:59] ERROR: Skipping "trac.mimeview.rst = trac.mimeview.rst [rest]": Traceback (most recent call last): File "c:\Trac\repos\trunk\trac\loader.py", line 68, in _load_eggs entry.load(require=True) File "C:\Dev\Python272\lib\site-packages\pkg_resources.py", line 1989, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "c:\workspace\src\hg\mpm-hg\mercurial\demandimport.py", line 114, in _demandimport mod = _origimport(name, globals, locals) File "c:\Trac\repos\trunk\trac\mimeview\rst.py", line 157, in <module> rst.directives.register_directive('trac', trac_directive) File "c:\workspace\src\hg\mpm-hg\mercurial\demandimport.py", line 87, in __getattribute__ return getattr(self._module, attr) AttributeError: 'module' object has no attribute 'directives'
So the real problem on your side is that demandimport
stays enabled… Are you loading anything else using Mercurial?
comment:3 by , 12 years ago
Replying to cboos:
So the real problem on your side is that
demandimport
stays enabled… Are you loading anything else using Mercurial?
Hmm i do not know how thisdemandimport
works, however I have
TortoiseHg 2.5 with Mercurial 2.3.1 - x64 Windows
http://bitbucket.org/tortoisehg/files/downloads/tortoisehg-2.5.0-hg-2.3.1-x64.msi
installed too (while my d:\Programme\python27\lib\site-packages\mercurial is installed from source and since my python is 32 bit → this one is 32 bit too).
The where comand lists the hg's found:
D:\>where hg D:\Programme\TortoiseHg\hg.exe d:\Programme\Python27\Scripts\hg d:\Programme\Python27\Scripts\hg.bat
But I just renamed my D:\Programme\TortoiseHg
to D:\Programme\TortoiseHg.hidden
The where comand lists now the hg's found:
D:\>where hg d:\Programme\Python27\Scripts\hg d:\Programme\Python27\Scripts\hg.bat
but the problem remains
follow-up: 5 comment:4 by , 12 years ago
Just another question: Howto download the actual mercurial plugin from the TracMercurial page.
I realized that I can download the Trac project as zip but not the mercurial plugin. Due to the internet settings in my company I cannot use:
hg clone http://hg.edgewall.org/mercurial-plugin
… it doesnt work.
So my question: could you provide a link to a zip download? (I got the actual 1.0.0.1 trac mercurial plugin by browsing through the sources and download every file manually)
Thanks
follow-up: 6 comment:5 by , 12 years ago
Replying to anonymous:
I realized that I can download the Trac project as zip but not the mercurial plugin.
Good point, that was an omission. I have now enabled zip downloads for plugins.
follow-up: 8 comment:6 by , 12 years ago
Replying to rblank:
Replying to anonymous:
I realized that I can download the Trac project as zip but not the mercurial plugin.
Good point, that was an omission. I have now enabled zip downloads for plugins.
Hmmm unfortunately it doesnt work for the actual 1.0.0.1 version, if you look in TracMercurial at the line:
1.0.0.1 mercurial-plugin@28d2535d682f (1.0 branch)
Does it not work with mercurial (or git) repositorys?
comment:7 by , 12 years ago
Actually, I've found that there's some kind of compatibility issue between Mercurial 2.3.1 and TracMercurial at even version 0.12.0.29. I am using Trac 0.12.3.
I get the Unsupported version control system "hg": No module named repo error any place in the Trac application where integration with a Mercurial repository would take place, like the source browser, or the integrated changeset viewer.
Downgrading Mercurial to 2.2.3 fixed the problem.
comment:8 by , 12 years ago
Replying to anonymous:
Hmmm unfortunately it doesnt work for the actual 1.0.0.1 version, if you look in TracMercurial at the line:
Oh, right, it's now developed in a separate repository. I had missed that. Enabled zip download for that, too.
comment:9 by , 12 years ago
Keywords: | needinfo added |
---|
To the original poster: if you built and installed Mercurial yourself, then you could patch it that way:
-
mercurial/demandimport.py
diff -r 4b25077ae7ee mercurial/demandimport.py
a b 148 148 149 149 def enable(): 150 150 "enable global demand-loading of modules" 151 import traceback 152 traceback.print_stack() 151 153 __builtin__.__import__ = _demandimport 152 154 153 155 def disable(): 154 156 "disable global demand-loading of modules" 157 import traceback 158 traceback.print_stack() 155 159 __builtin__.__import__ = _origimport
in order to find out what activates/deactivates demandimport
.
comment:10 by , 12 years ago
Hi,
I changed the demandimport.py file like this:
print "Import of module mercurial/demandimport.py ------------------------" ... ... def enable(): "enable global demand-loading of modules" import traceback print " enable called -----------------" traceback.print_stack() __builtin__.__import__ = _demandimport def disable(): "disable global demand-loading of modules" import traceback print " disable called -----------------" traceback.print_stack() __builtin__.__import__ = _origimport
here is the new output catched from the console window:
10:03:38 Trac[loader] DEBUG: Loading acct_mgr.svnserve from u:\trac\tooling\plugins\tracaccountmanager-0.4dev-py2.7.egg 10:03:38 Trac[loader] DEBUG: Loading acct_mgr.web_ui from u:\trac\tooling\plugins\tracaccountmanager-0.4dev-py2.7.egg 10:03:38 Trac[loader] DEBUG: Loading hg from u:\trac\tooling\plugins\tracmercurial-1.0.0.1dev-py2.7.egg Import of module mercurial/demandimport.py ------------------------ enable called ----------------- File "d:\Programme\python27\lib\threading.py", line 524, in __bootstrap self.__bootstrap_inner() File "d:\Programme\python27\lib\threading.py", line 551, in __bootstrap_inner self.run() File "d:\Programme\python27\lib\threading.py", line 504, in run self.__target(*self.__args, **self.__kwargs) File "d:\Programme\python27\lib\SocketServer.py", line 582, in process_request_thread self.finish_request(request, client_address) File "d:\Programme\python27\lib\SocketServer.py", line 323, in finish_request self.RequestHandlerClass(request, client_address, self) File "d:\Programme\python27\lib\SocketServer.py", line 638, in __init__ self.handle() File "d:\Programme\python27\lib\BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\web\wsgi.py", line 191, in handle_one_request gateway.run(self.server.application) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\web\wsgi.py", line 91, in run response = application(self.environ, self._start_response) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\web\standalone.py", line 59, in __call__ return self.application(environ, start_response) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\web\standalone.py", line 91, in __call__ return self.application(environ, start_response) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\web\main.py", line 438, in dispatch_request env = open_environment(env_path, use_cache=not run_once) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\env.py", line 830, in open_environment env = env_cache.setdefault(env_path, open_environment(env_path)) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\env.py", line 834, in open_environment env = Environment(env_path) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\core.py", line 124, in __call__ self.__init__(*args, **kwargs) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\env.py", line 284, in __init__ self.setup_config() File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\env.py", line 599, in setup_config load_components(self, plugins_dir and (plugins_dir,)) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\loader.py", line 114, in load_components loadfunc(env, search_path, auto_enable=plugins_dir) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\loader.py", line 68, in _load_eggs entry.load(require=True) File "d:\Programme\python27\lib\site-packages\distribute-0.6.28-py2.7.egg\pkg_resources.py", line 2017, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "build\bdist.win32\egg\tracext\hg\backend.py", line 64, in <module> demandimport.enable(); File "d:\Programme\python27\lib\site-packages\mercurial\demandimport.py", line 153, in enable traceback.print_stack() 10:03:38 Trac[loader] DEBUG: Loading trac.about from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:38 Trac[loader] DEBUG: Loading trac.admin.console from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:38 Trac[loader] DEBUG: Loading trac.admin.web_ui from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:38 Trac[loader] DEBUG: Loading trac.attachment from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:39 Trac[loader] DEBUG: Loading trac.db.mysql from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:39 Trac[loader] DEBUG: Loading trac.db.postgres from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:39 Trac[loader] DEBUG: Loading trac.db.sqlite from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:39 Trac[loader] DEBUG: Loading trac.mimeview.patch from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:39 Trac[loader] DEBUG: Loading trac.mimeview.pygments from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:39 Trac[loader] DEBUG: Loading trac.mimeview.rst from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:39 Trac[loader] ERROR: Skipping "trac.mimeview.rst = trac.mimeview.rst [rest]": Traceback (most recent call last): File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\loader.py", line 68, in _load_eggs entry.load(require=True) File "d:\Programme\python27\lib\site-packages\distribute-0.6.28-py2.7.egg\pkg_resources.py", line 2017, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "d:\Programme\python27\lib\site-packages\mercurial\demandimport.py", line 114, in _demandimport mod = _origimport(name, globals, locals) File "d:\Programme\python27\lib\site-packages\trac-1.0-py2.7.egg\trac\mimeview\rst.py", line 157, in <module> rst.directives.register_directive('trac', trac_directive) File "d:\Programme\python27\lib\site-packages\mercurial\demandimport.py", line 87, in __getattribute__ return getattr(self._module, attr) AttributeError: 'module' object has no attribute 'directives' 10:03:39 Trac[loader] DEBUG: Loading trac.mimeview.txtl from d:\programme\python27\lib\site-packages\trac-1.0-py2.7.egg 10:03:39 Trac[loader] DEBUG: Skipping "trac.mimeview.txtl = trac.mimeview.txtl [textile]": ("DistributionNotFound: textile>=2.0" not found)
comment:11 by , 12 years ago
I also had problems with Mercurial 2.3.1, but I did get a useful error message from the commit_updater hook. I guess it might be a different problem, but who knows when demandimport is involved. Here's the error message I saw:
remote: TracError: Unsupported version control system "hg": No module named repo remote: trac-admin failed with return code 2 for environment: remote: /var/trac/kdp remote: warning: changegroup hook failed
And here's what I did to fix it:
diff --git a/tracext/hg/backend.py b/tracext/hg/backend.py --- a/tracext/hg/backend.py +++ b/tracext/hg/backend.py @@ -86,10 +86,10 @@ hg_import_error = "Couldn't import symbols: "+','.join(hg_import_error) # Mercurial versions >= 1.2 won't have mercurial.repo.RepoError anymore - from mercurial.repo import RepoError + #from mercurial.repo import RepoError from mercurial.revlog import LookupError as HgLookupError - if repr(RepoError) == "<unloaded module 'RepoError'>": - from mercurial.error import RepoError, LookupError as HgLookupError + #if repr(RepoError) == "<unloaded module 'RepoError'>": + # from mercurial.error import RepoError, LookupError as HgLookupError # Force local encoding to be non-lossy (#7217) os.environ['HGENCODING'] = 'utf-8'
This is against 28d2535d682f. I guessed it might be okay to deprecate hg < 1.2, so I didn't look into doing a more involved fix.
comment:12 by , 12 years ago
Keywords: | needinfo removed |
---|---|
Milestone: | → 1.0.1 |
Thanks Dirkjan. I think there's indeed a problem with the way we report errors and with that init code in general… and I just spotted a repo.pyc
dangling file in my mercurial checkout which might explain a lot ;-)
comment:13 by , 12 years ago
Component: | version control → plugin/mercurial |
---|
As a side-note, looking up the mercurial/repo.py file in the repository of Mercurial itself is a typical use case for triggering #10719… Also time to do something about that one.
comment:14 by , 12 years ago
Milestone: | 1.0.1 → plugin - mercurial |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Should be fixed by [45f04cd0ada8/mercurial-plugin] (for 0.12) and [62e59cafa3de/mercurial-plugin] (for 1.0).
comment:15 by , 12 years ago
Owner: | set to |
---|
comment:16 by , 12 years ago
Release Notes: | modified (diff) |
---|
I suppose there are several issues here… Possibly a problem with Mercurial 2.3.1 itself, but the immediate problems seems to be that Mercurial's
demandimport
is still active while it shouldn't and that docutils 0.9.1 also has a few issues.Thanks for the detailed report, I should be able to reproduce the issue.