Slim down the disk space of the svn Repository

Source: Internet
Author: User

Cause:

Test projects written by myself are usually stored in an SVN repository on your computer. Some materials are deleted after being put in, but the SVN version library will not be reduced,

If a 0/50 m project is put in, and the version history is 50, you can check the svn library, the DB/revs/file, and the svn library will be permanently stored,

This function will be useful if the project is to be restored in the future. If it is permanently abandoned, You need to slim down the svn library.

1. Export the entire version Library

Svnadmin dump F:/SVN/test> F:/SVN/dump

My version library and path are F:/SVN/test,

In this way, the entire test database is exported to the dump file in the F:/SVN folder.


(You can also remove the version library from the export process and use the-R parameter to specify the version records to be exported from 60 to 99.

Svnadmin dump F:/SVN/test-r 60: 99> F:/SVN/dump)


2. Filter dump files

Svndumpfilter include/trunk/project1 <dump> dump_project1 -- drop-all-empty-revs

This command filters all files in the/trunk/project1 file in the dump file to the dump_project1 file,


Svndumpfilter exclude/trunk/project1 <dump> dump_project1 -- drop-all-empty-revs

This command filters out all files in the/trunk/project1 file in the dump file, and puts the remaining file information in the dump_project1 file.


If there are multiple projects, you can add a space after/trunk/project1, and then write the project path. eg:/trunk/project1/trunk/project2

The following are all the parameters that can be used for filtering:

-- Drop-empty-revs: Remove revisions emptied by filtering.
-- Drop-all-empty-revs: Remove all empty revisions found in dumpstreamexcept Revision 0.
-- Renumber-revs: Renumber revisions left after filtering.
-- Skip-missing-merge-Sources: Skip missing merge sources.
-- Targets Arg: Read additional prefixes, one per line, fromfile Arg.
-- Preserve-revprops: Don't filter revision properties.
-- Quiet: Do not display filtering statistics.
-- Pattern: Treat the path prefixes as File Glob patterns.

Generally, you can use -- drop-all-empty-revs to delete the original number and sort it from the new list. The historical information of the filtered file is discarded.

-- Renumber-revs: the historical information is discarded, but the serial number is not rearranged.

-- Preserve-revprops: retains all old version information, including filtering out file information.

3. Create a SVN database and import the data with the filter number

 

Svnadmin create Test2
SVN mkdir file: // F:/SVN/Test2/trunk -- parents-f:/SVN/log.txt (this is to add a trunk directory to the newly created SVN library, otherwise, an error will be reported in the next step. You must manually create the parent directories of all the filter directories)
Svnadmin load F:/SVN/Test2 <dump_project1



A complete batch processing file:

Svnadmin dump F:/SVN/test> F:/SVN/dump

Svndumpfilter include/trunk/project1 <dump> dump_project1 -- drop-all-empty-revs

If exist Test2 (
RD/S/Q Test2
Svnadmin create Test2
SVN mkdir file: // F:/SVN/testtemp/Test2/trunk/-- parents-f:/SVN/log.txt
) Else (
Svnadmin create test
SVN mkdir file: // F:/SVN/testtemp/Test2/trunk/-- parents-f:/SVN/log.txt
)
Svnadmin load F:/SVN/testtemp/Test2 <dump_project1



A cautious operation:

If you filter out such a/trunk/first/second/Third/project1 project, move project1 to/trunk.

Result:

/Trunk/project1

In the future, you will not be able to slim down the files under project1 and exclude some files, in this case, the file in project1 still points to the path of the old physical disk file in the/trunk/first/second/Third/project1 project. the path on SVN is changed, while the disk file is not changed. The old SVN path/trunk/first/second/Third/project1 is changed to an invalid path.

When you filter the exported files of the library again, the following error occurs:. eg: filter/trunk/project1/docs.

Svndumpfilter include/trunk/project1/docs <dump> dump_project1_docs -- drop-all-empty-revs

When the files under docs are filtered to dump_project1_docs, the/trunk/first/second/Third/project1 path is still used to copy the file.
Then the/trunk/first/second/Third/project1 path is invalid.



Therefore, if you lose weight, you can lose the disk space. Do not make the path thin. Do not try to lose the disk space after the path is thin.



 

Http://svnbook.red-bean.com/en/1.7/svn.ref.svndumpfilter.html#svn.ref.svndumpfilter

Slim down the disk space of the svn Repository

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.