我如何知道(本地)服务器未发布? [英] How do I tell (locally) mercurial that a server is non-publishing?

查看:59
本文介绍了我如何知道(本地)服务器未发布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能告诉Mercurial我不发布远程服务器(例如,在 bitbucket 上)未发布可以访问远程.hg/hgrc文件?

How can I tell mercurial that a remote server (on bitbucket for example) is non-publishing when I do not have access to the remote .hg/hgrc file?

最新版本的水星有一个阶段的概念,它可以使人跟踪其中哪些变更集已共享(public),哪些尚未共享(draft).在draft变更集上允许进行 rebase 之类的存储库更改操作,但不允许public变更集可能与其他变更集有关.

Recent versions of mercurial has a concept of phases that allow one to keep track of which changesets have been shared (public) and which ones have not (draft). Repository changing operations like rebase are allowed on draft changesets, but not public changesets as others might depend on the latter.

默认情况下,将变更集推送到公共服务器上会将其阶段更改为public,但是如果服务器是私有的或专用于代码审查(即,人们不应该拉出),则将其推送到不发布服务器不应更改阶段.

Pushing changesets to a public server will change their phase to public by default, but if the server is private or dedicated to code reviews (i.e. people should not be able to pull), then pushing to that "non-publishing" server should not change the phase.

记录的方式告诉Mercurial服务器未发布是将[phases]部分添加到服务器上的文件 :

The documented way of telling mercurial that the server is non-publishing is to add a [phases] section to the .hg/hgrc file on the server:

[phases]
publishing = false

在我看来,应该有一种方法可以在我的本地hgrc文件之一中包含一行,表示特定服务器未发布,但是我找不到任何文档来建议如何运行.也许可以用钩子自定义此行为?

It seems to me that there should be a way of including a line in one of my local hgrc files that says a particular server is non-publishing, but I cannot find any documentation to suggest how. Perhaps this behaviour could be customized with a hook?

  • https://www.mercurial-scm.org/wiki/Phases
  • Introduction to Mercurial Phases
  • After pushing to a review repository, "abort: can't rebase immutable changeset" on rebase

推荐答案

目前尚无此方法,希望它永远不会发生.

There is currently no way to do that and it should hopefully never happen.

这是原因:
如果允许本地存储库覆盖远程存储库配置,则只会使整个阶段机制变得无用.这些阶段的重点是防止用户执行可能破坏"同步流的操作.
接收者有责任描述如何使用接收到的变更集.如果通过允许发件人覆盖这些设置来颠倒该逻辑,那么如何确保两个发件人将使用相同的配置?如果配置不同,应保留哪一个?更改集应如何在接收器上标记?

Here is why:
If you allow the local repository to override the remote repository configuration, you are just making the whole phase mechanism useless. The point of the phases is to prevent user to perform actions that could "corrupt" the synchronization flow.
It the responsibility of the receiver to describe how the received changesets will be used. If you invert that logic, by allowing the sender to override these settings, then, how can you ensure that two senders will use the same configuration? If the configuration differ, which one should be kept? How should the changesets be marked on the receiver?

在某种程度上,这就像是本地存储库能够在未经授权的情况下将更改集推送到远程目录一样,只是通过在本地覆盖远程配置即可.

To some degree, it would be the same as if a local repository was able to push changesets to a remote without being authorized, just by overriding the remote configuration locally.

这篇关于我如何知道(本地)服务器未发布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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