Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional Mercurial Ignore File

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?

like image 933
Jan Avatar asked Dec 21 '10 17:12

Jan


1 Answers

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
like image 161
Lasse V. Karlsen Avatar answered Sep 17 '22 20:09

Lasse V. Karlsen