条件Mercurial Ignore文件 [英] Conditional Mercurial Ignore File

查看:127
本文介绍了条件Mercurial Ignore文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件,我想要开发机器拉取文件,但我希望部署服务器不拉文件(它有特殊的mods,开发机器没有)。这是否可能,或者我应该只需要一个自定义的推送服务器解决方案,而不是仅仅做一个hg拉?

解决方案

要执行此操作的方法是执行以下操作:



将每个文件的副本存储在存储库中,并将其正确命名。例如,如果有问题的文件是 web.config ,您将在存储库中存储以下两个文件:




  • web.server.config

  • web.dev.config



然后,您将添加一个建立的步骤,以确保正确的文件被复制到实际的 web.config 文件,您可以使用批处理文件:

 如果%COMPUTERNAME% ==SERVERcopy web.server.config web.config 
如果没有%COMPUTERNAME%==SERVERcopy web.dev.config web.config

然后,您将通过.hgignore忽略web.config本身:

  glob:web.config 


I have a file in mercurial that I want dev machines to pull the file, but I want the deployment server to NOT pull the file (it has special mods to it that the dev machines don't have). Is this possible, or should I just have a custom push to server solution instead of just doing an hg pull?

解决方案

A typical way to do this would be to do the following:

You store a copy of each file in the repository, and name them correctly. For instance, if the file in question is web.config, you would store the following two in the repository:

  • web.server.config
  • web.dev.config

Then you would add a built step to ensure the right file was copied to the actual web.config file, you could use a batch file:

if "%COMPUTERNAME%" == "SERVER" copy web.server.config web.config
if not "%COMPUTERNAME%" == "SERVER" copy web.dev.config web.config

Then you would ignore web.config itself through .hgignore:

glob:web.config

这篇关于条件Mercurial Ignore文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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