Get it All

So, in developing the new website application for my company, I’ve hit a peculiar snafu. Namely that, because the same basic system will be used to spawn a number of different websites, things that go into making a website visible, such as images, views, css files and others will need to be different from instance to instance. I found an excellent tutorial on ignoring files, but that’s when I hit the snag: since I put everything under revision already, I discovered that I could not ignore the files and folders I wanted to anymore.

What is the solution? Well, here goes.

The first step is to backup the files you want to keep out of versioning. Just copy and paste them into a safe folder, outside the working directory somewhere. This way, it will be easy to put stuff back where it belongs later.

Next, we explicitly delete the files from the repository:
[code]myhost: working svn delete ./path/to/directory/
myhost: working svn commit -m "We need to make sure that the repository no longer records these files as being under revision."[/code]

Ok! Now that the files and folders are no longer in the repository, its time to click and drag / copy and paste our folders back into their correct locations. You will now see something like this:
myhost: working svn status
? path/to/directory

Thats, ok: in fact, that’s exactly what we want. Now, Subversion does not recognize our directories as versioned items. They’re brand new, as far as Subversion knows or cares. Now we can set the svn:ignore same as we would any other time:
[code]myhost: working cd path/to
myhost: to svn propset svn:ignore directory .
property ‘svn:ignore’ set on ‘.'[/code]

That’s it! Do an svn up and you’ll see your directories are not listed anymore.

It’s important to remember that, if you’re going to ignore more than one directory or file within a given directory, you need to create a file that you can feed into the svn propedit command that will list them separately. This blog post does an excellent job of explaining how to ignore files and directories. And of course, you should also refer back to the Red-Bean handbook on the subject.