Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Switch Your Subversion Working Copy

DZone's Guide to

Switch Your Subversion Working Copy

· DevOps Zone
Free Resource

“Automated Testing: The Glue That Holds DevOps Together” to learn about the key role automated testing plays in a DevOps workflow, brought to you in partnership with Sauce Labs.

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

Learn about the importance of automated testing as part of a healthy DevOps practice, brought to you in partnership with Sauce Labs.

Topics:

Published at DZone with permission of Jessica Thornsby, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}