我已经使用 mercurial 大约一年了,没有任何问题。

今天我第一次遇到一个问题。

当我尝试推送到远程服务器时

$ hg push

我得到以下回复
searching for changes
remote: abort: No space left on device
abort: unexpected response: empty string

我在谷歌上搜索了这个问题,发现它是一个记录在案的问题,我从 Mercurial FAQ 中找到了以下摘录:



我在我的 /etc/mercurial/hgrc 文件中创建了看起来像这样的钩子(Hook)
[hooks]
pre-serve.tmpdir = python:hgenviron.settmpdir

然后我应该创建 hgenviron.py
import os
#see http://docs.python.org/lib/module-tempfile.html
def settmpdir(ui, repo, hooktype, node=None, source=None, **kwargs):
        os.environ["TMPDIR"] = "/home/tmp"

我遇到的问题是我不知道如何将此文件添加到 Fedora 中的 $PYTHONPATH
我的操作系统是 Fedora 12 x86_64
我有 python 2.6
我有 mercurial 1.6.4

更新:

我刚刚将 hgenviron.py 添加到 /usr/lib/python2.6/site-packages/hg/hgenviron.py
PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages/hg/hgenviron.py
export PYTHONPATH

.sh 中的 /etc/profile.d 文件,以及 /etc/mercurial/ 中的钩子(Hook)。

但是我仍然收到错误:
remote: abort: pre-serve.tmpdir hook is invalid (import of "hgenviron" failed) abort:
no suitable response from remote hg!

最佳答案

问题是使用了错误的导入语句。应该是 from hg import hgenviron
用于设置 PYTHONPATH 取决于您想要添加它的方式/位置。

/etc/profile.d 中,您可以找到一组在加载 bash 时运行的脚本。 /etc/profile 是全局文件,它调用脚本并具有以下注释:

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT good idea to change this file unless you know what you
# are doing. Much better way is to create custom.sh shell script in
# /etc/profile.d/ to make custom changes to environment. This will
# prevent need for merging in future updates.
/etc/profile 在 bash 环境加载时运行。在用户本地,您可以编辑 ~/.bash_profile~/.bashrc(如果它们不存在,您可以创建它们)。这些脚本在特定用户登录时运行。您应该详细检查这些文件以了解如何创建和设置环境。

你会添加这样的东西:
PYTHONPATH=/home/tmp:$PYTHONPATH
export PYTHONPATH

关于python - 无法重置/tmp 值以插入 mercurial 更改,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5767951/

10-14 16:49
查看更多