Delete parts of subversion history
When you decide to move a svn repository to the public it might be necessary to remove older versions from history.
For example, lets say your repository is at version 10000. However up until version 9000 you where not considering going open source. But once you did you cleaned up the code. However the old dirty code is still in svn history.
You don’t want to lose all of the history, just everything below version 9000.
This is how you do it.
svnadmin dump /path/to/current/repo -r9000:10000 > svn.dump
svnadmin create /path/to/new/repo
svnadmin load /path/to/new/repo < svn.dump
Poof! Version 9000 and below are gone. The repository is now at version 1000.
Joshua L. Davis said,
November 20, 2007 @ 7:40 am
Thanks!
Darren G said,
December 11, 2007 @ 9:44 am
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″
House of Code said,
March 1, 2008 @ 1:29 pm
Subversion Obliterate, the forgotten feature…
Subversion Obliterate has been a much wanted feature for many years now, yet it is not even planned or mentioned on the Subversion roadmap. Discussions have been going on and money has been waving, yet still no movement towards a concrete implementatio…
abhilash said,
August 24, 2008 @ 11:08 pm
Hai,
I need to delete particular revision from history. Actually I have mistakenly tagged in worng folder. I have deletd the folder from svn. But in history still its showing. How can I delete that history.
eg: revision no. 224876
Please reply. It will be very helpful.
Rob said,
August 25, 2008 @ 6:43 am
You will need to do 2 dumps in this case I think.
svnadmin dump /path/to/current/repo -r1:224875 > svn.dumpa
svnadmin dump /path/to/current/repo -r224876:HEAD > svn.dumpb
svnadmin create /path/to/new/repo
svnadmin load /path/to/new/repo < svn.dumpa
svnadmin load /path/to/new/repo < svn.dumpb
Your svn # numbers will be off by one. To avoid this do a blank commit after loading dumpa.
Note: I have not tried this.