Tag Archive for 'switch'

Switch your Subversion Working Copy

Apache Subversion’s ‘svn switch’ command allows users to update a working copy to a different URL. This is useful when you need to update your working copy to mirror a newly-created branch.

Although it’s possible to achieve the same effect by performing a fresh checkout, the ‘svn switch’ command is a quicker alternative. It saves you the overhead of running ‘svn checkout,’ and applies the changes required to bring your working copy inline with the new location, making it a very efficient command. It also preserves any changes you’ve made in the working copy.

To perform a switch, run ‘svn switch’ followed by the URL path you wish to mirror. Apache Subversion will then go ahead and update your working copy.

svn switch

Additional Options

There are some additional options you can apply to fine-tune the ‘svn switch’ command:

  • Ignore Ancestry

If Subversion cannot find a common ancestor for the URL and your working copy, it will block the operation and display an error message.

svn switch 2

It is possible to force Subversion to switch to this URL anyway, by adding the –ignore-ancestry option.

svn switch (target-URL) –ignore-ancestry

svn switch 3

  • Target a Particular Revision

You can also specify a particular revision of the URL you’re switching to. Note that Subversion defaults to the HEAD revision, if no alternate revision is specified:

svn switch -r(revision-number) (target-URL)

svn switch 4

Want more free Subversion training? We offer plenty of webinar replays available on-demand, or you can sign up for our upcoming webinars.

Subversion Tip of the Week

Intro to Subversion Switch

When working with branches, Apache Subversion provides a useful shortcut for switching your current working copy to a new branch’s location, without the overhead of checking out a fresh working copy containing the targeted branch. Leveraging this functionality, it’s possible to build a working copy that contains data from a range of repository locations, although these locations must originate from the same repository.

To achieve this, enter the ‘svn switch’ command, followed by the URL you wish to switch to:

svn switch repository-URL

svn switch

Users of SmartSVN, the cross-platform graphical client for SVN, can perform a switch simply by opening the ‘Modify’ menu and selecting the ‘Switch…’ option.

svn switch 2

In the subsequent dialog, enter the new URL – or select the ‘Browse’ option to view the different branches – and specify whether you’re switching to the latest revision (HEAD) or a particular revision number.

svn switch 3

Tip. Use the ‘Select…’ button to view more information about the different revisions.

Not yet started with SmartSVN? Claim your free 30 day trial at www.smartsvn.com/download



Subversion Tip of the Week

In the world of the busy software developer, it’s easy to lose track of what you’ve been working on. In this week’s tip, we’ll share some useful commands for getting more information on your Apache Subversion project.

  • Current state of your SVN installation

The ‘svn –version’ command is useful for viewing information about the current state of your Apache Subversion installation. When entered, it lists the version number of your installation, and all the repository access modules.

Tip. If you just want to double-check what version of Subversion you’re running, the –quiet switch can be used to suppress information about repository access modules.

  •  View the entire project’s history

Log messages are an easy way to get an overview of your project. The ‘SVN log’ command, followed by the working copy’s location, brings up the entire history of your log messages.

Tip. The –verbose switch can be used to print the affected paths of each log message:

Remember that the latest Apache Subversion binaries can be downloaded at http://www.wandisco.com/subversion/download

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.