3

I created .hgignore file, but before that I sent project structure to server. Now hgignore doesn't work for those files which was sent earlier. I read somewhere that I need to remove those files and dirs from tracking list or add it in some "private" way but I cannot figure out how I need to do that. Problem is even more complicated because I wrote sh script which is copying part of this structure to other place (project consists of some client apps and www server, those server files are being copied to other place after each hg push command). So I want to ignore some files (but want that those files exists on server, just pushed once with some configuration) and I want to copy those ignored files with my sh script (the most important thing in this script is fact that I am using 'hg archive' to handle what I want to copy). I hope this is understandable for someone:)

sennin
  • 7,364
  • 9
  • 30
  • 44

2 Answers2

12

.hgignore only ignores files that haven't been added to the repository yet. Use hg forget to stop tracking an already added file.

You can't check in a file and ignore changes afterward. For configuration files, a best practice is to check in a template file, and ignore the actual local configuration file. Someone pulling the repo can then copy the template file and make their local changes. You sh script could automate that.

Mark Tolonen
  • 132,868
  • 21
  • 152
  • 208
1

Basically, Mark Tolonen already said everything important in his answer.

I just wanted to add an example for this part of his answer:

For configuration files, a best practice is to check in a template file, and ignore the actual local configuration file. Someone pulling the repo can then copy the template file and make their local changes. You sh script could automate that.

I answered a similar question some time ago with a detailed example:
how to ignore files in kiln/mercurial using tortoise hg "that are part of the repository"

My answer is for Visual Studio though (which you apparently don't use, according to the questions you've asked until now), but it can help you to get the basic idea, so you should be able to adopt it easily to any other environment.

Community
  • 1
  • 1
Christian Specht
  • 33,837
  • 14
  • 123
  • 176