Now, let's see a simple real world example. Let's say you have downloaded an important piece of code and created a local svn repository in your laptop because somehow your central svn server is not reachable. You have worked with this local repository and have got your version number up to version 20. Later on, you plan to migrate this repository into the central svn server along with the changes recorded in the local repository. The keyword here is migration. This process is explained in the Subversion Book for Subversion 1.2 Chapter 5 Repository Administration in section Repository Maintenance. The tool to migrate the local repository to the central server is svnadmin. These are steps in detail.
1. Using your current version of svnadmin, dump your repositories to dump files. This accomplished with:
$ svnadmin dump path_to_repository > dump_filename
The output of this command would be similar to:
$ svnadmin dump path_to_repository > dump_filename
* Dumped revision 0.
* Dumped revision 1.
* Dumped revision 2.
…
* Dumped revision 19.
* Dumped revision 20.
2. Create a new empty repository in the central server with:
$ svnadmin create
3. Transfer the file to the central svn server.
4. Using svnadmin in the central server, load your dump files into their respective, just-created repositories.
$ svnadmin load path_to_new_repository < dump_filename
The output of this command would be similar to:
$ svnadmin load path_to_new_repository < dump_filename
<<< Started new txn, based on original revision 1
* adding path : A ... done.
* adding path : A/B ... done
...
<<< Started new txn, based on original revision 20
* adding path : A/Z/zeta ... done.
* editing path : A/mu ... done.
------- Committed new rev 20 (loaded from original rev 20) >>>
If you are using a different version of subversion in the central server, you have to pay attention to the following issue.
Be sure to copy any customizations from your old repositories to the new ones, including
DB_CONFIG files and hook scripts. You'll want to pay attention to the release notes for the new release of Subversion to see if any changes since your last upgrade affect those hooks or configuration options.
It's a good idea to test the just migrated svn repository using svn co and then try to compile the source code to ensure everything went ok.
Now, say you are away again with your laptop and have committed some changes to the local repository because you cannot access the central server. Then you want to reflect the changes you have made since the last time you migrate the svn repository. This can be accomplished with:
$ svn dump path_to_repository --revision 20:25 --incremental > dump_filename
In the command above, you inform subversion that you want to backup only the changes from revision 20 to 25. You can then load these changes using svnadmin load command as before.
That's it. Now you can work offline with your laptop and have the local svn repository synchronized with your central server with the help of svnadmin.
Post a Comment
No comments:
Post a Comment