A short introduction to Subversion on Windows
To use Subversion under Windows I recommend using the TortoiseSVN Plugin for the Windows Explorer.
Getting started
After you have successfully downloaded and installed TortoiseSVN you can checkout any repository you like:
Simply open the Windows Explorer and change to the directory you want to checkout to. A right click shows the usual menu with two new items added to it. Now click on "SVN Checkout". A popup windows will appear asking you for the URL of the repository. Enter the URL of the repository (e.g. " http://openvcp.org/svn/trunk") and press enter.
TortoiseSVN supports all protocols supported by SVN:
- http://
- https://
- svn://
- svn+ssh://
- file:///
- svn+XXX://
TortoiseSVN will now checkout all files from the given repository and save them to the current directory.
Now, you're set up to work with your local copy of the repository. You can edit files with your favorite editor, just as you would edit any other files. The current SVN status of any file will be displayed in the lower left hand corner of the file's icon. I think this is pretty self-explanatory.
To commit changes to the remote repository, right click on the file (or directory) you want to commit and select "SVN Commit...". You will be asked for a commit log message. Please describe in some short but precise sentences what you have changed. (As a sidenote: Something like "some bug fixes" or "made it work" or the like is not very helpfull and should be avoided.)
The TortoiseSVN submenu (in the context menu) provides access to all SVN commands. In the following sections I will shortly describe the most important commands as they are used on the command line. Most of them should be named the same in TortoiseSVN.
SVN repository layout
Usually, a subversion repository has the following layout:
/branches/ /tags/ /trunk/
trunk is where the current development is going on - this is usually the bleeding edge of a project. The branches directory is used to keep branches. Branches might be used for experimental development (which will be merged back to trunk later, when it has reached a somewhat stable state) or to keep track of older releases and be able to still provide security updates for those releases. tags are a kind of snapshots. They are usually used to "tag" an actual release. By convention, tags are read-only. However, subversion does not enforce this, thus any developer should stick with this simple rule.
After some development cycles and a couple of releases a repository might look like this:
/branches/highly_experimental_stuff/
special_idea_bar/
special_idea_foo/
v_0.1/
v_0.2/
/tags/v_0.1.0/
v_0.1.1/
v_0.2.0/
/trunk/
The most important SVN commands
checkout
svn co http://openvcp.org/svn
Checks out the given repository. Usually, you only need to checkout trunk.
You may give an additional optional argument indicating a directory name to checkout to.
svn co http://openvcp.org/svn/trunk openvcp
Everything in trunk will now be in the directory openvcp.
update
svn up
Updates the working copy by pulling changes from the repository. This should be done before doing any changes on the local sources to avoid conflicts.
commit
svn commit
Sends all local changes to the repository. As mentioned before a descriptive log message should be attached to it. Frequent commits might decrease the possibilty of conflicts and makes it easier to roll back changes.
add
svn add <filename>
Puts files under version control. They will be added to the repository upon the next commit. If you do not explicitly add new files, subversion will ignore them on any commit.
remove
svn rm <filename>
Removes files from version control. They will be removed from the repository upon the next commit.
copy
svn cp <source> <destination>
Copies a file in the repository. Subversion "remembers" the history of that file. This is also used to create new branches and tags.
svn cp trunk branches/v_0.3
svn cp branches/v_0.3 tags/v_0.3.4
move
svn mv <source> <destination>
Moves a file in the repository. Subversion "remembers" the history of that file.
status
svn status
Shows the status of every file in the current directory.
diff
svn diff
Shows the diffs between the local version and the repository. It ignores files that are not under version control.
log
svn log
Shows the commit messages for all revisions affecting the current directory.
More documentation
This is just a really short introduction to SVN. You should read the svn book some day and especially the chapter about resolving conflicts.
TortoiseSVN screenshots
http://tokkee.org/howtos/images/svn01.jpg
http://tokkee.org/howtos/images/svn02.jpg
http://tokkee.org/howtos/images/svn03.jpg
