将github存储库嵌入到mercurial(窑)存储库中 - 它的集成程度如何? [英] Embedding a github repository inside a mercurial (kiln) repository - how integrated is it?

查看:161
本文介绍了将github存储库嵌入到mercurial(窑)存储库中 - 它的集成程度如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在mercurial / kiln存储库中的github托管子存储库是否可能,如果是,它们会自动更新/在通过 hg clone hg commit 命令操作父级mercurial存储库时被克隆?



详细问题

继续我的问题,回答如此出色这里,我的一些第三方代码位于我刚刚从github上的opensource下载的文件夹中。由于在那个阶段我没有使用版本控制,那些只有标准文件夹的文件夹现在已经作为子库存储在mercurial中。



这显然不理想,因为新版本的库可能会修复错误,或者我希望在未来使用新功能。我也可能需要在本地自定义一些库。



我可以从阅读这个链接可能让mercurial知道那些git服务器的URL(和修订版),这样我就可以进行mercurial clone github托管的库直接从它们的父级回购站购买。



我是否正确地说当我克隆父级(mercurial)回购站时,这些文件将从github中提取,而没有必须单独使用git来管理它?



还有一点不清楚的是,如果我这样做,并且发现代码可能需要从github克隆的存储库,我是否需要使用git来管理本地文件的修订版,或者mercurial会通过代理来完成这些修改?例如,我是 hg commit -S 会不会以我的名义调用git来处理?

解决方案


我说得对,当我克隆父级(mercurial)将被从github中提取,而不必分别使用git来管理它?


是的,包含子库的Mercurial存储库的克隆将触发也是Subrepos的克隆。它确实发生在更新 上。 Mercurial注意到 .hgsub 文件并发布了所需的 hg clone git clone 命令给你。它使用 .hgsubstate 中的信息准确地知道要检出的版本。



子库可以放在任何地方。对于声明像

的Git子资源库

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

Mercurial只会发出相应的克隆命令:

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

然后您的职责是稍后进入 foo 回购库,并根据需要使用Git获取新的提交。在您提取/提取新提交后,您可以进行顶级提交,以在 .hgsubstate 文件中记录subrepo的新状态。在这个意义上,使用 hg summary 来查看subrepo是否脏。
$ b


[ ...]我需要使用git来管理本地文件的修订,或者mercurial会通过代理来执行该修订吗?例如,我是为了hg commit -S会以我的名义mercurial调用git来处理它吗?

当您编辑文件并制作顶级 hg commit ,Mercurial将确保首先提交subrepo(如果您使用 hg commit -S 或如果 ui.commitsubrepos = True )。如果您进行顶级推送,则Mercurial将始终首先推送subrepos,以便始终在服务器上进行一系列一致的更改。


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?

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. 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.

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.

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?

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? eg id I were to hg commit -S would mercurial invoke git on my behalf to handle that?

解决方案

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?

Yes, clone of a Mercurial repository that contain subrepositories will trigger a clone of the subrepos too. It really happens on update. Mercurial notices the .hgsub file and issues the needed hg clone and git clone commands for you. It uses the information in .hgsubstate to know exactly what revision to checkout.

The subrepositories can be hosted anywhere. For a Git subrepository declared like

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

Mercurial will simply issue the corresponding clone command:

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. 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. Use hg summary to see if a subrepo is dirty in this sense.

[...] would I need to use git to manage revisions of the local files, or would mercurial do that by proxy? eg id I were to hg commit -S would mercurial invoke git on my behalf to handle that?

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). 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.

这篇关于将github存储库嵌入到mercurial(窑)存储库中 - 它的集成程度如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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