Configuration versioning

Christian Boos cboos at neuf.fr
Thu Jun 22 03:57:39 CDT 2006


Dmitriy Morozov wrote:
> Hi,
>
> I am curious what is the suggested way to manage things like
> configuration files that are specific to a particular branch. E.g., if
> I have branch A on one computer, and branch B on another computer, I
> want some file "config" to store the local settings for each one of
> those computers. I want it to be versioned in each branch separately
> (to keep track of my own changes), but I don't want it to be
> distributable (so if I do push or pull between those two branches, I
> don't want the local settings to be overwritten or conflicting with
> each other).
>
> Is it possibile to do such (per-file) non-distributable version
> control? 

The trick would be to ensure that there's a local change for each of
that kind of "config" file in each repository.
That way, when you merge from the other repository, the merge program [1]
will be invoked, and this could be the place to implement the behavior
you're looking after.

Example: you could add the following first line to each file that should
never be modified when merging:

# hg-merge: local

Then, you could adapt the merge program to react appropriately
if this indicator is found:

 head -1 $LOCAL | grep -e '^# hg-merge: local' && success


-- Christian

[1] http://www.selenic.com/mercurial/wiki/index.cgi/MergeProgram



More information about the Mercurial mailing list