tags:

views:

521

answers:

5

how can I ignore files from my svn repo without deleting them as well?

When I work on existing projects I often have to setup a local version of the project and using my local database as well. With drupal for instance, I checkout the svn repo, change the settings.php file to match my local database, but now I have to make sure I do not commit the settings file again.

Is there any clever svn command that will fix this?

A: 

svn propedit svn:ignore ./some_path

For details see this post.

NoahD
I have tried this, but the settings file will still be commited
kristian nissen
Yes, this ignores a local-only file but does nothing to prevent tracking of a file that was already in the repo.
GalacticCowboy
The OP has already stated that he *doesn't* want to delete the file from the repo. svn:ignore does nothing if the file still exists in the repo.
Coderer
+4  A: 

From the SVN Help:

I have a file in my project that every developer must change, but I don't want those local mods to ever be committed. How can I make 'svn commit' ignore the file?**

The answer is: don't put that file under version control. Instead, put a template of the file under version control, something like "file.tmpl".

Then, after the initial 'svn checkout', have your users (or your build system) do a normal OS copy of the template to the proper filename, and have users customize the copy. The file is unversioned, so it will never be committed. And if you wish, you can add the file to its parent directory's svn:ignore property, so it doesn't show up as '?' in the 'svn status' command.

NeilInglis
yes that would fix the problem, but the settings file is already under svn control, and I don't want to change that since I would have to change it on the production environment as well which I can't
kristian nissen
the production file shouldn't be in source control at all if it contains connection string information for the database. much safer is to have a symlink to the file (in a more secure location than the source repository) created by your build/deploy process.
Jeremy
+1  A: 

Create a version of the file called ".template" and version control that. When you checkout rename and edit as you need. Then use the svn propedit svn:ignore to ignore the copy.

Ken
+1  A: 

A possible solution would be to use changelists. You can group the files that you are changing into changelists, and then when you svn commit, you specify the changelist -- files not in the changelist are not affected.

create changelist
svn changelist math-fixes integer.c mathops.c

commit only files in changelist
svn ci -m "Fix a bug." --changelist math-fixes

William Leara
This sounds like a lot of work, I don't want to specify files I have changed, rather files that shouldn't be committed, perhaps I understand you wrong...
kristian nissen
A: 

The easiest way is to go to any directory that contains your config file and set a property on it:

svn:ignore settings.php

It will stay as-is through all commits and updates. You command might look like this:

$ svn propset svn:ignore 'settings.php' ./

Rap
I just tested this. I did a checkout, sat up an svn ignore on a file using svn propset svn:ignore 'readme' ./ and then did a commit, but the readme file is still commited when it's changed.
kristian nissen