[英]Is there a way to use a Mercurial repository as Git submodule?
I been happily using submodules to track all the libraries my project depends from. 我一直很高兴地使用子模块来跟踪项目所依赖的所有库。 The thing is I'm using a library called core-plot that only has a public mercurial repository.
问题是我正在使用一个名为core-plot的库,它只有一个公共的Mercury存储库。 I can probably mirror it in a readonly Git repository, but is this the best option I got?
我可能可以将其镜像到只读的Git存储库中,但这是我得到的最佳选择吗? I had seen there is modules in Mercurial to track things in Git.
我已经看到Mercurial中有一些模块可以跟踪Git中的内容。 Someone know if the other way around exists?
有人知道是否存在其他方法吗?
First, make sure there is a (non-Mercurial) git submodule under your main repository. 首先,请确保您的主存储库下有一个(非Mercurial)git子模块。 If you don't have other submodules yet, just create a dummy submodule for some library other than
core-plot
, for instance: 如果您还没有其他子模块,只需为
core-plot
以外的某些库创建一个虚拟子模块,例如:
main-repo $ git submodule add https://repo.url.com/repo.git repo
Second, clone the core-plot
library into some directory. 其次,将
core-plot
到某个目录中。
main-repo $ git-hg clone https://code.google.com/p/core-plot/ core-plot
Add the new repo to the submodule list. 将新的仓库添加到子模块列表中。
main-repo $ git submodule add ./core-plot core-plot
main-repo $ git commit -am "added core-plot submodule"
From now on, any clone from this repo will pull both repositories. 从现在开始,此存储库中的任何克隆都将提取两个存储库。 (After submodule init and update).
(在子模块初始化和更新之后)。
Some problems I found out so far are: 我到目前为止发现的一些问题是:
git-hg
will have to git-hg pull
. git-hg
必须git-hg pull
。 The converse question git submodule from Hg repo? Hg repo的相反问题git子模块? is also asked on StackOverflow.
在StackOverflow上也被询问。 The best answer mentions projects hg-git and git-hg.
最好的答案是项目hg-git和git-hg。 Another related converse question is, How to deal with Git submodules on a repo that is converted to Mercurial .
另一个相关的相反问题是, 如何处理已转换为Mercurial的存储库上的Git子模块 。
In my experience, most active non-git projects have an up-to-date git mirror floating around on GitHub. 以我的经验,大多数活跃的非git项目都有一个最新的git镜像在GitHub上浮动。 It looks like
core-plot
has one too: 看起来
core-plot
也有一个:
https://github.com/djw/core-plot https://github.com/djw/core-plot
If you're willing to rely on whoever set that mirror up, it seems like it might be the easiest option to get a submodule in place. 如果您愿意依靠谁来建立该镜像,那么将子模块安装到位似乎是最简单的选择。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.