Remove bad revision from svn repository

I've been through a svn to git migration, I've been blocked with a bad revision which prevented me from git svn clone my repository. I've seen that it is possible to bypass bad revision, using svnadmin utility.

I've wrote a small script that allows me to skip bad revision, an continue the dumping process without any manual action :

#!/bin/sh
echo "removing initial revision dump"
rm -f /home/data01/svn-dumpfile-20190517-1
 
if ! [ -f /home/data01/svn-dumpfile-20190517 ] ; then
    echo "dumping first"
    /usr/bin/svnadmin dump /home/data01/repository > /home/data01/svn-dumpfile-20190517 2> ./dump-start.log
fi
echo "copie du dump"
cp /home/data01/svn-dumpfile-20190517 /home/data01/svn-dumpfile-20190517-1
 
counter=1
counter=$(tail ./dump-start.log |grep "Dumped revision" | tail -1 | awk -F "Dumped revision " '{print  $2}' | awk -F "." '{print  $1}')
((counter++))
echo "last buggy revision is : $counter"
echo "incrementing next revision"
((counter++))
echo "removing last dump.log"
echo > ./dump.log
res=1
echo "ready to start !?"
read toto
#42762
while [ "$counter" -le 42700 ] || [ "$res" -eq 1 ]
do
    echo "dumping from revision $counter"
    /usr/bin/svnadmin dump --incremental -r $counter:HEAD /home/data01/repository >> /home/data01/svn-dumpfile-20190517-1 2>>./dump.log
    res=$?
    if [ "$res" -ne 0 ] ; then
        newcounter=$(tail -20 ./dump.log |grep "Dumped revision" | tail -1 | awk -F "Dumped revision " '{print  $2}' | awk -F "." '{print  $1}')
        if [ "" != "$newcounter" ] && [ $newcounter -gt $counter ] ; then
            echo "found newcounter=$newcounter"
            counter=$newcounter
        fi
        ((counter++))
        echo "buggy revision is : $counter"
    else
        echo "end of the dump !"
        continue
    fi
    echo "skipping revision $counter"
    ((counter++))
done

It's a quick-and-dirty script, leaved here asis ;)