简体   繁体   English

在推送mercurial时强制用户指定分支

[英]Force the user to specify the branch when pushing on mercurial

In my company some users are pushing stuff into the repo without specifying the branch, thus causing a few issues. 在我的公司中,一些用户正在将内容推送到repo而不指定分支,从而导致一些问题。 Is there a way to force the -b option on mercurial so the user always needs to specify a branch when pushing? 有没有办法在mercurial上强制使用-b选项,这样用户在推送时总是需要指定一个分支? I mean, we could force a specific comment in the commit message. 我的意思是,我们可以在提交消息中强制执行特定注释。 Can we do the same with the -b option? 我们可以用-b选项做同样的事吗?

If pushing all pushable commits "causing a few issues" it's a problem of your workflow and (used additional) tools - because pushing all branches is default style for Mercurial and you must design processes, having this in mind and don't emulate ugly Git-style. 如果推动所有可推送的提交“导致一些问题”,则是您的工作流程和(使用其他)工具的问题 - 因为推送所有分支是Mercurial的默认样式 ,您必须设计流程,记住这一点并且不要模仿丑陋的Git -样式。

Yes, way to force -b in push exist (redefine push in [alias] ), but it's wrong way 是的,强制-b in push存在的方式(重新定义[alias]推送),但这是错误的方式

You could have them use a new enough version of mercurial, make them have their default phase of commits be 'secret' via 你可以让他们使用一个足够新的mercurial版本,让他们默认的提交阶段是'秘密'通过

[phases]
new-commit = secret

in their .hgrc. 在他们的.hgrc。 As only changesets from the draft and public phase are shared, they would need to change the phase of those commits they plan to share prior to push. 由于只共享草案和公共阶段的变更集,因此他们需要在推送之前更改他们计划分享的那些提交的阶段。 Accidential push of changesets added just for personal testing in other branches are thus easily avoided. 因此,可以轻松避免在其他分支机构中为个人测试添加的变更集的实际推送。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM