将 github 存储库嵌入到 Mercurial (kiln) 存储库中 - 它的集成程度如何?

发布于 2024-12-27 20:51:23 字数 932 浏览 1 评论 0原文

总结问题:

Mercurial/kiln 存储库中的 github 托管子存储库是否可行,如果可以,当 hg 克隆操作父 Mercurial 存储库时,它们是否会自动更新/克隆 code> 或 hg commit 命令?

详细问题:

继我的问题得到如此出色的回答之后这里,我的第三个问题派对代码位于我不久前从 github 上的开源项目下载的文件夹中。由于在那个阶段我没有使用版本控制,这些文件夹只是标准文件夹,现在已作为子存储库合并到 Mercurial 中。

这显然不理想,因为一方面,新版本的库可能有错误修复,或者我希望将来使用的新功能。我可能还需要本地定制一些库。

我可以通过阅读此链接看到它是可能的让 Mercurial “了解”这些 git 服务器 URL(和修订版本),这样我就可以让 Mercurial 直接从其父存储库克隆 github 托管库。

我是否正确地说,当我克隆父(mercurial)存储库时,这些文件将从 github 中提取,而无需使用 git 单独管理?

同样不清楚的是,如果我要这样做,并且发现代码可能需要在 github 克隆存储库中进行自定义,我是否需要使用 git 来管理本地文件的修订,或者 Mercurial 会这样做吗?通过代理?例如 id 我要 hg commit -S Mercurial 会代表我调用 git 来处理这个问题吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉梦枕江山 2025-01-03 20:51:23

我是否正确地说,当我克隆父(mercurial)存储库时,这些文件将从 github 中提取,而无需使用 git 单独管理?

是的,包含子存储库的 Mercurial 存储库的克隆也会触发子存储库的克隆。它确实发生在更新上。 Mercurial 会注意到 .hgsub 文件,并为您发出所需的 hg clonegit clone 命令。它使用 .hgsubstate 中的信息来准确了解要签出的修订版本。

子存储库可以托管在任何地方。对于像 Mercurial 这样声明的 Git 子存储库,

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

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

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

然后您有责任进入 foo 存储库并根据需要使用 Git 获取新的提交。获取/拉取新提交后,您可以进行顶级提交以在 .hgsubstate 文件中记录子存储库的新状态。使用 hg Summary 来查看子存储库在这个意义上是否是脏的。

[...] 我需要使用 git 来管理本地文件的修订,还是 Mercurial 通过代理来管理?例如 id 我要 hg commit -S Mercurial 会代表我调用 git 来处理这个问题吗?

当您编辑文件并进行顶级 hg commit 时,Mercurial 将确保首先提交子存储库(如果您使用 hg commit -S 或如果 ui .commitsubrepos=True)。如果您进行顶级推送,那么 Mercurial 将始终首先推送子存储库,以便您的服务器上始终拥有一组一致的更改。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文