Monday, March 02, 2009

Using TortoiseSVN

Using TortoiseSVN

(Mar 2, 2009)

Although GUI of TortoiseSVN is very good, it may not be intuitive for some people.  Here, I discussed some aspects of TortoiseSVN that may be important to a beginner in a version control system.

  1. Repository and working files (files we are working with) are stored in different places.  This aspect will be obvious if we are working on other version control systems, such as MS SourceSafe, because server and client interfaces are separated in the first place.  In that case, we have to set up a server and then use a client interface to connect to the server.

    For TortoiseSVN, however, this may be a bit confusing since TortoiseSVN can act as both server and client at the same time and on the same machine . A place to store a repository and working files seem to be just a folder.  Nonetheless, the behavior of server-client is still preserved and the repository and working files must be in different places.

  2. TortoiseSVN integrates itself to a Windows Explorer.  There is nothing to call from Windows' start menu.  Its behavior is changed according to the items we are interacting with.  For example, if we right click in an empty area in a folder, its menu will allow us to 'Create repository here'.  If we click on a checked out file, its menu will allow us to update from or commit to a repository.

  3. Don't try to add files by going to a working folder.  This must be done in a repository folder.  Basically, a brand new file is not associated with any repositories.  TortoiseSVN will not know where the new file should go.  Thus, we have to call a repository first.  This can be done by going to a repository folder, right click on an empty space, choose 'TortoiseSVN=>Repo-browser'.  When we arrive there, right click on the file pane and choose 'Add file...'. Notice that TortoiseSVN is very obsessed with right clicking on something.

  4. Although a file is added, it remains a normal file in a normal folder.  TortoiseSVN does not associate any version-control features to the file directly. 

  5. Version-control features will be available to working folders only.  In addition, working folders can be created by checking out things from a repository.  Note that pre-existing files in the folder may be perished.  Make sure you copy the files to somewhere else before doing so.  Alternatively, just check out items to another folder, preferably a brand-new one.

  6. We use a version-control system because we want to track change and revert to previous files, if needed.  For TortoiseSVN, reverting can be done at a working folder, not a repository.  This makes sense because a single repository may be checked out to many places.  Going to the repository will give TortoiseSVN no information about a target place.  Note that reverting to a single target is reasonable.  Why?  This is because it is normal that we want to check if reverting will fix an issue.  If so, we can commit the reverted file to a repository again with some check-in note.

    To execute version reverting, go to a target item, right click on it, and choose 'TortoiseSVN=>Show log'.  Then find a desired revision in a log, right click on the revision, and choose 'Revert to this revision'.

  7. A checked out folder is equipped with version-control features.  When we create a new file in the folder, it will mark with '?' on its icon to indicate that it is not a repository.  If it is not supposed to be in a repository, you can tell TortoiseSVN to ignore it.  Otherwise, you can add it to the repository.  This time, we can do it directly by right clicking on the file and choose an appropriate command.  ( Now, you see that TortoiseSVN is 'right-clicking oriented', right? :P )

This document can be view in my blog or Google docs.
(Use my blog to comment and Google docs for printing)

1 comment:

Hari said...

Very useful.