brucemartin
brucemartin

Reputation: 417

svn update over-write existing non-versioned files

I'm trying to put our site under full version control. The site and files currently exists on the server and I need to replace those non-versioned files with a versioned copy without deleting the directories or files.

I tried using

svn checkout --force https://myrepo/trunk .

svn revert -R .

Which did the checkout however, I am using some svn externals which take the place of some existing directories. I get this error: Fetching external item into 'production/JS': svn: warning: W155007: Can't obtain lock on non-directory

JS is an external project. I know I can simply delete the existing directories and do an update or checkout and everything will be there, but I don't want to take the site down long enough to do the checkout.

So is there a magical spell I can cast on svn to get it to replace my existing directories with these externals?

Upvotes: 3

Views: 2791

Answers (1)

thekbb
thekbb

Reputation: 7934

I'd recommend not serving your site out of an svn working copy. A simple deployment script (run by your CI server) could package up your source, (copy/extract/install) on your server atomically. How this is works is going to be highly dependent on your site/app. you could start by symlinking wwwroot to site-1.0.0 then

  1. have your build machine (or CI server) package up your source
  2. Have a deploy script that copies the package to the server
  3. extract/install it to site-1.0.1
  4. swap the symlink that points to site-1.0.0 to site-1.0.1
  5. delete all but the latest 5 versions of the site

This buys you a few things:

  • you get a truly atomic deploy, even an svn update may leave your site in a wonky state for a short time
  • You can quickly and easily revert to a known state by moving the symlink back.
  • It removes some risk of someone editing a file locally on the server (an svn up won't undo the update)
  • your build/package or even deploy script can concatenate/minify your js
  • the script can also expire things in any caches or CDN

I'm sorry that this doesn't directly answer your question, but I felt it was worth mentioning.

Upvotes: 1

Related Questions