views:

72

answers:

2

We are using svn for development of a large web application, and we do periodic updates to production. The production server does not have access to svn (for security reasons).

What is the best way to push the changes since the last production release for a new release? We would like to avoid re-creating the whole site each time, since it is very large.

A: 

Do a checkout to a directory on your side of the glass wall, make it accessible from the production server. Use some sort of diff/sync utility to synchronize the two, minus the _svn folders or any other files that would contaiminate the production environment.

Or use a zip (or other archive) of files with "changes since mm/dd/yyyy", and apply it to the prodution directory.

Chris Thornton
Can you provide more details on what utility to use?
JoelFan
@Joel Try `rsync` on unixoids or `robocopy` on Windows. Both can syncronize one directory to another, while transferring only the changed files.
calmh
Unison on unix is popular, I tried to get it working once... I think it's available for Windows too. You could use either Unison or rsync within CYGWin, I think.SecondCopy for Windows. You can use BeyondCompare on Windows, to do it manually (useful if you're not sure you know what you're doing). FileBoss on Windows.There are lots of these things.
Chris Thornton
+1  A: 

Well let me give a shot. You can parse the SVN update command output and generate copy instructions that only copy the files that were changed?

http://svnbook.red-bean.com/en/1.1/ch03s05.html

Let's examine the output of svn update a bit more. When the server sends changes to your working copy, a letter code is displayed next to each item to let you know what actions Subversion performed to bring your working copy up-to-date:

U foo

File foo was Updated (received changes from the server).

A foo

File or directory foo was Added to your working copy.

D foo

File or directory foo was Deleted from your working copy.

R foo

File or directory foo was Replaced in your working copy; that is, foo was deleted, and a new item with the same name was added. While they may have the same name, the repository considers them to be distinct objects with distinct histories.

G foo

File foo received new changes from the repository, but your local copy of the file had your modifications. Either the changes did not intersect, or the changes were exactly the same as your local modifications, so Subversion has successfully merGed the repository's changes into the file without a problem.

C foo

File foo received Conflicting changes from the server. The changes from the server directly overlap your own changes to the file. No need to panic, though. This overlap needs to be resolved by a human (you); we discuss this situation later in this chapter.

Or if you prefer a semi-manual solution you can use a diff tool like WinMerge or Araxis Merge to sync both directories.

EDIT:

I don't think "svn update" will work exactly, but what I settled on was:

  • svn checkout of the current (old) prod revision
  • svn switch to the revision that is ready for prod (new)

I wrote a script to capture the output of the "switch". It translates U and A operations to "adds" to a zip archive. It translates D operations to delete commands to be executed on the production server. On the production server, we just need to unzip the archive and run the delete commands.

smink
How do I set up the working directory before doing the update?
JoelFan
just `cd` there and do `svn update`.$ svn updateA newdir/toggle.cA newdir/disclose.cA newdir/launch.cD newdir/READMEUpdated to revision 32.
smink
It will have no updates, because it is the development directory!
JoelFan
Create a new folder that is just for this purpose.
smink
What is the command to create the folder?
JoelFan
I think I figured it out... not svn update... svn checkout of the current prod version, then svn switch to the version that is ready for prod
JoelFan
Yes. Do a `svn checkout` in a machine that has access to SVN. That is the directory that you will sync with the production server. After you do the first checkout you always do `svn update` from that point on.
smink