Backing Up & Restoring a Remote SVN Repository

If you’re hosting your Subversion repository remotely, either through a web host or through one of many Subversion hosting services, you probably won’t have direct access to the server to be able to run shell commands on it. This can create a challenge when it comes to backing up and restoring your SVN repositories remotely.

Trying to achieve this using the svnadmin command will not work:

svnadmin load http://project.hosting/svn/repo < dump
svnadmin: 'http://project.hosting/svn/repo' is an URL when it should be a path

There is however a way of doing this remotely.

What You Need

You’re going to need a a tool called svnrdump. As described by Apache, “svnrdump replicates the functionality ofsvnadmin dump and svnadmin load, but works on remote repositories, instead of needing administrator (local filesystem) access to the source or target repository.”

The easiest way to get svnrdump is by downloading and installing the SVN client utility, TortoiseSVN and making sure to install the “Command Line Client Tools” in the installer options. You can then find svnrdump inside the bin folder where TortoiseSVN was installed.

Backing Up Your Repository Remotely

We’re now going to generate a .dump file which contains the entire history of revisions for our repository. To make a complete backup run the following command:

svnrdump dump [SOURCE_URL] > [DUMP_DESTINATION]

For example:

svnrdump dump svn://myrepohost.com:port/repos/myproject > C:\myrepobackup.dump

Note that this command requires your target server to be running SVN 1.4 or newer. For more information about the dump command as well as additional parameters please see the documentation.

Restoring Your Repository Remotely

Now that we have our .dump file, we can use it to restore our repository. To restore your repository run the following command:

svnrdump load [DESTINATION_URL] < [SOURCE_DUMP]

For example:

svnrdump load svn://myrepohost.com:port/repos/newproject < C:\myrepobackup.dump

Note that this command requires your target server to be running SVN 1.7 or newer. For more information about the load command as well as additional parameters please see the documentation.

Here’s a windows batch file that I use to make one click backups, it creates a file called SVN_YYMMDD.dmp in the same directory as the batch file:

for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set y=%%k
for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set d=%%k%%i%%j
for /F "tokens=5-8 delims=:. " %%i in ('echo.^| time ^| find "current" ') do set t=%%i%%j
set "outFilename=%~dp0SVN_%d%.dmp"
 
cd "C:\Program Files\TortoiseSVN\bin"
svnrdump dump svn://yoursvnserver:port > %outFilename%
PAUSE
Bookmark the permalink.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值