Quickly Installing Subversion

9 02 2008

OK. So for most of you this is old hat. But still. I ran into some caveats, and wanna make this super simple.

Installing SVN on Win XP.

To start off, I want SVN as a service. Second, I want to use Tortise SVN as my client.

  1. Download SVN binaries for windows. Currently it is v1.4.5
  2. Install. This will automatically add the subversion binaries to your PATH.
  3. Add a new Environment Variable under System Variables (My Computer > Properties > Advanced > Environment Variables) called SVN_EDITOR and it is a path to some generic text editor (eg. c:\windows\notepad.exe)
  4. Create your repository in Command Prompt by this command (replacing the location with whatever you want)
    svnadmin create "c:\Justin\Subversion Repository"
  5. Goto that folder and edit the /conf/svnserve.conf file. You want to uncomment the following: (Note: no spaces before the entries)
    [general]
    anon-access = read
    auth-access = write
    password-db = passwd
  6. Open the password conf file /conf/passwd and add a user/password in the format [users]
    user = password
  7. Start the SVN server in a Command Prompt to test it
    svnserve --daemon --root "C:\Justin\Subversion Repository"
  8. This will stay open. So, open another Command Prompt window , and make a project in subversion
    svn mkdir svn://localhost/myproject
  9. Now Notepad will start asking for a commit comment. Add whatever you want before the comment line (the one starting with “– This line …”), save and exit.
  10. Your command prompt will prompt you (it does that) for a user/pass. Funny that. Enter those from before.
  11. Now if you don’t want SVN as a service, and would rather start it up manually via the daemon command in Step 7, then you can skip this step. Otherwise, you’ll want to use this command in a prompt (after closing the currently running daemon prompt from Step 7)
    sc create "Subversion Service" binpath= "\"c:\program files\subversion\bin\svnserve.exe\" --service --root \"c:\justin\subversion repository\" " displayname= "Subversion Repository" depend= Tcpip start= auto
    You’ll note that you can remove the start= auto command if you want the service start as manual (read Reference 2 below for more info)
  12. Now, if you’d rather not use the command-line and notepad to do your commits, download and install TortiseSVN. Apparently don’t need to restart your system. I’m not sure myself. TortisSVN client is accessed by right-clicking files in Windows Explorer.
  13. If you’re like me, you’ve already got code to enter into Subversion. So what I do, is to Import the code (right click the folder you want to import, goto TortiseSVN and then import). You enter the URL of your repository as svn://localhost/myproject or whatever project you want really. Note: If installing SVN onto a server, just use that IP instead of localhost, though you’ll need to modify firewall settings on that machine to allow SVN access. (TCP port 3690 i believe)
  14. Then you need to check this folder out to some location. Either start in another fresh place, or delete your source files from their original location, and check out back into that folder. Yes, I said you can delete your source files (cause they are now stored in SVN) – though I’d bacup first obviously. To checkout, you’ll see the option in the direct right-click menu.
  15. Personally, at this point, I’d prefer to browse my repository, keeping only the files within that project that i need (for example, removing any unnecessary .NET files, like app_offline.htm, etc).
  16. Booyah. You’re done. When you start the day, you’ll likely Update your checkout location with the most recent files (obviously if others are working on your files).
  17. I’ll update this with an option to deploy to a network soon. (essentially it involves how you create the service
  18. The usual deal – use Update to update your source files with any changes in the repository (when working on the project with others). Use Commit to commit your changes to the repository. If anyone else made changes since your last update, you’ll get the differences window and have to decide on a course of action…
  19. Good luck.

References:

  1. Team System : Setting up SVN
  2. Subversion docs: Windows Service
Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: