Caption:
The Department SVN version Library has not been cleaned up since its use, and as the SVN repository volume increases, the amount of time and media required for each backup increases and the Department SVN server space is limited. Therefore, it is necessary to perform regular cleanup of the SVN server. Today, the SVN document carefully studied, sorted out the SVN version of the library to clean up the method, especially on the Internet, for similar needs of the comrades for reference.
Svn Cleanup method
After research and analysis, there are two ways to clean SVN database:
1, Dump method (recommended)
Use the SVN dump command to back up the entire SVN library, and then use the Svnfilter command to remove items that do not need to be retained (exclude) or to create a new dump file that contains only the items that need to be retained (include), and then create an SVN library. Import the new dump file into the new library, delete the old library, and rename the new library to the old library name.
The advantage of this method is that the revision history of the project in the new library is preserved, which is more convenient to backtrack, and the disadvantage is that it is time-consuming to operate.
Action command:
To log on to the SVN server using an SSH client:
1 Execute svnadmin Dump/path/to/repo >dumpfile, backup project library;
2) Execute svnadmin create Newrepo, creating a new library Newrepo;
3 execute svndumpfilter include proj1 ... <dumpfile >proj1-dumpfile
4 Execute svnadmin Load Newrepo < Proj1-dumpfile
5 Delete old Library project and rename the new library to project.
2, Export/import method
Using the Export command, export the latest version of the items that you want to keep in the SVN library, create a new SVN library, import the project files from the previous step to the new library, delete the old library, and then rename the new library to the old library name.
The advantage of this approach is that it is simple to implement, and the disadvantage is that items imported into the new library do not contain version revision history and cannot be traced back.
Action command:
1 on the local PC (Windows system), create a new empty directory (assumed to be D:/SVN);
2 Click the right mouse button in this directory, select the Export menu item in the Tortoise SVN menu, and export the item that needs to be retained;
3 Login to SVN server using SSH client, execute svnadmin create PROJECT2, create new library project2;
4 Click the right mouse button in this directory, select the Import menu item in the Tortoise SVN menu, import the items in the local directory into the Project2 library;
Log on to the SVN server using an SSH client, delete old Library project, and rename the new library to project.