tags:

views:

67

answers:

2

I have a project that requires some configuration files. I want to keep the default configuration filse in the repository. However, I want don't want to have to specify the -X flag for every commit I do. Is there a standard way to mark a set of revisioned files as permanently excluded from commits?

+2  A: 

Interesting question, I hope you get a better answer. Faced similar problems, I have done the following:

  • Rename the configuration files, so that for example, instead of noweb.cfg I have noweb.cfg.default. This file changes seldom and is kept under revision control.

  • The actual configuration file, noweb.cfg, may change frequently but is put in the .hgignore file so it is never committed.

  • At need I have a special Makefile target that rebuilds *.cfg from *.cfg.default.

This solution is not ideal because changes in the .cfg files are lost when the .cfg.default changes. In principle you could tackle this issue with diff3 or some more sophisticated merge tool, but I have never been energetic enough to go there.

Norman Ramsey
+2  A: 

You could use the (much maligned) defaults section in your .hgrc:

  [defaults]
  commit = -X thefileyouwanttoexclude

If you can retrain your fingers the preferred way to do that is with an alias instead:

 [alias]
  cmt = commit -X thefileyouwanttoexclude

then you start using hg cmt instead of commit.

Ry4an
Why do you say "much maligned"? Is it frowned upon? Or just not well known?
Tac-Tics
It works fine, but mpm, mercurial's creator, has deprecated [defaults]. It, by design, alters what commands do in invisible ways, so scripts or extensions that use those commands are running the commands with arguments they might not intend.For example, if I do "[defaults]\npush = -f" because I always want to use -f that's fine, but if a script uses 'push' without -f because it wants to make sure not to create new remote heads, that script would be using -f w/o knowing it. Aliases are just safer and accomplish almost the same thing, provided one can retrain one's fingers.
Ry4an