【问题标题】:TortoiseHg error running HGTortoiseHg 运行 HG 时出错
【发布时间】:2015-12-08 05:19:15
【问题描述】:

将本地存储库推送到位于 Windows 7 网络共享上的主存储库时遇到错误。我在主存储库上添加了一个挂钩,以便在推送时执行“hg update”。当我从 TortoiseHg 中的本地存储库运行推送时,我在控制台中收到此错误:

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

推送发生,但未成功执行挂钩。此外,似乎我一直在命令行中运行“hg”命令时都会收到此错误,除非在 C:\Program Files\TortoiseHg 目录中运行它。我已将“C:\Program Files\TortoiseHg”放在PATH 环境变量中,但没有任何成功。系统是 Windows 7 x64。

一般来说,TortoiseHg 似乎可以工作,例如提交、更新、推送、拉取……但是像钩子这样的更精细的细节似乎不起作用。我只安装了 Tortoise 3.5.1,没有任何 Mercurial 或 Python。这是我安装它的地方:

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

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

有人可以帮助我吗?我在 StackOverflow 上看到过类似的问题,但该人同时安装了 Mercurial 和 TortoiseHg。

那么,为什么我在命令行中运行 hg 时会出现这些错误?为什么从 TortoiseHg GUI 推送没有成功执行远程存储库上的钩子?

【问题讨论】:

    标签: mercurial hook push tortoisehg


    【解决方案1】:

    如果回溯来自推送目标,那么

    • 拥有 Python 2.6('File "c:\Python26\lib\site-packages\py2exe\boot_common.py"...')
    • Mercurial 3.5(因此也包括 TortoiseHG)放弃了与 Python 2.6、AFAICR 的兼容性,但是:

    THG 使用 Python 的模块,如果 $PYTHON 部分在 PATH 中更早,并且 hg 在 THG 主页之外调用(在后一种情况下与使用的 THG 模块捆绑在一起);和pwd 用于运行钩子总是repo-dir

    更改 PATH 中的顺序(TBT!)或将 Python 更新到 2.7 或从 PATH 中删除当前 Python

    为什么从 TortoiseHg GUI 推送没有成功执行远程存储库上的钩子?

    因为:

    1. hook 是 push-target 任务,与 push-source 无关
    2. 服务器端的hg(在hook中调用)有问题,与客户端的THG无关

    【讨论】:

    • 谢谢。我已经将 THG 路径移到了 PATH 变量的早期......并且 hg push 开始工作得很好。我有很多其他 python 版本,来自 Octave、mingw 等。使用路径变量 order 似乎可以解决问题。再次感谢。
    猜你喜欢
    • 2013-11-13
    • 2012-02-10
    • 1970-01-01
    • 2016-08-25
    • 1970-01-01
    • 1970-01-01
    • 2013-04-30
    • 1970-01-01
    • 2014-08-22
    相关资源
    最近更新 更多