Grant
Grant

Reputation: 321

How to block a file in SVN?

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?

Upvotes: 1

Views: 1061

Answers (2)

Sebastian
Sebastian

Reputation: 1835

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 Is there any way to block files being committed to SVN repository

Upvotes: 1

John Weldon
John Weldon

Reputation: 40759

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.

Upvotes: 1

Related Questions