RE: SVN post-commit hook: shadow folders
From: Schneider, Wolf <Wolf.Schneider_at_icbc.com>
Date: Tue, 8 Feb 2011 01:08:42 +0000
I wrote:
> To do this, I wrote the following script, which works well except for the actual file copy - svn copy complains about the target folder not being a directory, although it most certainly is. My questions are a) what is wrong with my use of svn copy, and b) is there perhaps a better way to achieve the ShadowFolder feature?
There _is_ a better way, using the svn export command (using svn cat only works for non-binary files). I had originally tried that, because in the Apache notes (http://subversion.apache.org/faq.html#single-file-checkout), it states that you can extract a single file without getting the versioning information:
"you can use 'svn export' to export a single file. This will retrieve the file's contents, it just won't create a versioned working copy."
However, I was getting 'path not found' errors and assumed that since the manual only talks about directories, the notes were wrong.
The real culprit, unfortunately, is in the error message -- the destination folder existed, it was just the permissions that were set incorrectly so that the SVN process didn't have access. Rather than have a second error message for access problems, SVN seems to only have the one that is shown regardless of what the problem is.
So, for the script I provided earlier to work, you need to a) ensure that the destination folder exists and is writeable by the SVN process, and b) use the following code:
rem Extract the file to the indicated shadow folder
svn export -r %REVISION% %REPURL%/%FPATH% %FOLDER%/%FNAME% --force
exit /b
== wolf
------------------------------------------------------------
This email and any attachments are intended only for the named
recipient and may contain confidential and/or privileged material.
Any unauthorized copying, dissemination or other use by a person
other than the named recipient of this communication is prohibited.
If you received this in error or are not named as a recipient,
please notify the sender and destroy all copies of this email
immediately.
|
This is an archived mail posted to the Subversion Users mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.