gpt4 book ai didi

Mercurial to Bitbucket - Subrepository - Repository is unrelated error

转载 作者:行者123 更新时间:2023-12-04 16:47:42 29 4
gpt4 key购买 nike

以下是我为构建 repo 和 subrepos 所采取的步骤。

一切都托管在 Bitbucket 上。

  • 根据最佳实践,创建了一个骨架存储库来保存所有子存储库。克隆到我的机器上。
  • 将主项目克隆为 subrepo1(在 mainrepo 目录结构中)。
  • 将主项目作为 subrepo1 添加到 mainrepo。
  • mainrepo 的 promise 按预期工作。
  • 成功推送 mainrepo 和 subrepo1 到 Bitbucket。
  • 继续将另一个 subrepo2 克隆到 mainrepo 目录。
  • 将 subrepo2 添加到 mainrepo 作为 subrepo2
  • mainrepo 的 promise 按预期工作。
  • 在“搜索更改”之后推送 mainrepo 导致“Repository is unrrelated”错误 错误仅发生在新添加的 subrepo2 上。

  • 下面是目录结构:
    主仓库
    --subrepo1(主项目)
    --subrepo2(类库)

    我花了无数个小时试图让这个工作,我一定错过了一些明显的东西。

    是什么导致了这个错误,我错过了什么?
    随着项目的发展,我需要能够添加额外的子存储库。

    最佳答案

    我为制作示例而采取的步骤如下:

  • 创建 MainRepo关于 BitBucket
  • 创建 SubRepo关于 BitBucket
  • 克隆 MainRepo
  • 克隆 SubRepo作为 MainRepo 的子目录
  • 手动创建 .hgsub包含内容的文件 SubRepo = ../SubRepo
  • 添加 .hgsub文件到 MainRepo ,提交并推送
  • 创建 SubRepo2关于 BitBucket
  • 克隆 SubRepo2作为 MainRepo 的子目录
  • 手动编辑 .hgsub并添加 SubRepo2 = ../SubRepo2
  • 提交和推送 MainRepo再次

  • 从那时起,我可以编辑两个子存储库中的任何一个,并在查看 MainRepo 时看到它们发生了变化。在工作台上。然后我可以将更改提交到子存储库,在 MainRepo 中提交子存储库状态并从 MainRepo 一次推送所有三个存储库
    您在另一个问题( subrepo = subrepo )中所说的由 TortoiseHg 设置的方式不适用于 BitBucket,因为它们的结构如何。我认为您只能像这样在顶级存储库:
    bitbucket.org/SteveKaye/MainRepo
    bitbucket.org/SteveKaye/SubRepo
    而有线路 subrepo = subrepo正在尝试建立这样的结构:
    bitbucket.org/SteveKaye/MainRepo
    bitbucket.org/SteveKaye/MainRepo/SubRepo
    当你插入它时,它看起来像是试图插入 SubRepo进入 MainRepo这将解释您收到的不相关的存储库错误消息。 .hgsub语法是这样的,等号的左边定义了工作副本中存储库所在的文件夹,等号的右边定义了从哪里获取它。当等号右边是相对路径时,它定义了子存储库相对于主存储库在中央服务器上的位置。所以在上面的例子中,你上一个文件夹到 bitbucket.org/SteveKayeSubRepo包含在该文件夹中。
    文档说:

    The source path of a Mercurial repository can either be a relative or absolute path or URL. It is generally recommended to use trivial relative paths where the source path is the same as the working dir path: This will ensure that the subrepositories always can be found 'in place'.

    Other relative paths can be used if the subrepositories can't be hosted 'in place', for example because of limitations of a central repository or hosting service. A consequence of using such non-trivial relative paths is that clones can't be cloned.


    这看起来与您使用 BitBucket 时的情况有关,我希望您的克隆不能像最后一句中所说的那样进行克隆。

    关于Mercurial to Bitbucket - Subrepository - Repository is unrelated error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13886914/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com