tags:

views:

47

answers:

3

I work from several different locations on the same project and I use SVN to checkout wherever I happen to be working. I have a settings file that needs one line changed depending on where I'm working, but otherwise, it's a relatively static file. It's a bit annoying when every commit the file is just switching that one line back and forth depending on where I work.

Is there an easy way to manage this? At the least, I'd like to know of a way to exclude the file from commits even if it's modified. It would be great if it's possible to checkout a different version of the file depending on where I am.

+1  A: 

The usual way to manage this is to remove your (making up a name here) settings.cfg file from Subversion, and check in a settings.cfg.example file instead. On each machine, you would copy settings.cfg.example to settings.cfg and edit as necessary. For changes to the structure of the config file or to default settings or whatever, edit settings.cfg.example.

Greg Hewgill
That's a great idea and simple to implement, thanks!
Kai
And of course, add your settings.cfg to svn:ignore.
Daniel Rinser
A: 

You could manage it with some kind of branch structure, I believe.

Paul Nathan
I don't see how branches could help in this case...
Adam Byrtek
maintain a branch for each location?
Paul Nathan
A: 

If you add your configuration file to the svn:ignore property, then it won't be committed when modified:

svn pe svn:ignore .

The best way to manage this is to organize your config files so that the common stuff is in one file, checked in to svn, and the line that has to flip per machine is in its own file, included into the main config file. Then that local config file is added to svn:ignore.

Ned Batchelder
This seems like good organization but I'm afraid to do this because it makes my program logic dependent on SVN properties (i.e. if I forget to put only local-specific settings in that particular file, I'm in trouble)
Kai
I wouldn't look at it as depending on SVN. It's still a good organization to separate stuff that everyone shares from stuff that's going to change a lot.
Ned Batchelder