为什么 Mercurial 在提交之前不检查最新版本?

发布于 2025-01-02 14:08:43 字数 126 浏览 0 评论 0原文

在 SVN 中,如果您的本地修订版本不是主存储库的最新版本,则无法提交。 Mercurial 不会检查这一点并允许您提交。然后你必须进行合并。

如果有很多程序员在工作,那么这可能会导致一个大问题。有什么办法解决这个问题吗?

In SVN you cannot commit if your local revision is not up to date with the master repository. Mercurial doesn't check for this and allows you to commit. Then you have to do a merge.

If there are many programmers working then this could lead to a big problem. Is there is any way around this?

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

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

发布评论

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

评论(1

疯了 2025-01-09 14:08:43

Mercurial 和 SVN 有两种截然不同的工作方式。

SVN 是集中式的,您提交的所有内容都可以立即被其他人访问。这就是为什么您必须始终在所有其他更改之上进行承诺。这样你就可以确定你所做的仍然适用于其他人所做的修改。

使用 Mercurial,提交位于您的工作目录本地。只有推送会分发给其他人。这就是为什么不对每一次提交进行检查的原因。 (这样,您也可以离线工作,即无需连接到存储库)。

只有当您尝试推送您的更改时,Mercurial 才会检查您正在工作的分支上是否有新的提交。如果是这样,您可以强制推送(这将创建一个新头)或合并其他修改,从而承认其他人的工作。

我知道的每个 DVCS(D 代表分布式)都有相同的处理提交/推送的方式,这是它们的众多优点之一。只要合并正确完成,就不会因此而出现问题。

如果您确实想在每次提交时检查新的变更集,我认为可以使用一些钩子来完成,但我真的不明白原因。也许有人会提出这样的事情。

Mercurial and SVN have two very different way of working.

SVN is centralized, everything you commit will be immediately accessible by all the others. It is why you must always commit on top of every other changes. So you can ascertain that what you've done still work with the modifications made by others.

With Mercurial, commits are local to your working directory. Only the push is distributed to other people. It's the reason why there's no check on each and every commit. (In this way, you can also work offline, ie without being connected to the repository).

It is only when you try to push your changes that Mercurial checks if there are new commits on the branch you're working one. If so, you can force the push (this will create a new head) or merge the other modifications, thus acknowledging the work of others.

Every DVCS (D is for distributed) I know off have the same way of dealing with commit / push, it's one of their many advantages. As long as the merge are done right, you won't have problems because of this.

If you really want to check for new changeset on each commit, I think it's possible to do it with some hooks, but I really don't see the reason why. Maybe someone will propose such a thing.

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