Wednesday, February 27, 2008

Moving your svn repository to a Parallels Shared Network Drive on the Mac

I'm running svn under windows as a Windows Service on my Parallels virtual machine (not using Apache). I wanted to move the repository from my local c:\ drive to a shared Parallels folder to take advantage of TimeMachine backups of my svn repository. I ended up deleting and recreating the SVN service. These are the steps:

1. Find the service name. Look in the services console. Find the display name of the service in there. Then, from the command prompt, use the "sc query" command to list all of the services and find the matching display name.

2. Check the current config, especially the binary path to the snvserve exe.


C:\Documents and Settings\Administrator>sc query svnrepos
SERVICE_NAME: svnrepos
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

C:\Documents and Settings\Administrator>sc qc svnrepos
[SC] GetServiceConfig SUCCESS
SERVICE_NAME: svnrepos
TYPE : 10 WIN32_OWN_PROCESS
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : "C:\program files\subversion\bin\svnserve.exe" --service -r "c:\svn"
LOAD_ORDER_GROUP :
TAG : 0
DISPLAY_NAME : Subversion Repository Local
DEPENDENCIES : Tcpip
SERVICE_START_NAME : LocalSystem


3. Delete the service.


sc stop svnrepos
sc delete svnrepos


4. Create the new service with the new file system path (don't forget the spaces after the '=' signs and the \ before the nested quotes). It is important to use the UNC path to the shared Parallels folder and not the drive letter, because the drive letter will not work! I found the UNC path by clicking "Map Network Drive" under explorer and looking in the drive dropdown. A quick test of "dir \\.psf\osxpshared" will tell if you got it right.

sc create svnrepos binpath= "\"c:\program files\subversion\bin\svnserve.exe\" --service -r \"\\.psf\osxpshared\svn\"" displayname= "Subversion Repository" depend= Tcpip start= auto

If you get the mysterious "service is marked for deletion" message then make sure you have closed the services console. This can keep a handle to the old service and stop it from being deleted.

5. Start the new service.

net start svnrepos


6. Check it works.

svn info svn://localhost

No comments: