Using mercurial for configuration files version control

Vadym Chepkov vchepkov at gmail.com
Thu Nov 25 09:29:47 CST 2010


On Nov 25, 2010, at 10:21 AM, Martin Geisler wrote:

> Vadym Chepkov <vchepkov at gmail.com> writes:
> 
>> On Nov 25, 2010, at 9:58 AM, Martin Geisler wrote:
>> 
>>> Vadym Chepkov <vchepkov at gmail.com> writes:
>>> 
>>>> I basically need a tool that can track and apply "patches" for me and
>>>> I was hoping mercurial is capable to do this.
>>> 
>>> The mq extension does exactly that: it maintaines a stack of patches on
>>> top of normal Mercurial changesets.
>>> 
>>> http://mercurial.selenic.com/wiki/MqExtension
>> 
>> mq is managing local patches, if I am not mistaken, whereas I need to
>> apply remote changes, remote deltas.
> 
> I proposed to store the local differences in MQ patches and store the
> common parts in normal changesets.
> 
>> If mercurial doesn't speak "deltas" and only compares the whole file
>> every single time and this can't be changed, I guess it's just a wrong
>> tool for the tack in hands.
> 
> The nicest solution I know of is to put the local customizations for a
> file foo into a file called foo.$HOSTNAME and then include foo.$HOSTNAME
> into foo. This works great if the file format allows including other
> files and if it can work with environment variables.
> 
> Failing that, I think a MQ patch would be an okay solution.
> 
> 

I would have to read about MQ patch more then, but it seems to me the whole issue was created either by the fact that repositories are unrelated (two hg init) or because I did that local commit. I guess if I leave these local modifications as perpetual un-commited I should be fine. This doesn't allow me to track local changes (until I learn about MQ), but at least this approach seems to be working.

[root at pollux ~/castor-etc]# hg st
M rc.conf

[root at pollux ~/castor-etc]# hg pull -u
pulling from ssh://castor//etc
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
merging rc.conf
0 files updated, 1 files merged, 0 files removed, 0 files unresolved

And it merged properly.

Thanks,
Vadym






More information about the Mercurial mailing list