Mercurial到Bitbucket-子存储库-存储库不相关的错误 [英] Mercurial to Bitbucket - Subrepository - Repository is unrelated error

查看:56
本文介绍了Mercurial到Bitbucket-子存储库-存储库不相关的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我构建存储库和子存储库所采取的步骤.

Here are the steps I've taken to build the repo and subrepos.

所有内容都托管在Bitbucket上.

Everything is hosted on Bitbucket.

  1. 按照最佳做法,创建了一个框架存储库来保存所有子存储库.克隆到我的机器上.
  2. 将主项目克隆为subrepo1(在mainrepo目录结构内).
  3. 将主要项目作为subrepo1添加到mainrepo.
  4. mainrepo的工作按预期进行.
  5. 成功将mainrepo和subrepo1推送到Bitbucket.
  6. 继续将另一个subrepo2克隆到mainrepo目录.
  7. 将subrepo2添加到mainrepo中作为subrepo2
  8. mainrepo的工作按预期进行.
  9. 按mainrepo会在搜索更改"之后导致存储库不相关"错误.错误仅在新添加的subrepo2上发生.

这是目录结构: Mainrepo --subrepo1(主项目) --subrepo2(类库)

Here is directory structure: mainrepo --subrepo1 (main project) --subrepo2 (class library)

我花了无数小时试图使它正常工作,我肯定错过了一些明显的东西.

I've spent countless hours trying to get this working and I must be missing something obvious.

是什么导致此错误,我缺少什么? 随着项目的增长,我需要能够添加其他子仓库.

What is causing this error and what am I missing? I need to be able to add additional subrepos as the project grows.

推荐答案

我制作示例的步骤如下:

The steps that I took to make my example are as follows:

  1. 在BitBucket上创建MainRepo
  2. 在BitBucket上创建SubRepo
  3. 克隆MainRepo
  4. SubRepo克隆为MainRepo
  5. 的子目录
  6. 手动创建内容为SubRepo = ../SubRepo
  7. .hgsub文件
  8. .hgsub文件添加到MainRepo,提交并推送
  9. 在BitBucket上创建SubRepo2
  10. SubRepo2克隆为MainRepo
  11. 的子目录
  12. 手动编辑.hgsub并添加SubRepo2 = ../SubRepo2
  13. 提交并再次按下MainRepo
  1. Create MainRepo on BitBucket
  2. Create SubRepo on BitBucket
  3. Clone MainRepo
  4. Clone SubRepo as a sub-directory of MainRepo
  5. Manually create the .hgsub file with the contents SubRepo = ../SubRepo
  6. Add the .hgsub file to MainRepo, commit and push
  7. Create SubRepo2 on BitBucket
  8. Clone SubRepo2 as a sub-directory of MainRepo
  9. Manually edit .hgsub and add SubRepo2 = ../SubRepo2
  10. Commit and push MainRepo again

从那时起,我可以编辑两个子存储库中的任何一个,并在工作台中查看MainRepo时看到它们已更改.然后,我可以将更改提交到子存储库,在MainRepo中提交子存储库状态,并通过一次从MainRepo

From then on, I could edit either of the two sub-repositories and see that they had changed when looking at MainRepo in the workbench. I could then commit the changes to the sub-repositories, commit the sub-repository states in MainRepo and push all three repositories with a single push from MainRepo

您在另一个问题(subrepo = subrepo)中说TortoiseHg设置它的方式由于其结构如何而不适用于BitBucket.我认为您只能在这样的顶级存储库:

The way that you said that it was set up by TortoiseHg in your other question (subrepo = subrepo) won't work with BitBucket because of how their structure is. I think that you can only have repositories at the top level like this:

bitbucket.org/SteveKaye/MainRepo
bitbucket.org/SteveKaye/SubRepo

而行subrepo = subrepo试图建立这样的结构:

whereas having the line subrepo = subrepo is trying to set up a structure like this:

bitbucket.org/SteveKaye/MainRepo
bitbucket.org/SteveKaye/MainRepo/SubRepo

当您按此按钮时,似乎正在尝试将SubRepo推入MainRepo,这将解释您收到的无关的存储库错误消息.

When you push this it looks like it is trying to push SubRepo into MainRepo which would explain the unrelated repository error message that you are getting.

.hgsub语法使得等号的左侧定义了工作副本中存储库所在的文件夹,等号的右侧定义了从何处获取该文件夹.当等号的右边是相对路径时,它定义子存储库在中央服务器上相对于主存储库的位置.因此,在上面的示例中,您将一个文件夹上移至bitbucket.org/SteveKaye,而SubRepo包含在该文件夹中.

The .hgsub syntax is such that the left of the equals defines the folder in the working copy where the repository will be and the right of the equals defines where to get it from. When the right of the equals is a relative path, it defines where the sub-repository is on the central server relative to the main repository. So in the example above, you go up one folder to bitbucket.org/SteveKaye and the SubRepo is contained in that folder.

文档说:

Mercurial存储库的源路径可以是相对路径或绝对路径或URL.通常建议在源路径与工作目录路径相同的情况下使用相对的相对路径:这样可以确保始终可以就地"找到子存储库.

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时的情况有关,我希望不能克隆您的克隆,如上一句话所述.

This looks relevant to your situation when using BitBucket and I'd expect that your clones can't be cloned as it says in the last sentence.

这篇关于Mercurial到Bitbucket-子存储库-存储库不相关的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆