Once in a while I take over a software development project that is not using source code control. If I expect to make a lot of changes I usually set up source code control before I start so that I can easily revert changes I made if I need to. I don’t do this often, so I’m documenting the steps for a quick installation of subversion with minimal source control features for my own future reference.
I felt the urge to write this post for two reasons:
- To easily find the correct URLs to use to download the software
- To provide simple documentation for a simple installation. There is a lot of good extensive documentation explaining all the options, but I don’t care about most the options. I just wanted the basic installation so that I can get to work. And here it is.
Downloading and Installing the Version Control Software
A Google search for subversion will almost certainly take you to the old web site for subversion. So skip it. Download subversion from here: http://www.visualsvn.com/downloads/ The first link is probably Apache Subversion Command Line tools, version 1.7.8 and about 2MB. That is the one you want. Ignore the misleading fact that it is has Apache in its name. As a windows developer, that information is irrelevant, and frankly, misleading. Download the file and unzip it to c:\program files\subversion.
Subversion does not include a user interface. Everything is done from a command line. So let’s get a user interface for subversion so that we can avoid hours making typos at the command line. The challenge is to download TortoiseSVN without downloading the other crap put in front of you on the web pages. This is not easy because huge download buttons will be placed in front of you on most the pages they force you to navigate through and they all download crapware. So avoid the tortoiseSVN site and go straight here http://sourceforge.net/projects/tortoisesvn/files/latest/download. This will download either the 64bit or 32bit version based on the OS you are running your browser. Download it, then run the installer exe. Take the defaults.
Creating a Repository to Store the “Master” copy of your software.
Now for the hard parts. Subversion uses poor terminology, in my opinion, for the actions you need to take to get started. Conceptually, we want to do the following:
- Create a place on the computer to store the “Master Copy” of our source code, called the repository.
- Upload our existing source code into the repository
- Flag the working directory of our source code as a working directory for that repository.
- Make a change, test that subversion recognizes the change.
I recommend you back up your source code root folder to a backup folder at this time.
Create a folder on your computer to contain the Repository. This is not going to contain the “working copy” of your code, it will contain the “Master” copy. I recommend something like c:\SVNRepository.
- Right click on the folder you just created. The TortoiseSVN tools should provide you an option to “TortoiseSVN\Create repository here”
- Do NOT click Create Folder Structure, just click OK.
- Now go to the root folder that holds your source code (let’s assume it is c:\DevSource). Right-click, choose “TortoiseSVN\Import”
- Now, to designate the location you imported from as the working copy of your project, right click on the folder you imported from again, and select SVN Checkout
- Careful – the “URL of repository” should be the full path to c:\svnrepository
- You may need to change the defaulted value for Checkout directory because the UI may add svnrepository at the end of the path name. Take that off. The checkout directory should be the root level of your project folder (c:\DevSource)
- It will warn you that the folder is not empty. This is good – you are going to overwrite your existing project files with the files you imported into the repository.
- If you did this correctly, all your files will still contain their original date/times.
- If you did this correctly, and you right click on your project root folder, you will have two new options above TortoiseSVN on your menu, SVN Update and SVN Commit:
If you had any trouble, delete SVNRepository, copy the backup you made of your source files back into your project folder, and try again.