Tuesday, January 8, 2013

TortoiseHg: ImportError: No module named repo

Problem:
I updated my TortoiseHg from version 2.4 to 2.6.2. When I try to launch Hg Workbench for the 1st time, it shows the following error:

    #!python
    ** Mercurial version (2.4.2).  TortoiseHg version (2.6.2)
    ** Command: --nofork workbench
    ** CWD: C:\Code
    ** Encoding: cp1252
    ** Extensions loaded: hgsubversion
    ** Python version: 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
    ** Windows version: sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1')
    ** Processor architecture: x86
    ** Qt-4.8.0 PyQt-4.9.1
    Traceback (most recent call last):
      File "tortoisehg\hgqt\workbench.pyo", line 564, in openRepo
      File "tortoisehg\hgqt\workbench.pyo", line 934, in _openRepo
      File "tortoisehg\hgqt\thgrepo.pyo", line 53, in repository
      File "mercurial\hg.pyo", line 111, in repository
      File "mercurial\hg.pyo", line 106, in _peerorrepo
      File "C:\Code\hgsubversion\hgsubversion\__init__.py", line 179, in reposetup
      File "mercurial\demandimport.pyo", line 86, in __getattribute__
      File "mercurial\demandimport.pyo", line 58, in _load
      File "C:\Code\hgsubversion\hgsubversion\svnrepo.py", line 99, in <module>
      File "mercurial\demandimport.pyo", line 86, in __getattribute__
      File "mercurial\demandimport.pyo", line 58, in _load
    ImportError: No module named repo

Solution:
It was actually caused by the out-dated hgsubversion extension.

1. goto TortoiseHg -> Global Settings
2. Extensions -> Edit File
3. comment out the hgsubversion variable with #
4. Hg Workbench should launch correctly now
5. update to the latest version of hgsubversion
6. re-enable the extension


Ref:
tortoisehg / thg / issues / #2090 - No module named repo — Bitbucket

1 comment:

Anonymous said...

Thank You! It helped me.