fix svn problems

For some reason since I’ve upgraded to svn 1.7.4 my working copy get’s corrupted
Getting messages like:

svn: E155010: Pristine text '999135ffa335e04403a1d44452b14ffc74080f8a' not present


Originally when this happened I’ve deleted the working copy and do another checkout
This time I wanted to actually fix it rather than dropping everything and starting again

After some googling I’ve found a solution from Julian Foad on nabble.com

In short what you do is save the code as /usr/bin/svn-fetch-pristine-by-sha1.sh
and then call it like /usr/bin/svn-fetch-pristine-by-sha1.sh 999135ffa335e04403a1d44452b14ffc74080f8a
Job done, everyone happy, at least I am

echo "In NODES table:"
sqlite3 .svn/wc.db 'select * from nodes where checksum="$sha1$'$SHA1'"'
RRP=$(sqlite3 .svn/wc.db 'select repos_path from nodes where checksum="$sha1$'$SHA1'"')
REV=$(sqlite3 .svn/wc.db 'select revision from nodes where checksum="$sha1$'$SHA1'"')
echo "In PRISTINE table:"
sqlite3 .svn/wc.db 'select * from pristine where checksum="$sha1$'$SHA1'"'
if [ -e "$PRISTINE" ]; then
echo >&2 "Pristine file already exists: $PRISTINE"
exit 1
fi
echo "Downloading '^/$RRP@$REV'..."
svn cat "^/$RRP@$REV" > $PRISTINE
V=$(sha1sum "$PRISTINE"); V=${V:0:40}
echo "SHA1: $V"
V=$(md5sum "$PRISTINE"); MD5=${V:0:32}
echo "MD5: $MD5"
LEN=$(stat --printf=%s "$PRISTINE")
echo "Len: $LEN"
echo "Inserting PRISTINE table row..."
#echo sqlite3 .svn/wc.db 'insert into pristine values ("$sha1$'$SHA1'", null, '$LEN', 1, "$md5 $'$MD5'")'
sqlite3 .svn/wc.db 'insert into pristine values ("$sha1$'$SHA1'", null, '$LEN', 1, "$md5 $'$MD5'")'
sqlite3 .svn/wc.db 'select * from pristine where checksum="$sha1$'$SHA1'"'

Leave a Reply