Mercurial:启用 git 子仓库

Mercurial: enable git subrepo

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

 "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

但是它给出了解析错误。有谁知道正确的格式?而且,为什么他们决定禁用它?每次签出这个项目时,我都必须进行此更改?

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

[subrepos]
git:allowed = true

在 Debian 8 docker 容器中,Mercurial 版本 3.1.2,在将 repos 和 subrepos 迁移到 phabricator 后,mercurial 停止为我们工作。据报道:

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

首先,看到帮助而已

hg help subrepos

但这没有用。上面建议的 .hgrc 语法对我们不起作用。然而,这样做了:

[subrepos]
allowed = hg git

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

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