Reputation: 7473
I have a file default.config
in the root of my repository. I tweaked it for my own setup, and I do not want to commit it. Ever. What are my options other than commit -X "^default\.config$"
?
I added ^default\.config$
to .hgignore
, but it still shows up in the output of hg status -mard
.
Edit: maybe it's possible to do this with Mercurial Queues. If I keep all my local config changes in a single patch, then I just have to remember to pop it before committing. Just thinking out loud...
Upvotes: 1
Views: 326
Reputation: 73808
Akluth has the correct answer: commit a template file to your repository and then copy that to the real name in each working copy. If the config file supports it, then use an include directive to load the template file from the real config file. Something like
// default.config
//
// load defaults from versioned template file
#include "default.config.template"
// override defaults with my settings
db_hostname = localhost
db_user = me
An alternative is to use -X
with every command, as you suggest. There is an exclude extension that implements this idea. Remember to read the caveats — it doesn't work when merging because you cannot exclude files when committing a merge. The extension would need to be extended to handle that case, probably by shelving change before the merge and unshelving it afterwards.
This suggests another stragety, similar to using MQ as you suggest: use the new shelve extension in a set of pre-
and post-
hooks to shelve/unshelve the file before/after each operation. I think that could work, though I haven't tried it in real life.
Upvotes: 1
Reputation: 8583
Follow these steps:
hg rm default.config
and commit the changesAs a good practice you can add a file called default.config.template
or something which is committed to the repository. This file holds some kind of default values or comments on how to use it and other users/developers can copy this file to default.config
if they're using your project.
Upvotes: 2