Moe Sweet
Moe Sweet

Reputation: 3721

SVN Ignore situation

I have a setup like this.

  1. SVN Repository
  2. Live Site
  3. Dev Site
  4. Local Copy

SVN Repository is identical to Live site. Every different sites have different config file, local.xml. Some clients are windows/toitoise and some clients are linux servers which I have SSH access to.

My requirements are.

  1. I don't want local.xml to be changed neither on A. Repository when committing nor B. clients when updating.

  2. I want local.xml to be part of every new checkouts.

  3. I don't want local.xml files on clients lingering "modified" with question mark signs after being modified.

  4. I don't want to manually "uncheck" local.xml on every commit as there are some more folders like cache and image files to be "ignored" too.

I've tried, - Locking the file on Repo. That throws an ugly error when committing. I'm afraid it would break the rest of commits. - SVN:ignore local.xml. But seems it's still going through.

Thanks for your help.

Upvotes: 1

Views: 114

Answers (2)

Kaivosukeltaja
Kaivosukeltaja

Reputation: 15735

Having the file in the ignore list is needed, but it alone will not do the trick. You'll also need to delete the file from the repository. Run this to delete the file from SVN but keep the local file:

svn rm --keep-local local.xml
svn commit

EDIT: A common way to keep local settings files in SVN is adding them with names like default.local.xml and copying them to local.xml and modifying the settings right after the first checkout. This way you won't risk overwriting of conflicting your actual settings file.

Upvotes: 1

David W.
David W.

Reputation: 107040

I think I see what you want. The right way to do it by having a build process.

In your repository, you will have a local.template.xmlfile and a local.properties.template file. There is no local.xml file or a local.properties file.

Your developers will take the local.properties.template and make a local.properties file that will suit their needs. The developers will use the build process which will take their local.properties file and the local.template.xml file, and merge them into a local.xml file for their use.

When the developers commit their code, they won't commit the local.xmlor the local.properties file. Since these won't be in the repository, the developers can freely update their working directory without worrying that it will somehow destroy their settings in the local.xml file.

And, you can deploy on the server without worry since the new release won't rewrite the server's local.xml file.

What you need is a pre-commit hook that can guarantee that developers won't add a local.xml or a local.properties to the repository. I have one that's pretty simple to install and use. It uses a control file to specify what files can be added and by whom.

Upvotes: 2

Related Questions