user120465
user120465

Reputation:

"Mark" SVN export with revision

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

We're using Subversion, and besides the development environment, 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.

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.)

Upvotes: 5

Views: 5198

Answers (3)

fijiaaron
fijiaaron

Reputation: 5185

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 information 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

Upvotes: 0

fijiaaron
fijiaaron

Reputation: 5185

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 piping through a shell script, like:

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

or

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

Upvotes: 2

Greg Hewgill
Greg Hewgill

Reputation: 993861

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.

Upvotes: 3

Related Questions