Mercurial:在"hg commit"之前强制执行"hg pull -u"

Pet*_*oft 7 mercurial dvcs mercurial-hook

在某些情况下,我需要强制Mercurial用户hg pull -u在任何hg commit可以被允许之前运行,即,hg pull意味着传入队列是空的 - 此外我还希望该人正在使用分支的头版本.

我该如何设置这样的限制?

(我完全清楚这与DVCS设计核心部分有关)

Tyl*_*ith 1

通常,如果不使用 -f 标志(强制),mercurial 不会让您将开放头推送到服务器。您可以编写一个钩子来自动拉取,但由于服务器不知道您拥有什么,因此无法在服务器端强制执行。Mercurial 的网站上有一篇关于这种情况的文章: https://www.mercurial-scm.org/wiki/TipsAndTricks ?highlight=%28heads%29#Prevent_a_push_that_would_create_multiple_heads