Mercurial 存储库与 bitbucket 子存储库 - 如何防止推送

发布于 2024-12-28 03:04:09 字数 1141 浏览 1 评论 0原文

我正在 Mercurial 存储库下设置一些第三方子存储库。一个子存储库是 Bitbucket 上托管的另一个 Mercurial 存储库。

由于它是一个公共仓库,而且我不是它的贡献者,因此我不想推迟它。但是,当我克隆父存储库时,我仍然希望自动克隆存储库。一方面,我希望能够访问子存储库的集体历史记录,这样我就可以看到随着时间的推移,哪些内容可能发生了变化,也可能没有发生变化。

因此,我在父存储库的 .hgsub 文件中创建了一个条目,如下所示:

thesubrepo = https://bitbucket.org/user/repo

来克隆存储库

$ hg clone https://bitbucket.org/user/repo thesubrepo

并使用我进行的提交 以记录子存储库状态。然后,我将我的父存储库推回到它的服务器(Kiln),却发现它正在尝试将我的子存储库推回到 Bitbucket 服务器。不过,推送到 Bitbucket 子存储库似乎没有执行任何操作。

当我使用 .hgsub 中的条目以相同的方式(托管在 Git hub 上)创建 Git 子存储库时,我没有观察到这种行为,这样

abc = [git]git://github.com/xyz/abc

对我来说最好不要设置来做到这一点一个子存储库,然后让 Mercurial 将文件存储为文件?或者(最好)是否有一些设置可以用来告诉 Mercurial 不要实际将此子存储库的内容推回其源位置?

我宁愿能够将其配置为仅手动推送这些子存储库,因此如果有人能够对此有所了解,我将不胜感激。

我在另一个堆栈溢出答案中找到了对 commitsubrepos = no 的引用,据我所知可以看出是关于提交,而不是子存储库的推送。然后我在 Mercurial 网站上查找了这个,希望有可能是与推送子存储库有关的设置的一些参考,但是......不

I am in the process of setting up some third-party subrepositories under a Mercurial repository. One subrepo is another Mercurial repo hosted on Bitbucket.

Since it is a public repo, and I am not a contributor to it, I don't wish to push back to it. However I would like to still have the repository automatically cloned when I clone the parent repository. For one thing, I'd like to have access to the collective history of the subrepository so I can see what may or may not have changed over time.

So, I made an entry in the parent repo's .hgsub file as follows:

thesubrepo = https://bitbucket.org/user/repo

and cloned the repo using

$ hg clone https://bitbucket.org/user/repo thesubrepo

I made a commit to record the subrepo state. I then went to push my parent repo back to it's server (Kiln) only to discover that it was trying to push the subrepo I back to the Bitbucket server. The push to the Bitbucket subrepository appears to not do anything, though.

I did not observe this behaviour when I made a Git subrepo in the same manner (hosted on Git hub) using an entry in .hgsub like this

abc = [git]git://github.com/xyz/abc

Is it best for me just to do this by not setting up a subrepository, and just let Mercurial store the files as files? Or (preferably) is there some setting somewhere that I can use to tell Mercurial to never actually push the contents of this subrepo back to it's source location?

I'd rather be able to configure it to only push those subrepos manually, so if anyone can shed some light on this, I would appreciate it.

I found a reference to commitsubrepos = no in another stack overflow answer, which as far as i can tell is about commits, and not pushes of sub repositories. I then looked this up on the mercurial website, in the hope there might be some reference to a setting pertaining to pushing subrepos, but... no

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

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

发布评论

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

评论(1

一场春暖 2025-01-04 03:04:09

您不能(目前,从版本 2.0 开始)要求 Mercurial 不推送子存储库。

根本问题是 Mercurial 必须确保您推送时远程存储库的状态保持一致。如果您可以推回 Kiln,然后在那里有一个引用了 Bitbucket 上不存在的修订版本的变更集,那么这将是不安全。 Mercurial 不知道您本地的变更集是否已发布或者您是否创建了它 - 因此它必须(尝试)推送。

我们目前正在研究名为阶段的概念。完成此操作后,Mercurial 将开始跟踪变更集是在本地创建还是已发布。这也可以用于子存储库:如果子存储库中的“公共”阶段仅存在变更集,则无需尝试推送!

You cannot (currently, as of version 2.0) ask Mercurial to not push subrepositories.

The fundamental problem is that Mercurial must ensure that you have a consistent state on the remote repository when you push. It would be unsafe if you could push back to Kiln and then have a changeset there that references a revision on Bitbucket that isn't there. Mercurial doesn't know if a changeset you have locally is published or if you created it — so it has to (try to) push.

We're currently working on a concept called phases. With that in place, Mercurial will begin tracking if a changeset is created locally or already published. That can be used for subrepositories too: if there are only changesets in the "public" phase in a subrepo, then there's no need to try pushing!

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