Tag Archive for 'revision'

Subversion Tip of the Week

Updating to a Particular Revision From the Command Line

When updating your working copy in Apache Subversion, you usually run the ‘SVN Update’ command and update to the HEAD revision. However, in some instances you may need to update your working copy to a particular revision – or even revert to a previous revision. This is achieved by running the ‘SVN Update’ command and specifying your target revision with the -r command:

svn update -r revision-number

You working copy will now be at the specified revision! In addition, there are several commands that you may find useful when targeting a particular, non-HEAD revision:

1) Find out which revision you’re currently at:

svn log -q -r BASE

2) Find out which revision is the HEAD:

svn log -q -r HEAD

3) See what’s changed between your working copy revision and HEAD:

svn log -r BASE:HEAD

Exploring SVN Properties: MIME-Type and Keyword Substitution

‘Properties’ in Apache Subversion are a valuable way of associating metadata with versioned files or directories. In this SmartSVN tutorial, we’ll explore some of the Subversion internal properties in greater detail, before showing you how to remove a property.


The ‘svn:mime-type’ property indicates a file’s MIME type and allows the client to decide if contextual merging is safe during updates. SmartSVN automatically determines the coarse MIME-type of a new file, but in certain cases you may want to change SmartSVN’s assignment using the svn-mime-type property.

To set the MIME type property in SmartSVN:

1) Right-click the file where the svn:mime-type property will be set, and select ‘MIME-Type..’ from the ‘Properties’ menu.

2) In the subsequent ‘Change MIME-Type’ dialog, you can choose from the defaults ‘Text’ or ‘Binary’ type. Alternatively, define a ‘Custom’ type by explicitly specifying the corresponding MIME-type, for example image/jpeg, application/pdf etc.

3) By default, SmartSVN checks whether MIME-Types are well-formed, and not arbitrary strings. If you want to disable this check, select the ‘Force’ option.

4) Select ‘OK’ to go ahead and apply this new property.

Keyword Substitution

Subversion has the ability to substitute ‘keywords’ into the contents of a file itself. These keywords are useful for automatically maintaining information (such as author, revision number, etc.) that would be too time-consuming to update manually.

Note, the Keyword Substitution property can only be applied to text files.

1) To activate keyword substitution, right-click on the file in question and select ‘Keyword Substitution…’ from the ‘Properties’ menu.

2) In the ‘Change Keyword Substitution’ dialog, choose from a list of supported keywords:

Author – the username of the person who created the revision.
Date –
the UTC the revision was created (note, this is based on the server’s clock not the client’s.)
Revision –
describes the last revision in which the selected file was changed in the repository.
ID –
a compressed combination of the keywords ‘Author,’ ‘Date’ and ‘Revision.’  
a link to the latest version of the file in the repository.
Header –
similar to ‘ID,’ this is a compressed combination of the other keywords, plus the URL information.

You can choose to ‘Unset’ or ‘Set’ each keyword. The ‘Don’t Change’ option maintains the current substitution from the keyword.

Deleting a Property 

Once you start working with Properties in Subversion, sooner or later you will need to remove properties. To set or delete a property to multiple files or directories:

1) Open the ‘Properties’ menu and select ‘Set or Delete Property.’

2) Open the ‘Property’ drop down menu to see the available Subversion internal properties.

3) Select the Property you wish to remove. In this example, we’ll remove all explicit mergeinfo from our project. To achieve this, select ‘svnmergeinfo’ and select the ‘Delete Property’ checkbox.

Select ‘OK’ to remove the mergeinfo.

Remember, you can download your free edition of SmartSVN Foundation at http://smartsvn.com/

Exploring the Log Menu in SmartSVN

SmartSVN’s ‘Log’ option allows Apache Subversion users to view the change history of a specified file/directory, through a powerful Log Menu. In this post, we’ll show you how to access the Log Menu, and explore some of the additional options available through this menu.

To access the Log Menu:

1) Select the file/directory you wish to view the change history for and click the ‘Log’ button (alternatively, open the ‘Query’ menu and select ‘Log…’)





2) In the ‘Show directory log’ dialog, select the time period you wish to review. In this example, we’ll set SmartSVN to review ‘the Last 2 weeks.’ Click ‘Ok.’











Tip. Select the ‘Stop logging on copied locations’ checkbox to prevent SmartSVN from tracking further changes when it encounters a revision where the file/directory has been copied from another location.

3) The Log window will open automatically. This screen consists of several different sections:

  • Revisions table – displays the different revisions and their attributes, including the log message.
  • Revision Info – select a particular revision to see all the information about this revision in the Revision Info pane.
  • Search Author and Commit Message – allows you to filter out certain revisions.
  • Directories – displays the Directories/Files view for the selected revision.







Log Menu Options

There are some additional options available from this dialog:

1) ‘Show More…’ – accessed by selecting the ‘Log’ menu. This option allows you to extend the displayed log range.






In the ‘Show More’ dialog, you can increase the number of displayed revisions (for example, by increasing the date range, or requesting to see the ‘previous X revisions.’)










2) Export to File – accessed through the ‘Log’ menu. This option exports the log data to a file.






In the ‘Export to File’ dialog, you can either export ‘All Revisions’ or ‘Selected revisions,’ and choose from several different formats (XML, HTML, Plain text, or Custom). You must also specify the Output file, which is where the log information will be written.








These are just some of the options available through SmartSVN’s powerful Log Menu. We’ll be covering more of these in our next post.

If you haven’t already tried SmartSVN, download your free SmartSVN Foundation edition today http://smartsvn.com/

Remember, you can catch up on the rest of our intro to SmartSVN series:

Branching in Apache Subversion Made Easy

Branching is a powerful and useful feature of Apache Subversion but, because it has a reputation for being difficult to master, many users never take advantage of it. In this post we’ll show you how to create a new branch, and then switch to this branch ready to begin working on its contents.

Creating a Branch in 5 Steps

1) To get started, right click on the folder you want to copy to a branch, and select the ‘Branch/Tag’ option from the TortoiseSVN menu.










2) In the ‘To path’ box, enter the location you want your branch to be copied to.

3) Enter a log message in the ‘Log message’ box.

4) Select which revision you wish to copy (this is typically HEAD revision, but you can specify another revision, if required.)

5) Click ‘OK.’










You have now created your branch!






3 Steps to Switch to Your New Branch

Now you’ve created a new branch, you’ll need to switch to it in order to begin working on its contents.

1) Right-click on the top level folder of your project and select ‘Switch’ from the TortoiseSVN context menu.

2) Enter the URL of the new branch you just created.

3) Ensure the ‘Head Revision’ button is selected, and click ‘Ok.’







The new branch will appear in your working copy!

Note, any changes that have not been committed to the repository will be merged when you run the switch command. Make sure you’ve either committed your changes before performing the switch, or revert your working copy to a revision that has already been committed to the repository.

Need more Subversion know-how? After getting a great response from the Apache Subversion community in 2011, Subversion Live is back for 2012, bringing the Subversion community sessions covering everything from Subversion’s future, to expert-led best practices workshops, as well as the unique opportunity to meet the core Subversion committers.