tags:

views:

47

answers:

3

When I run my site locally, I have my connection class pointed to local IPs for the database and what not.

How do I prevent overwriting my connection class on the live site when I commit?

Every time I commit, it makes my live site point to my local version. How can I avoid this?

+1  A: 

The way I've done this is to make a .production and .debug version of the files and check those in. Add the original file to the svn ignore list, and copy the relevant .production or .debug file to the original file on each system.

John Weldon
A: 

In cases like this it is best to not even have the file of in subversion and leave your config file on production and local. you can set up subversion to ignore certain files so it won't try to add commit changes to the repository.

Here is another topic that talks more about svn:ignore

http://stackoverflow.com/questions/116074/how-to-ignore-a-directory-with-svn

mcgregok
A: 

In CVS, you can commit the config file and the .cvsignore (with an ignore entry for that file in it) at the same time. This allows others to check the directory out, and helps preventing a later check in of that specific file (thanks to the .cvsignore).

Unfortunately, it seems you can't mimic this behavior playing with svn:ignore props. As per svnbook 1.5 manual:

"Subversion's support for ignorable file patterns extends only to the one-time process of adding unversioned files and directories to version control. Once an object is under Subversion's control, the ignore pattern mechanisms no longer apply to it. In other words, don't expect Subversion to avoid committing changes you've made to a versioned file simply because that file's name matches an ignore pattern—Subversion always notices all of its versioned objects."

you could use some of these mechanisms: 1) Put the file in the repo and then to code a commit hook that will check the commit pattern and stop it if some condition is true (will not address directly your issue, but at least will prevent an accidental commit) 2) As already stated before, user a .user/.local/etc name pattern and then use global-ignores or svn:ignore to prevent someone from check it in.

More info at http://stackoverflow.com/questions/416322/is-there-any-way-to-block-files-being-committed-to-svn-repository

Sebastian