Mercurial:强制执行"hg pull -u"在"hg commit"之前 [英] Mercurial: enforce "hg pull -u" before "hg commit"

查看:111
本文介绍了Mercurial:强制执行"hg pull -u"在"hg commit"之前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些情况下,我需要强制Mercurial用户在允许任何hg commit之前运行hg pull -u,即hg pull表示传入队列为空—而且我也希望该人正在使用分支的头部版本.

I have in some cases a need to enforce that Mercurial-users have run hg pull -u before any hg commit can be allowed, i.e., hg pull will mean that the incoming queue is empty — and furthermore I also want that the person is using the head version of the branch.

如何设置这样的限制?

(我完全意识到这与DVCS设计核心的某些部分背道而驰)

(I am fully aware that this goes against parts of the DVCS design core)

推荐答案

您可以要求开发人员进行安装

You could ask your developers to install

[hooks]
pre-commit = hg pull -u

在其配置文件中(由于此工作流程是特定于存储库的,因此可能应安装在每个存储库的.hg/hgrc文件中.)

in their config files (it should probably be installed in the per-repository .hg/hgrc file since this workflow is repository specific).

这使Mercurial有点像Subversion:您的开发人员将只有一个出色的变更集.但是请注意,只要有人推送到服务器,hg pull -u就无法更新到新的分支提示,因为它将跨分支(拓扑分支)这样做.因此,此时需要适当的合并(或重新设置,请参见hg pull --rebase).

This makes Mercurial a little Subversion-like: your developers will only have one outstanding changeset. But note as soon as someone pushes to the server, hg pull -u cannot update to the new branch tip since it will cross branches (topological branches) to do so. So a proper merge will be needed at that point (or a rebase, see hg pull --rebase).

这篇关于Mercurial:强制执行"hg pull -u"在"hg commit"之前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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