Move Project From One SVN Repository To Another One

On February 18, 2015, in Other Online Technology, by James Liu

These days I am working on migrating my projects from Google SVN repository to my local SVN repository. Last time, I finally find a way to mirror all my code history logs from Google SVN server to a temporary local SVN server. The next tough problem is how to move the project from the temporary local repository to my working repository.

move project to new repository

Step 1: Dump Source Repository

svnadmin dump c:\svn\Repo1 > repo1.dump

Step 2: Filter Out Project From Dump File

svndumpfilter --drop-empty-revs --renumber-revs include Branches/Proj1 < repo1.dump > proj1.dump

The above command will extract all logs of Proj1 from the source dump file and output to a new dump file. The svndumpfilter can also use exclude option to remove specific project from the dump. It also has three parameters:

  • –drop-empty-revs: Do not generate empty revisions at all—just omit them.
  • –renumber-revs: If empty revisions are dropped (using the –drop-empty-revs option), change the revision numbers of the remaining revisions so that there are no gaps in the numeric sequence.
  • –preserve-revprops: If empty revisions are not dropped, preserve the revision properties (log message, author, date, custom properties, etc.) for those empty revisions. Otherwise, empty revisions will contain only the original datestamp, and a generated log message that indicates that this revision was emptied by svndumpfilter.

In this step, you may get this type of error message:

svndumpfilter: E200003: Invalid copy source path ‘/Branches/Proj1_old’

This case always happened when you filter the project which was moved from different folder. In above case, the Branches/Proj1 was moved from Branches/Proj1_old. So when you filter the dump file, you must include two project folder, the Proj1 and Proj1_old. The command will look like:

svndumpfilter --drop-empty-revs --renumber-revs include Branches/Proj1 Branches/Proj1_old < repo1.dump > proj1.dump

Step 3: Load The Filtered Dump File Into New Repository

svnadmin load --ignore-uuid --parent-dir html C:\svn\Repo2 < proj1.dump //comment >, don't copy this

In this step, you may get this error message:

editing path : html/Branches/Proj1 …svnadmin: E160013: File not found: transaction ‘331-9c’, path ‘/html/Branches/Proj1’

It is because in the new dump file which is filtered by svndumpfilter contains all change history of your Proj1. There is a change history recording that you add a new folder in folder Branches, but there is no such folder named “Branches”. Therefore, you need to manually create a Branches folder before you run above command.

create folder in new repository

After you successfully run the above command, your new repository will look like:
move project to new repository 2

Step 4: Move The Folder Within The Same Repository

svn move c:\svn\Branches\Proj1 c:\svn\html\Proj1

As long as the folders are in the same repository, the move will be much easy. If you are using TortoiseSVN, it will even easier. You can just drag and drop the folder to new location. After you change the folder location, your new repository will look like:
move project to new repository 3


Leave a Reply

Free WordPress Themes

Free WordPress Theme