3

I have an automated script (written in KSH) that sets SVN externals for folders within a repository. When I run this script it does the following:

Check-outs part of a repository fully.

Then, loops through a file with all the Subversion properties to set externals and:

  1. Executes a SVN update for the local working copy. Outputs the current SVN external property of the folder the script is currently working on. (which can be one or more levels deep)
  2. Pulls variable for new external from the file
  3. Set previous externals and one new external at this folder using svn propset.
  4. Commits the change to the repository

Then the script moves onto the next line in the file.

Script excerpt:

mkdir "${SVNLOC}/${PROJNAME}"
svn co --no-auth-cache --username $SVNUSER --password $SVNPASSWORD "${1}" "${SVNLOC}/${PROJNAME}" >> $LOGFILE 2>&1

while read extline
do

# parse line for variables
parent=$(echo $extline | cut -f1 -d,);
extfolder=$(echo $extline | cut -f2 -d,);
exturl=$(echo $extline | cut -f3 -d,);
revision=$(echo $extline | cut -f4 -d,);

# execute a SVN update to ensure we have the very latest properties
echo "SVN Update in ${SVNLOC}/${PROJNAME}" >> $LOGFILE 2>&1
echo "svn update --no-auth-cache --username $SVNUSER --password $SVNPASSWORD --ignore-externals ${SVNLOC}/${PROJNAME}/${parent}" >> $LOGFILE 2>&1
svn update --no-auth-cache --username $SVNUSER --password $SVNPASSWORD --ignore-externals ${SVNLOC}/${PROJNAME} >> $LOGFILE 2>&1

# change directory to folder in local check-out where external will be set.
cd ${SVNLOC}/${PROJNAME}/${parent}
pwd >> $LOGFILE 2>&1

# if the revision is empty/unset then set external with out revision setting
if [ "$revision" == "" ] ; then

echo "Set External ${exturl} at ${SVNLOC}/${PROJNAME}/${parent}" >> $LOGFILE 2>&1
# output externals info to a file
echo "'${extfolder}' '${exturl}'" > svnext
# append current externals to the list so they're not deleted
svn propget --no-auth-cache --username $SVNUSER --password $SVNPASSWORD svn:externals . >> svnext
# set new and existing externals to the property
svn propset --no-auth-cache --username $SVNUSER --password $SVNPASSWORD svn:externals --file svnext . >> $LOGFILE 2>&1
rm svnext
else    # if the revision is set then set external with revision setting

echo "Set External ${exturl}@${revision} at ${SVNLOC}/${PROJNAME}/${parent}" >> $LOGFILE 2>&1

# output externals info to a file
echo "'${extfolder}' -r${revision} '${exturl}'" > svnext
# append current externals to the list so they're not deleted
svn propget --no-auth-cache --username $SVNUSER --password $SVNPASSWORD svn:externals . >> svnext
# set new and existing externals to the property
svn propset --no-auth-cache --username $SVNUSER --password $SVNPASSWORD svn:externals --file svnext . >> $LOGFILE 2>&1
rm svnext

fi

# commit externals set in this loop
echo "Commit Externals in ${SVNLOC}/${PROJNAME}/${parent}" >> $LOGFILE 2>&1
echo "svn commit --no-auth-cache --username $SVNUSER --password $SVNPASSWORD -m "Committing externals to SVN for Project ${PROJNAME}" ${SVNLOC}/${PROJNAME}" >> $LOGFILE 2>&1
svn commit --no-auth-cache --username $SVNUSER --password $SVNPASSWORD -m "Committing externals to SVN for Project ${PROJNAME}" "${SVNLOC}/${PROJNAME}" >> $LOGFILE 2>&1

done < "$2"

The SVN commit may work in the first couple of iterations of the loop, but then fails on an iteration with a SVN error such like:

svn: E160004: Commit failed (details follow):
svn: E160004: Corrupt node-revision '0.0.r180/4191'

But if I do a svnadmin verify against the repository my script was working on it says that the revision is verified:

* Verified revision 177.
* Verified revision 178.
* Verified revision 179.
* Verified revision 180.

So if I do work against the repository (or view it with TortoiseSVN) after the error I get the same svn error above but it's not caught by svnadmin verify.

Edit: I did check the SVN error logs on the SVN server involved and found the following error:

Could not MERGE resource "<SVN_REPOS_PATH>/!svn/txn/179-4z" into "<SVN_REPOS_PATH>/<PATH_TO_FOLDER>".  [500, #0]
Could not open the FS root for the revision just committed.  [500, #160004]
Corrupt node-revision '0.0.r180/4191'  [500, #160004]
Missing id field in node-rev  [500, #160004]
Could not fetch resource information.  [404, #0]
(2)No such file or directory: Named transaction doesn't exist.  [404, #0]

Which still doesn't explain why commit truly fails.

Has anyone encountered this? If so any tips, recommendations or possible solutions?

I'm using a SVN 1.7.2 CLI client against a 1.7.8 SVN repository.

hrocafella
  • 31
  • 3

0 Answers0