views:

1071

answers:

3

Hi,

I'm looking for a solution for the following situation.

We're using Subversion, and besides the development enviroment, where we use checkouts, we have a test environment, which is supposed to resemble the production environment as closely as possible.

Therefore, we now have it set up so that the environment is updated by using svn export. However, since we just want the latest revision, we don't know what revision has been exported.

My question is, is there some way to "mark" this export, for example by adding some generated file, that indicates which revision was exported? (We don't want to export tags, as we will be updating several times within one release cycle.)

I hope someone can help me. Thanks!

+3  A: 

One thing you could do is make sure you're exporting from a known revision, and write that revision number to a text file in the export. The svnversion command will tell you the revision number of a working directory. So do an svn update to get the latest version, then svn export to your deployment location, then svnversion redirecting the output to a text file in the same place as the export. The revision number will be the revision as of the update, even if somebody has committed new code since then.

You will of course want to automate the above process in a shell script or something.

Greg Hewgill
Thanks for your answer. It doesn't really solve my problem, however. The situation is that external developers will commit from their checkout, and I will run an update script that performs the export. I did figure out that I can try to capture the output from the svn export command, as it prints "Exported revision ..." at the end.
Unimatrix01
A: 

you could do svn info /path/to/repository just before (or after) exporting, but you'd have to lock to make sure no changes were made.

Alternately using the technique described in your comment and pipe through a shell script like:

svn export /path/to/repository | grep ^Exported > revision.txt

or

svn export /path/to/repository | tail -l > revision.txt
fijiaaron
A: 

Alternately, you could do an svn update and then svn export from that local copy. The benefit of this is that subversion will use "rsync" (or whatever algorithm it uses) to update only those files changed. And then you just export from your local copy, saving bandwidth, and retaining all the repository info with your local checkout

Create two directories, one for checkout, and one for export, then deploy with a two step process:

svn update /path/to/repository checkout/project
svn export checkout/project export/project 
fijiaaron