Tortoise SVN Client and Server.

If you’ve heard of version control and either CVS or Microsoft’s Visual Source Safe (VSS),  you’ll appreciate Subversion right away. If you haven’t and you’re doing any creative work on your computer you might want to find out. CVS was the old standard . It’s still decent and a much better deal than VSS which costs $549 (standard edition).

To be fair, I’ve used VSS in the past and it did a decent job of version control. The older version I used had drawbacks such as all or nothing file checkouts. The new version, according to the product description, has corrected this. But I haven’t tested it so, other than the price, I don’t want to compare it to Subversion. There are Macintosh and Linux subversion clients as well but I haven’t looked at them yet.

I’ll give you a short background, tell you where to get it, present a quick how-to and narrate a practical example I had. .

You can download subversion from tortoiseSVN.tigris.org or sourceforge. It’s free.

Background from Wikipedia

TortoiseSVN is a Subversion client, implemented as a Windows shell extension. It is free software released under the GNU General Public License. TortoiseSVN won the SourceForge.net 2007 Community Choice Award for Best Tool or Utility for Developers

    • Windows Shell (Explorer) integration.
    • Can be used without an Integrated Development Environment.
    • Icon overlays show immediately which files/folders need to be uploaded (committed) to the database/repository.
    • Supports diff/merge of office documents such as Microsoft Word

    Background from Tigris.org:

    The goal of the Subversion project is to build a version control system that is a compelling replacement for CVS in the open source community. The software is released under an Apache/BSD-style open source license.

    A Subversion client, implemented as a windows shell extension.

    TortoiseSVN is a really easy to use Revision control / version control / source control software for Windows. Since it's not an integration for a specific IDE you can use it with whatever development tools you like. TortoiseSVN is free to use. You don't need to get a loan or pay a full years salary to use it.

    * Easy to use
     - all commands are available directly from the windows explorer.
     - only commands that make sense for the selected file/folder are shown.
    * See the status of your files directly in the Windows explorer
    descriptive dialogs, constantly improved due to user feedback
    * Allows moving files by right-dragging them in the windows explorer
    * All Subversion protocols are supported http:// , https:// , svn:// . svn+ssh:// , file:/// , svn+XXX://
    * Powerful commit dialog
    * The big picture
    * Can create a graph of all revisions/commits.
    * Graphs of commit statistics of the project
    * Easy comparing of two branches or tags
    * Per project settings
    * TortoiseSVN provides a flexible mechanism to integrate any web based bug tracking system.
    * Helpful Tools
    * TortoiseMerge
    * Shows changes you made to your files
    * Helps resolving conflicts
    * Can apply patch files you got from users without commit access to your repository
    * TortoiseBlame: to show blames of files.
    * TortoiseIDiff: to see the changes you made to your image files
    * TortoiseSVN is stable
    * Support
    * Extensive and descriptive documentation

    System Requirements
    Win2k SP4, WinXP or later
    IE5.5 or later
    Windows Installer version 3.1 or later
    Source code


    The Tortoise SVN client runs in Windows and is actually a stand alone desktop server as well as a client. You can install it  on your PC  with very little setup and use it right away. The server runs in Apache or as SVN on Linux.

    I’ve got an  SVN server running on my Ubuntu 6  workstation but other than configuring, haven’t used it yet. My main use has been the standalone client/server on PC’s for developing PHP and Ruby applications. So that’s what I’m going to talk about.

    I first set up TortoiseSVN  on my Windows XP desktop for a PHP project I was starting. There were several copies of the source code and some question about which was the most current. Date/time didn’t work because they had been copied destroying the original create date and some work was done in parallel. Running file by file, Winmerge (also worth knowing about: winmerge.org) was too slow and there were maybe 500 programs to check. I needed to be able to see many files at once, selecting only those with differences. Subversion seemed to fit the bill but you’re never sure about trying new technology when you’re on the spot. It can be an embarrassing time killer. I was forced to try. It worked!

    The Windows setup was uneventful. The only problem was a little performance hit. Because it’s a Windows shell extension that monitors all your file events and right mouse clicks it was a little performance hit. This wasn’t noticeable on my fast workstation but on another PC ( 1.8 MHz speed processor /756M ram )  performance was less, but it worked and was worth it for the benefit. (Considering this and Visual Studio 2005’s sluggishness I’m beginning to think Dual processor/3Mhz/2Gig is the minimum size for development. Zend developer works decently though. This is another story.)

    Here’s a step by step tutorial on how to use it: ( Installing it is step #0 !)

    1. Create a folder named MyRepo in a work area (inside the project folder)
    2. Right click on it and in the context menu (created by setup – in practical terminology, that’s what Windows shell integration means) select TortoiseSVN -> Create Repository Here. It asks “Native File” System of “Berkley” (whatever that is). Choose “native” and in a second it reports “repository successfully created”. Inside the new repository are a few meaningless files and subfolders. Don’t touch. You don’t do anything in this folder.
    3. Right click on the first project folder (for the example MyProject1)  and select TortoiseSVN -> Import. You’ll see the name file:/// ….MyRepo.   (At this point if you had a remote server based setup, instead you’d enter a http:, https:, svn: etc. type of address.) Another OK at the end. .
    4. Now that MyProject1 is in the repository, the original is not needed. After you’re sure everything works, delete it or rename it.. Then create a new folder named MyProject1Working. You can not just click on a MyProject1 and say put this under version control.
    5. Right click on MyProject1Working and select SVNCheckout. If you haven’t done anything else the dialog will be filled in with the names file:///... MyRepo you just created and the Checkout Directory …\MyProject1Working.
    6. Select OK. If you’ve chosen a full directory it will warn you of overwriting , the initial Working folder should be empty. The original MyProject1 files will be copied here from the repository. And now they’ll all have a green checkmark on them. It means there have been no changes yet. (Figure 1)
    7. Change one of the files, close it and take a look in Explorer. It now has a red explanation mark. (Figure 2)
    8. Right click on the changed file TortoiseSVN -> DIFF and you see a nice side by side comparison of the original file and changed files. (Figure 3)
    9. You can, optionally select TortoiseSVN -> Export to into another empty folder to make a copy without the .svn configuration files it puts in each controlled directory.
    10. You can remove a directory from version control by searching for all files names “.svn” and deleting them, then deleting the repository. To delete individual files under control, do not delete them using explorer. Use TortoiseSVN -> delete so it knows about it.
    11. As long as you haven’t deleted the repository you can always check out a whole new working copy.
    12.  To turn the icon green again you can either revert get the original back form the archive or commit-assume the current is newest, register the fact. You can revert from any version you’ve got.

    Version numbers are automatically generated and you can go back to the very beginning. There is also provision for multiple users and security but this is another topic. It’s a sophisticated and complete system. I’m leaving a lot out.

    To solve my problem, I created a repository and working directory, MyProject1Working, for the client’s folder out of what I guessed was newest. After the checkout all files had the green check. Next, using explorer I copied the contents of  the client’s  other directory (MyProject2) over top of first MyProject1Working. (Important. MyProject2  had no existing .SVN files in it.).

    Like magic, all of the differing files and folders containing them had red explanation marks. All I had to do was right click TortoiseSVN -> DIFF over any red! and there were the differences. I found about 30 differences including the config which was set with some other  database connection strings. If the newer code was in MyProject2  I’d SVNCommi, MyProject1Working TortoiseSVN->Revert. I could also merge individual blocks of code, selecting from MyProject1Working or MyProject2 text. It was very fast and I was 100% sure I had the correct code.

    SVN works with Word 2003 Documents and a variety of other formats too. Pictures even work. DIFF shows changed photos side by side – but of course unlike lines of test so code you couldn’t merge them.

    I think it’s indispensable for any creative project with more than a dozen files or two or people. Are you using it? Are you still on CVS, or do you have the Microsoft money for VSS. Is it worth it? I think there’s something in Microsoft Team too but this is very expensive, are you using this? Nothing? Why?

    If you  want to learn more, need help or share your experience come to one of my SIGS; Open Source applications for more on it’s use or Linux for setting up the server. You can also email or get me at the general meeting or Pig SIG.

    Figure 1. Filling the working directory

    A. Before checkout:

    B. Checkout dialog:

    C. After checkout: Note MyProject1Working is full and has (green) checks. MyProject1 can be deleted/archived.

    Figure 2. After changing a file. Imagine this with hundreds of files.

    Figure 3 DIFF Note menu shows the change, allows merging.

     



DacsGear!
Mugs and more, visit CafePress to order
 
 
© Danbury Area Computer Society, Inc. All Rights Reserved.
Web Site Terms & Conditions of Use