SVN

23
Jul

Removal of the branch from SVN

Posted by eugene as SVN

As you know, when removing a branch from SVN from any client, in my situation it’s Eclipse+Subclipse, the whole history of the branch is saved. And the only possibility to remove the history is to use the svdadmin + svndumpfilter utility.

Before all it’s necessary to create a full dump of repository. It’s not easy to do so but very easy:

svnadmin dump [path to the repository] > [file name]
svnadmin dump C:/MyRepository > MyRepository.dump

As the result of implementation of this command the text file will be created with the full content of repository.

Now it’s necessary to remove the obsolete branch from this file. Let’s apply the svndumpfilter utility for this:

svndumpfilter --drop-empty-revs [branch prefix] < [full dump file] > [file of the filtered dump]
svndumpfilter --drop-empty-revs test < MyRepository.dump > MyRepository.filtered

This command filtered the branches which names are started with ‘test’ and it created the MyRepository.filtered file where this branch is absent.

Now you can safely delete the repository C:/MyRepository folder (of course, save all the settings and hooks at first) and re-create the repository again:

svnadmin creat [path to the repository]
svnadmin create C:/MyRepository

Now you can load the filtered dump in the re-established repository:

svnadmin load [path to the repository] < [dump file]
svnadmin load C:/MyRepository < MyRepository.filtered

And that is all. Good luck.