Pagine

Monday 30 January 2017

SVN tutorial n 28 - switch

The "svn switch" command updates working copy to a different URL.
The synopsis is the following:
 svn switch <svn_url>[@<svn_rev>] [<local_path>]
This is the Subversion way to make a working copy begin tracking a new branch. If specified, <svn_rev> determines in which revision the target is first looked up.
If --force option is used, unversioned obstructing paths in the working copy do not automatically cause a failure if the switch attempts to add the same path.
The --relocate option is deprecated as of Subversion 1.7. Use svn relocate [1] to perform working copy relocation instead.

Example:

 svn switch http://mysvnrepo/svn/myproject/branches/mybranch .

Link

Tuesday 24 January 2017

SVN tutorial n 27 - patch

The "svn patch" command applies the changes represented in a unidiff patch to the working copy. The synopsis is:
 svn patch <patch_file> [working_copy_patch]
This subcommand will apply changes described a unidiff-formatted patch file <patch_file> to the working copy working_copy_patch. As with most other working copy subcommands, if working_copy_patch is omitted, the changes are applied to the current working directory. A unidiff patch suitable for application to a working copy can be produced with the svn diff command or third-party differencing tools. Any non-unidiff content found in the patch file is ignored.

How to apply a svn patch

Apply a simple patch file generated by the svn diff command. Our patch file will create a new file, delete another file, and modify a third's contents and properties. Here's the patch file itself (which we'll assume is creatively named PATCH):
 cd <your_workingcopy>
 svn patch <path>/PATCH
Sometimes you might need Subversion to interpret a patch “in reverse”—where added things get treated as removed things, and vice-versa. Use the --reverse-diff option for this purpose. In the following example, we'll squirrel away a patch file which describes the changes in our working copy, and then use a reverse patch operation to undo those changes.
 svn diff > PATCH
 svn patch --reverse-diff PATCH

Monday 9 January 2017

SVN tutorial n 26 - relocate

Sometimes an administrator might change the location (or apparent location, from the client's perspective) of a repository. The content of the repository doesn't change, but the repository's root URL does. The hostname may change because the repository is now being served from a different computer. Or, perhaps the URL scheme changes because the repository is now being served via SSL (using https://) instead of over plain HTTP. There are many different reasons for these types of repository relocations.
The svn relocate command has two syntaxes:
The first svn relocate syntax allows you to update one or more working copies by what essentially amounts to a find-and-replace within the repository root URLs recorded in those working copies. Subversion will replace the initial substring <from-prefix> with the string <to-prefix> in those URLs.
 svn relocate <from-prefix> <to-prefix> [<svn_path>]
Example:
 svn up
Updating '.':
svn: E180001: Unable to connect to a repository at URL 'file://var/svn/repos/myproject/trunk'
 svn relocate file:///var/svn/new-repos/myproject/trunk
The second syntax does not require that you know the current repository root URL with which the working copy is associated at all—only the new repository URL (<to-url>) to which it should be pointing. In this syntax form, only one working copy may be relocated at a time.
 svn relocate <to-url> [<svn_path>]
Example
 svn relocate http://new-svn-host.com/repos/myproject/trunk