tags:

views:

28

answers:

2

Hi,

We have an XML file which contains the settings of a tool we use. The tool is nice, but if you change some settings when using it it's quite easy to save those settings to the XML-file by mistake (you get a question, but it's easy to answer yes).

Is there a way to alert the user someway that she is commiting a change to this specific file? We want it versioned, but we also want centralized and we want the settings to be quite stable.

It's a file versioned in Windows on an NTFS partition, if that matters. Trying to set the file to "read only" doesn't seem to work (after I set it, hg st still says no changes). Any ideas?

A: 

If you really want to catch it during commit, you'll need to write some hooks and get your users to install those locally.

Habbie
To elaborate: you need a system-wide [`pre-commit` hook](http://www.selenic.com/mercurial/hgrc.5.html#hooks). Keep in mind that users can disable hooks, so your code review process (I hope you have one) should also pay attention to that file.
Geoffrey Zheng
+5  A: 

The way this is usually handled is to put that file in your .hgignore and to not version it. Instead, you should version a template file. i.e., config.xml.template.

That way, the only way changes will get committed to it is for someone to consciously bring those changes into the template.

This is the best way in my opinion too.
Habbie