I decided (finally!) to migrate my version control system from CVS to Subversion so that I could have atomic transactions when committing multiple files. There's plenty of tutorials on using and setting up Subversion on the net, so here's the simplest way to get started on Windows …
- Install and run Subversion on Windows
- Create a repository.
- Import a project into the repository.
- Check-out a project from the repository.
Install and run Subversion on Windows
- Install TortoiseSVN Subversion GUI client.
- Install CollabNet Subversion Server and Client:
- I chose the svnserve option, otherwise by default the installer will also install the Apache web server and I already had Apache installed.
- The installer will create a Windows service using svnserve. While it is possible to use the file protocol for personal development (since there's only one developer, yourself), it's likely that I'd use Subversion in a team, so I decided I might as well get used to the svn protocol and have a server manage my repository.
Create a repository.
- Open a command prompt and create a repository with this command: svnadmin create <repository path>.
- Note that the installer should have added the Subversion bin folder to your PATH environment variable.
- Note 2: I think I'm missing a step: How does svnserve map svn://localhost to the repository path?
- Edit <repository path>\conf\svnserve.conf and uncomment the following lines:
- password-db = passwd
- realm = My First Repository
- Edit <repository path>\conf\passwd file and either uncomment one of the sample user and password pairs, or add a new pair. You could have anonymous read and write operations, but again, since I was likely to use it in a team, I might as well create a username-password pair.
- Open the Windows services console and start the CollabNet Subversion svnserve service if it is not already running.
- Check that TortoiseSVN can connect to your Subversion server.
- Open Windows Explorer
- Highlight an arbitrary file or folder and select the context menu item TortoiseSVN/repo-browser.
- When TortoiseSVN prompts you for a URL, enter svn://localhost (the address of your local Subversion server) and press the OK button.
- TortoiseSVN should display its Repository Browser window. If the svnserve service isn't running, you would get this message:
Can't connect to host 'localhost': No connection could be made because the target machine actively refused it.
If you get this message, check that the service is running in the Windows Services console. - Leave the Repository Browser window open because you can use it to check that you have imported your projects successfully.
Import a project into the repository
- Copy or rename an existing project folder to something like <project>_import.
- In Explorer, select that folder and use the context menu item TortoiseSVN/Import....
- TortoiseSVN displays the Import dialog.
- In the URL of Repository field, enter svn://localhost/<project>.
- In the Import Message field, enter Importing <project>.
- Press the OK button.
- Since this is the first time you've used TortoiseSVN to import a project, you'll be prompted to enter a username and password. Optionally, select the Save authentication checkbox so that TortoiseSVN remembers your credentials. When you are satisfied, press the OK button to submit your credentials.
- Check that your project has been imported successfully using the TortoiseSVN's Repository Browser. You may have to press F5 to refresh the list of folders in the repository.
Check-out a project from the repository
- In Windows Explorer, highlight the folder to store your project and select the context menu item SVN Checkout....
- TortoiseSVN should display the Checkout dialog, with ...
- URL of Repository = svn://localhost/<project>
- Checkout directory = <path of project>
- Press the OK button and your project should be checked out to the target folder.
- Refresh the Windows Explorer window and you should see a green tick overlaid on the <project>'s folder icon. This shows that TortoiseSVN recognises this folder as a Subversion folder.
Final words
That's pretty much all the steps required to set up a basic Subversion system for personal development on Windows.
See Also
- svnserve, a Custom Server chapter from Version Control with Subversion
No comments:
Post a Comment