简体   繁体   English

将github存储库嵌入水银(窑)存储库中-它的集成程度如何?

[英]Embedding a github repository inside a mercurial (kiln) repository - how integrated is it?

Summarised Question: 总结的问题:

Are github-hosted sub repositories within a mercurial/kiln repository possible, and if so are they automatically updated/cloned when the parent mercurial repository is operated on by a hg clone or hg commit command? github托管的子存储库是否可以在汞/窑存储库中使用,如果可以,当通过hg clonehg commit命令对父汞存储库进行操作时,它们是否可以自动更新/克隆?

Detailed Question: 详细问题:

Following on from my question that was answered so excellently here , some of my third party code is in folders I downloaded a while ago from opensource efforts on github. 从我的问题在这里得到了很好的回答之后,我的一些第三方代码在我不久前从github上的开源工作下载的文件夹中。 Since at that stage I was not using version control, those folders where just standard folders that now been incorporated as sub repositories in mercurial. 因为在那个阶段我没有使用版本控制,所以那些文件夹中只有标准文件夹,而现在这些标准文件夹已被合并为Mercurial的子存储库。

This is obviously not ideal, as for one thing, new versions of the libraries may have bug fixes, or new features I wish to use in the future. 这显然是不理想的,因为一方面,新版本的库可能已修复了错误,或者我希望将来使用新功能。 I also may need to locally customise some of the libraries. 我可能还需要在本地自定义一些库。

I can see from reading this link that it possible to have mercurial "know" about those git server urls (and revisions), so I can then have mercurial clone the github hosted libraries direct from their parent repos. 通过阅读此链接 ,我可以了解到有关那些git服务器url(和修订版)的信息,因此我可以直接从其父存储库中克隆github托管的库。

Am I right in saying that when I clone the parent (mercurial) repos, those files will be pulled from github, without having to separately manage this using git? 我的意思是,当我克隆父(水银)存储库时,这些文件将从github上拉出,而不必使用git单独进行管理?

What is also not clear is, if I were to do this, and it transpired that code might need to be customized from within that github-cloned repository, would I need to use git to manage revisions of the local files, or would mercurial do that by proxy? 还不清楚的是,如果我这样做的话,可能会发现代码可能需要从该github克隆的存储库中进行自定义,我是否需要使用git来管理本地文件的修订,还是由Merurial做?通过代理? eg id I were to hg commit -S would mercurial invoke git on my behalf to handle that? 例如id我要hg commit -S mercurial代表我调用git来处理吗?

Am I right in saying that when I clone the parent (mercurial) repos, those files will be pulled from github, without having to separately manage this using git? 我的意思是,当我克隆父(水银)存储库时,这些文件将从github上拉出,而不必使用git单独进行管理?

Yes, clone of a Mercurial repository that contain subrepositories will trigger a clone of the subrepos too. 是的,包含子存储库的Mercurial存储库的克隆也会触发该子存储库的克隆。 It really happens on update . 它确实发生在更新上 Mercurial notices the .hgsub file and issues the needed hg clone and git clone commands for you. Mercurial会注意到.hgsub文件,并为您发出所需的hg clonegit clone命令。 It uses the information in .hgsubstate to know exactly what revision to checkout. 它使用.hgsubstate的信息确切了解要签出的修订版本。

The subrepositories can be hosted anywhere. 子存储库可以托管在任何地方。 For a Git subrepository declared like 对于声明为的Git子存储库

foo = [git]https://github.com/user/repo.git

Mercurial will simply issue the corresponding clone command: Mercurial只会发出相应的克隆命令:

git clone https://github.com/user/repo.git foo

It's then your reponsibility to later go into the foo repo and use Git to fetch new commits as necessary. 然后,您有责任稍后进入foo库并根据需要使用Git提取新的提交。 After you fetch/pull new commits, you can make a top-level commit to record the new state of the subrepo in the .hgsubstate file. 提取/拉出新提交后,可以进行顶层提交,以在.hgsubstate文件中记录子存储库的新状态。 Use hg summary to see if a subrepo is dirty in this sense. 使用hg summary可以查看子仓库在这种意义上是否脏。

[...] would I need to use git to manage revisions of the local files, or would mercurial do that by proxy? [...]我需要使用git来管理本地文件的修订,还是由mercurial通过代理来完成? eg id I were to hg commit -S would mercurial invoke git on my behalf to handle that? 例如id我要hg commit -S mercurial代表我调用git来处理吗?

When you edit files and make a top-level hg commit , Mercurial will make sure to commit the subrepo first (if you use hg commit -S or if ui.commitsubrepos=True ). 当您编辑文件并进行顶级hg commit ,Mercurial将确保首先提交subrepo(如果使用hg commit -Sui.commitsubrepos=True )。 If you make a top-level push, then Mercurial will always push the subrepos first so that you always have a consistent set of changes on your server. 如果您进行顶级推送,那么Mercurial将始终首先推送子仓库,以便您在服务器上始终具有一组一致的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM