Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
克隆mercurial存储库.hgsub指的是一个死的外部子存储库_Mercurial - Fatal编程技术网

克隆mercurial存储库.hgsub指的是一个死的外部子存储库

克隆mercurial存储库.hgsub指的是一个死的外部子存储库,mercurial,Mercurial,我们正在尝试克隆Mercurial存储库a,其中它引用了已移动主机的子存储库B。我们想更新A中的.hgsub以指向B的新位置,但如果我们不能首先克隆A,这将是一个鸡和蛋的问题 有人知道如何解决这个问题吗?$hg help subrepos $ hg help subrepos ... Remapping Subrepositories Sources --------------------------------- A subrepository source lo

我们正在尝试克隆Mercurial存储库a,其中它引用了已移动主机的子存储库B。我们想更新A中的.hgsub以指向B的新位置,但如果我们不能首先克隆A,这将是一个鸡和蛋的问题

有人知道如何解决这个问题吗?

$hg help subrepos
$ hg help subrepos
...

    Remapping Subrepositories Sources
    ---------------------------------

    A subrepository source location may change during a project life,
    invalidating references stored in the parent repository history. To fix
    this, rewriting rules can be defined in parent repository "hgrc" file or
    in Mercurial configuration. See the "[subpaths]" section in hgrc(5) for
    more details.

$ man hgrc
...

   subpaths
       Defines subrepositories source locations rewriting rules of the form:

       <pattern> = <replacement>

       Where  pattern  is  a regular expression matching the source and replacement is the replacement string used to
       rewrite it. Groups can be matched in pattern and referenced in replacements. For instance:

       http://server/(.*)-hg/ = http://hg.server/\1/

       rewrites http://server/foo-hg/ into http://hg.server/foo/.

       All patterns are applied in definition order.

...
... 重新映射子存储库源 --------------------------------- 子存储库源位置可能在项目生命周期内发生变化, 使存储在父存储库历史记录中的引用无效。修理 这样,可以在父存储库“hgrc”文件或 在变化无常的配置中。有关详细信息,请参见hgrc(5)中的“[子路径]”部分 更多细节。 $man hgrc ... 小径 定义表单的子存储库源位置重写规则: = 其中pattern是与源匹配的正则表达式,replacement是用于 重写它。组可以在模式中匹配,并在替换中引用。例如: http://server/(.*)hg/=http://hg.server/\1/ 重写http://server/foo-hg/ 进入http://hg.server/foo/. 所有模式都按定义顺序应用。 ...
因此,您可以在
.hgrc
中的
[子路径]
部分执行此操作。

首先请注意,克隆是init+pull+update,子repo克隆是更新步骤的一部分,而不是pull步骤。这意味着您只需跳过更新步骤即可避免克隆失败:

$ hg clone -U <url>
现在您可以手动修复Subrepo和.hgsub并提交。在推送修复之前,请确保使用克隆测试修复


另外,请参阅以下主题的邮件列表帖子:

我也不知道怎么做,所以答案正好显示了我是如何找到它的
hg-help
man
都是很好的实用工具。
$ hg revert -a -r default -X problematic-file
[adding a bunch of files]
$ hg debugrebuildstate -r default