2

I'm running into an error when pushing a local repository to the master repository located on a network share in Windows 7. I've added a hook on the master repository to perform "hg update" on push. When I'm running push from the local repository in the TortoiseHg, I get this error in the console:

Traceback (most recent call last):
  File "c:\Python26\lib\site-packages\py2exe\boot_common.py", line 92, in <module>
ImportError: No module named linecache
Traceback (most recent call last):
  File "<install zipextimporter>", line 1, in <module>
ImportError: No module named zipextimporter
Traceback (most recent call last):
  File "hg", line 10, in <module>
ImportError: No module named os
warning: changegroup hook exited with status 255

The push happens, but does not successfully execute the hook. Furthermore, it seems I get this error all the time I run the "hg" command in the command line, except when running it inside the C:\Program Files\TortoiseHg directory. I've put the "C:\Program Files\TortoiseHg" in the PATH environment variable, but without any success. The system is Windows 7 x64.

In general TortoiseHg seem to work, like commit, update, push, pull... But finer details like hooks seem to not work. I've installed Tortoise 3.5.1 ONLY, without any Mercurial or Python. Here is where I've installed it from:

http://bitbucket.org/tortoisehg/files/downloads/tortoisehg-3.5.1-x64.msi

http://tortoisehg.bitbucket.io/download/index.html

Can somebody help me? I've seen a similar question on StackOverflow, but the person had both Mercurial and TortoiseHg installed.

So, why do I get these errors when running hg in the command line? Why pushing from TortoiseHg GUI doesn't successfully execute the hook on the remote repository?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Lav
  • 21
  • 2

1 Answers1

0

If traceback is from push-target, then

  • You have Python 2.6 on it ('File "c:\Python26\lib\site-packages\py2exe\boot_common.py"...')
  • Mercurial 3.5 (thus - TortoiseHG also) dropped compatibility with Python 2.6, AFAICR, but:

THG uses Python's modules, if $PYTHON part is earlier in PATH and hg called outside THG home (in the latter case bundled with THG modules used); and pwd for running hook is always repo-dir

Change order in PATH (TBT!) or update Python to 2.7 or remove current Python from PATH

Why pushing from TortoiseHg GUI doesn't successfully execute the hook on the remote repository?

Because:

  1. hook is push-target task, unrelated to push-source
  2. You have troubles with hg (called in hook) on server's side, which are not related to client's THG
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Thanks. I've moved the THG path to be early in the PATH variable... and hg push started to work great. I have a tons of other python versions, from Octave, mingw etc. Playing with the path variable order seemed to do the trick. Thanks again. – Lav Sep 14 '15 at 19:08