Partially delete subversion history

For what ever reason you might want to remove older versions from svn history.

If e.g. your repository is at version 100 and you want to remove all history below version 90,
then you do it as follow:

svnadmin dump C:\Files\Repositories\Bitlink -r90:HEAD > svn.dump
svnadmin dump C:\Files\Repositories\Bitlink -r90:100 > svn.dump
svnadmin create C:\Files\Repositories\BitlinkNew
svnadmin load C:\Files\Repositories\BitlinkNew < svn.dump

All version below 90 are gone now.
The repository is now either at head or version 100 respectively of the method you chose above.

One Response to this post.

  1. Posted by Darren G on 12.11.13 at 8:10 pm

    This helped me. I am runing SVN on a windows serverSince I envisage doing this on a regular (but infrequent) basis I thought I would throw together a batch file to help me along with it. The text of it is below if anyone is interested:

    @echo off
    REM check inputs

    if %1x==x goto abortusage
    if %2x==x goto abortusage

    REM check Path

    if not exist “%1″ set msg=”The Path to the repository (%1) does not exist!”
    if not exist “%1″ goto abortusage

    REM Delete any older dump temp files
    if exist “.\tmp” rd “.\tmp” /S /Q

    REM get the last version number
    svnlook youngest “%1″ > mrr.txt
    REM read the line from the MRR file
    for /F %%f IN (.\mrr.txt) DO set svnlast=%%f

    echo ————————–
    echo Last Revision was %svnlast%
    echo ————————–
    REM Dump
    svnadmin dump “%1″ -r%2:%svnlast% > svn.dump

    REM copy the currnt live to a tmp
    mkdir tmp
    XCOPY “%1\*.*” ./tmp

    REM delete original
    rd “%1″ /S /Q

    REM create a “new” repository
    svnadmin create “%1″

    REM reload
    svnadmin load “%1″

What's your thoughts on this?


Protected by WP Anti Spam