Tag Archive for 'intro'

How to Perform a Detailed Checkout With SmartSVN

In our previous post, we covered performing a simple checkout with SmartSVN, using the ‘Quick Checkout’ option. In this installment, we introduce you to ‘Detailed Checkout,’ which allows you to specify which folders should be included in the working copy.

Not yet tried SmartSVN? You can download it for free!

1) Open your SmartSVN installation and select ‘Check Out…’ from the ‘Project’ menu.

 

 

 

 

 

 

 

 

 

 

2) Ensure the ‘Detailed Checkout’ option is selected, and enter the repository URL. Select ‘Next.’

 

 

 

 

 

 

 

3) Choose which folder you wish to checkout.

 

 

 

 

 

 

 

Tip. SmartSVN will automatically display the HEAD revision. However, you can use the ‘Show Revision…’ button to select revisions other than the HEAD.

 

 

 

 

4) Enter the location where you wish to create your working copy and click ‘Next.’

 

 

 

 

 

 

 

5) Specify whether to checkout a working copy, or export files. Click ‘Next.’

 

 

 

 

 

 

 

6) Review the summary and, if you are happy with the output click ‘Finish.’

 

 

 

 

 

 

 

7) You have successfully completed your checkout, and are ready to begin working on your project!

 

 

 

 

 

 

Get started with SmartSVN today! Visit the WANdisco website to download SmartSVN Foundation. Remember that you can evaluate SmartSVN Professional by choosing the evaluate option during the install process.

 

Intro to Pre-Commit Hook Scripts

Hook scripts are executable programs that Apache Subversion users can configure to be triggered by a specific repository event.

When you install Subversion, a ‘hook’ directory is created automatically that contains templates of all the available hook scripts. These .tmpl files contain info about that particular hook script, alongside details on the data that’s passed from Subversion when the hook script is executed.

One hook script is the pre-commit hook script, which executes when a commit transaction happens, but before any changes are applied to the repository. With pre-commit hook scripts, Subversion passes two pieces of information to the hook script: the name of the repository and a uniquely generated name or code for the transaction being committed.

A Basic Pre-Commit Hook Script

Hook scripts work by either exiting with a ‘0,’ which allows the transaction to happen, or by exiting with a ‘1’ which blocks all commits. In this basic example, we’ll show how the ‘exit 1’ command can be used to prevent all transactions.

Locate the pre-commit hook script in the hook directory.

Open the file and replace the text with:

exit 1

This will block all commits, from all users. When you try and commit, you should see a similar message to the one below:

Need more info?

A free replay of our ‘All About Hook Scripts’ webinar is available now. This webinar offers further examples of hook scripts, including start-commit, pre-revproper-change, and pre- and post-lock hook scripts.

Introduction to Apache Subversion

What is Apache Subversion?

Subversion is an Apache-licensed, open source software versioning and version control system that can track changes to files, folders and directories. It can also be used to recover previous versions of data, and examine the history of how a particular dataset has changed. Subversion can operate across networks, encouraging collaboration by allowing team members at various locations to work on the same set of data. Subversion can be used to manage any collection of files – web pages, binaries, documentation – not just source code!

Downloading and Installing Apache Subversion

Certified open source Apache Subversion binaries are available to download from http://www.wandisco.com/subversion/download

To install, open the file to launch the setup wizard and follow the onscreen instructions to define which components you wish to install, and the install location. Enter the name of your server, the host port, and define the repository and repository location prefix – and hit install.

Alternatively, uberSVN makes Subversion easy and intuitive to use, and is free to download and free to use.

Creating your first repository

Once Subversion is installed, the first thing you need to do is create a repository. To create your first repository, open the command line, change the current directory to where you want to create your repository, and run the ‘svnadmin’ command:

svnadmin create {directory name}

Checking out a Project

To start working on your project, you must check out a working copy of the repository. This is achieved with the ‘checkout’ command:

svn checkout file {file location}

Commit Your Changes

Once you’ve made some changes to your working copy, you’ll want to push your changes to the server. Perform an “svn update” and an “svn diff” to test your changes, and resolve any warnings raised by Subversion, before committing. Once you’ve finished checking your modifications, and are ready to store the new revision in the repository, run the ‘commit’ command:

svn commit {path}

Get other people’s changes

When someone else performs a commit to the repository, you’ll need to pull those changes into your working copy, to ensure the latest trunk changes are compatible with what you’re doing in your working copy. Changes can be pulled into your working copy with the update command:

svn update {file name}
or
svn update {directory name}

Adding Files to a Project

Now you know how to checkout a working copy and commit changes back to the repository – but as you continue to develop your working copy, you may wish to add some new files to your project. When adding new files to Subversion, you need to tell the Subversion server about the files with the following command:

svn add {file name}
or
svn add {directory name}

Note that the new files won’t appear in the repository until you perform an ‘svn commit’ and send them to the repository.

Deleting Files from a Project

If at some point you want to remove these files from Subversion, run the delete command:

svn delete {file name}
or
svn delete {directory name}

Again, you must perform a commit before the file is deleted from the repository. You can also run ‘svn list’ to confirm that the file was successfully deleted from the repository.

And if you get stuck…..

The ‘svn –help’ function provides a summary of available commands or, for more information on a particular command, use:

svn help {command}

Other useful commands

  • svn status {path} – prints the status of working copy files and directories.
  • svn diff – display the differences between two revisions.
  • svn merge – applies the differences between two sources to a working copy path.
  • svn move SRC DST – think of this as ‘svn copy’ that automatically deletes the source file. This command moves a file or directory in your working copy, or in the repository. Note that Subversion does not support cross-repository moving, so it is impossible to move files across repositories with this command.
  • svn list – allows you to view the content of the Subversion repository, without having to download a working copy.
  • svn log – Subversion remembers every change made to your files and directories. This command displays the commit log messages. By default, it will show the information for the current working directory of your working copy. Alternatively, different paths can be specified.

Need more info?

On June 14th, 2012 we will be hosting a free ‘Introduction to Subversion’ webinar. This course is intended as a primer for new users or people who are thinking of making the jump to Subversion, and will cover the following topics:

  • Repository basics – creating and organizing
  • Checkouts, working folders, editing files and checkins
  • Reporting on changes
  • Simple branching
  • Simple merging

This webinar is free to attend, but places are limited so register now to avoid disappointment.