Mercurial:启用git subrepo

时间:2018-03-30 16:31:35

标签: git configuration mercurial

最近,默认情况下禁用此行为。该消息提示您检查帮助页面,但它没有帮助,至少它没有帮助我。

 "subrepos"
    ----------

    This section contains options that control the behavior of the
    subrepositories feature. See also 'hg help subrepos'.

    Security note: auditing in Mercurial is known to be insufficient to
    prevent clone-time code execution with carefully constructed Git subrepos.
    It is unknown if a similar detect is present in Subversion subrepos. Both
    Git and Subversion subrepos are disabled by default out of security
    concerns. These subrepo types can be enabled using the respective options
    below.

    "allowed"
        Whether subrepositories are allowed in the working directory.

        When false, commands involving subrepositories (like 'hg update') will
        fail for all subrepository types. (default: true)

    "hg:allowed"
        Whether Mercurial subrepositories are allowed in the working
        directory. This option only has an effect if "subrepos.allowed" is
        true. (default: true)

    "git:allowed"
        Whether Git subrepositories are allowed in the working directory. This
        option only has an effect if "subrepos.allowed" is true.

        See the security note above before enabling Git subrepos. (default:
        false)

    "svn:allowed"
        Whether Subversion subrepositories are allowed in the working
        directory. This option only has an effect if "subrepos.allowed" is
        true.

        See the security note above before enabling Subversion subrepos.
        (default: false)

我认为它是在项目的hgrc中添加以下内容:

[subrepos]
git:allowed

但它给出了解析错误。有谁知道正确的格式?而且,为什么他们决定禁用它?每次我结账这个项目,我都要做出这个改变吗?

3 个答案:

答案 0 :(得分:11)

.hgrc文件中,您必须添加:

[subrepos]
git:allowed = true

答案 1 :(得分:2)

在Debian 8 docker容器(Mercurial版本3.1.2)中,在将回购和子回购迁移到phabricator之后,mercurial停止为我们工作。报告:

abort: subrepo type git not allowed
(see 'hg help config.subrepos' for details)

首先,要查看它的帮助

hg help subrepos

但这没用。上面为.hgrc建议的语法对我们不起作用。但这确实做到了:

[subrepos]
allowed = hg git

答案 2 :(得分:0)

我在~/.hgrc配置中使用了以下内容,并验证了allowedgit:allowed均按预期启用和禁用了功能。

[subrepos]
allowed = True
hg:allowed = True
git:allowed = True
svn:allowed = True