无法重置/tmp值以推送多变的更改

2024-09-30 02:29:25 发布

您现在位置:Python中文网/ 问答频道 /正文

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

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

当我试图用

$ hg push

我得到以下回应

^{pr2}$

我在google上搜索了这个问题,发现它是一个有文档记录的问题,我发现了以下摘录自Mercurial FAQ

4.28. I get a "no space left" or "disk quota exceeded" on push

I get a "no space left" or "disk quota exceeded" on push, but there is plenty of space or/and I have no quota limit on the device where the remote hg repository is.

The problem comes probably from the fact that mercurial uses /tmp (or one of the directory define by environment variables $TMPDIR, $TEMP or $TMP) to uncompress the bundle received on the wire. The decompression may then reach device limits.

You can of course set $TMPDIR to another location on remote in the default shell configuration file, but it will be potentially used by other processes than mercurial. Another solution is to set a hook in a global .hgrc on remote. See the description of how to set a hook for changing tmp directory on remote when pushing.

我在/etc/mercurial/hgrc文件中创建了一个钩子,如下所示

[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\u 64
我有python2.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 

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

但是我仍然得到错误:

remote: abort: pre-serve.tmpdir hook is invalid (import of "hgenviron" failed) abort: 
no suitable response from remote hg!

Tags: orofthetonopyremoteis
2条回答

问题是使用了错误的import语句。它应该是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或{}(如果它们不存在,您可以创建它们)。这些脚本在特定用户登录时运行。您应该详细检查这些文件,以了解如何创建和设置环境。在

您可以添加如下内容:

^{pr2}$

如果您正努力弄清PYTHONPATH问题的底部,您可以明确说明hgenviron.py公司文件。在

pre-serve.tmpdir = python:/var/hg/hgenviron.py:settmpdir

请注意,settmpdir随后使用:而不是原始示例中的.调用。在

相关问题 更多 >

    热门问题