A site devoted to discussing techniques that promote quality and ethical practices in software development.

Wednesday, April 14, 2010

Copying Or Moving Subversion Repositories

Recently, I had to replace the hard drive on which my collection of repositories live. Rather than using the subversion recommended way, I used XCopy to transfer the collection from my old drive to the new in Windows XP, after making sure no one is using the FSFS. I have nearly lost the lot.

The result was corrupted repositories and when I tried to commit files to one, it reported the path to ...\db\transactions\74-24.txn not found and refused to commit. ...\db\transactions was definitely missing.

This is the command with the switches I used:

XCOPY <source> <destination> /h /o /c /v /k /s

It is the last switch /s that was the culprit. It only copies non-empty directories and files. In svn, you can have empty directories (such as db\transactions) and files with zero bytes. As a result, they were not transferred across.

The correct switch is the /e that will copy empty directories and zero-byte files. So to copy them correctly use the following switches:
XCOPY <source> <destination> /h /o /c /v /k /e

There are two methods that I have found to be more reliable and easier to use.
1) Use Windows XP's NTBackup tool
This is the most reliable way of backing up the entire repository and restoring them. It should be used as a matter of course. I am wondering how well the Win7 replacement of this tools works? Vista's one is totally useless.

2) Use 7za.exe
Make sure Windows users use * to specify all files instead of the Windows' *.* convention for all other commands and to include the -r switch.

No comments:

Blog Archive