Adam Howitt's Blog

Sep 26
2008

Steps to setup Subversion 1.5.2 on a Windows Server

I've install Subversion on several windows machines lately and after repeatedly having to re-research how to do it by scanning through my Google Bookmarks and History, I've decided to save it somewhere I'll remember to look! Your mileage may vary depending on your environment but this works for me:

Install SVN
  1. Download and run binaries MDI for 1.5.2
  2. Edit environment variables to add svn_editor to point at your choice. Mine was
    "c:\program files\Notepad++\Notepad++.exe"

Create a Repo

  1. svnadmin create "c:\repos\mynewrepo" cd c:\repos\mynewrepo\conf
  2. edit svnserve.conf
    • set realm=myrealm where myrealm is distinct for the repo you are creating
    • set anon-access=none and uncomment this line
    • set auth-access=read and uncomment
    • set password-db=passwd and uncomment
  3. edit passwd file
    • remove the default users
    • add users in the format uname = password one per line
  4. test the repo is working (optional)
    • in one command prompt window type
      svnserve --daemon --root "c:\repos\mynewrepo"
    • in another command prompt window type
      svn mkdir svn://localhost/myproject
    • your svn_editor of choice should open so add a comment at the top and close it
    • in the command prompt window it should ask you to authenticate
    • it defaults to the current logged in username so unless you created that user hit return to skip
    • enter the username of a user you added in the passwd file
    • enter the password
    • you should see "committed revision 1"
Setup SVN as a service
  1. Open command prompt and type:
    sc create ecoscenesvn binpath= "c:\Program Files\Subversion\bin\svnserve.exe --service --root c:\repos\mynewrepo --listen-port myPort" displayname= "SVN Reponame" depend= Tcpip
    Note:myport helps you differentiate between the ports to use for different repos
  2. Go to services panel and start the service
  3. Open a command prompt
  4. Go to a directory to perform a test checkout
  5. svn checkout svn://localhost:81/myproject
    (if you created a myproject in the test and you used port 81 as the listen-port)
  6. You should see "checked out revision 1"

Note: you can also test this with tortoisesvn by using the repo browser by pointing it at the URL svn://hostnameorip:81/ where hostnameorip is your server hostname or an IP address and port 81 was the listen port

Sep 15
2008

svn:ignore problem with robots.txt / files

I've been using subversion for some time now and have had a nagging problem of subversion not acknowledging my svn:ignore list.  Until now, it wasn't a big enough issue to invest the time but since I'm working on a remote team project and the file in question was robots.txt it suddenly became a big priority.

I found several blog entries about how to ignore folders and files but my robots.txt was still listed as modified instead of ignored when I ran

svn status --no-ignore

 

A more careful review of the documentation revealed that I had missed the highlighted text after the sixth paragraph:

"Subversion's support for ignorable file patterns extends only to the one-time process of adding unversioned files and directories to version control. Once an object is under Subversion's control, the ignore pattern mechanisms no longer apply to it. In other words, don't expect Subversion to avoid committing changes you've made to a versioned file simply because that file's name matches an ignore pattern—Subversion always notices all of its versioned objects."

So there you have it.  Put another way, once you add a file to subversion, it won't be ignored until you delete it from the repository.

The fix for robots.txt was to

  1. Copy the local file content to the clipboard,
  2. Run an update on my local copy to delete the file 
  3. Recreate the file and paste in the clipboard contents
  4. Test using a commit in Tortoise to make sure it didn't include the new file