SVN batch incremental migration repository

Option 1. Incremental migration of the repository in batches.
 
①Check the latest version number of the current old version library
In the command prompt window, open the directory where the library is located, for example: cd D:\Repositories.
Execute svnlook youngest oldRepositories,
 
for example, the returned version is 281
 
② Incremental export of the repository content in batches
D:\Repositories\svnadmin dump oldRepository -r 0:100 > dumpfile1
to export the first file, revision
 
D: \Repositories\svnadmin dump oldRepository -r 101:200 --incremental > dumpfile2
export the second file, revisions from version 101 to 200
 
D:\Repositories\svnadmin dump oldRepository -r 201:281 --incremental > dumpfile3
export The third file, the revision with the version number from 201 to 281
 
 
Note: The second and third commands in the three commands have an additional --incremental parameter, which makes it export in an incremental manner.
 
③Import versions in batches Repository
 
Note: Open the directory where the repository to be imported is located, such as cd E:\Repositories.
 
First import dumpfile1, then dumpfile2, and dumpfile3
executes
E:\Repositories\svnadmin load newRepository < dumpfile1
 
E:\Repositories\svnadmin load newRepository < dumpfile2
 
E:\Repositories\svnadmin load newRepository < dumpfile3 There
 
may be a problem, prompting an error: The repository file already exists. Please confirm whether the --incremental parameter is used when exporting before.
 
Description: Here we are in the command prompt window. Similarly, we can also use the method of writing batch files according to Scheme 1.
 

Note: Write commands according to your own svn installation directory and library directory, for example:

C:\Program Files\VisualSVN Server\bin\svnadmin load D:\Repositories\newRepository < E:\dumpfile1
 
Scheme 2. After exporting, perform sub-repository processing or other processing operations to filter the repository history after exporting.

 
Suppose there is a repository oldRepository with three projects: Project1, Project2, and Project3. They are laid out in the repository as follows:
/
  Project1/
      trunk/
      branches/
      tags/
   Project2/
      trunk/
      branches/
      tags/
   Project3/
      trunk/
      branches/
      tags/
 
Now it's time to move the three projects into three separate repositories .
①Export the entire repository using the scheme 1 described above:
svnadmin dump oldRepository> dumpfile
 
②The dump file is sent to the filter three times, and only one top-level directory is retained each time, and three dump files can be obtained:
cat dumpfile | svndumpfilter include Project1> 1-dumpfile
cat dumpfile | svndumpfilter include Project2 > 2-dumpfile
cat dumpfile | svndumpfilter include project3 > 3-dumpfile
 
Note: cat is the subversion document, the command given in the introduction of svndumpfilter is not available under windows, and the command similar to cat is type , you can use typedumpfile | svndumpfilter include Project1> 1-dumpfile
 
③ Each of these three dump files can be used to create a usable repository, but they retain the exact path structure of the original repository.
That is to say, although the project Project1 now has an exclusive repository, the repository still retains a top-level directory named Project1. If you want the three directories trunk, tags and branches to be located directly in the root path of the repository, you may need to edit the dump file, adjust the Node-path and Copyfrom-path header parameters, and delete the path Project1/.
Also delete the part of the dump data that created the Project1 directory. Usually something like the following:
 Node-path: Project1
 Node-action: add
 Node-kind: dir
 Content-length: 0
 
Note: When manually editing the dump file to remove a top-level directory, do not let the editor convert newlines For local format (such as converting \r\n to \n), it is easy to cause the dump file to fail.
 
④Finally, we can use the method provided by solution 1 to import the three dump files separately:
svnadmin create Project1
svnadmin load Project1< 1-dumpfile
svnadmin create Project2
svnadmin load Project2< 2-dumpfile
svnadmin create Project3
svnadmin load Project3< 3-dumpfile

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324817591&siteId=291194637