当前位置: > Linux服务器 > SVN >

svn switch的用法

时间:2014-12-16 14:15来源:linux.it.net.cn 作者:IT
由于服务器地址变更,SVN的操作会受到影响。之前的working copy,请在根目录下使用svn switch切换服务器地址。
 
svn switch的用法如下:
 
switch (sw): Update the working copy to a different URL.
usage: 1. switch URL[@PEGREV] [PATH]
       2. switch --relocate FROM TO [PATH...]

  1. Update the working copy to mirror a new URL within the repository.
     This behavior is similar to 'svn update', and is the way to
     move a working copy to a branch or tag within the same repository.
     If specified, PEGREV determines in which revision the target is first
     looked up.
 
     If --force is used, unversioned obstructing paths in the working
     copy do not automatically cause a failure if the switch attempts to
     add the same path.  If the obstructing path is the same type (file
     or directory) as the corresponding path in the repository it becomes
     versioned but its contents are left 'as-is' in the working copy.
     This means that an obstructing directory's unversioned children may
     also obstruct and become versioned.  For files, any content differences
     between the obstruction and the repository are treated like a local
     modification to the working copy.  All properties from the repository
     are applied to the obstructing path.
 
     Use the --set-depth option to set a new working copy depth on the
     targets of this operation.
 
  2. Rewrite working copy URL metadata to reflect a syntactic change only.
     This is used when repository's root URL changes (such as a scheme
     or hostname change) but your working copy still reflects the same
     directory within the same repository.
 
以solution/sc8810/branches/GC为例,在working copy的根目录下:
 
1) 查看以前的版本库目录:
lyf@ntd-home:~/sc8810/GC$ svn info
Path: .
URL: svn://172.16.1.27/solution/sc8810/branches/GC
Repository Root: svn://172.16.1.27/solution/sc8810
Repository UUID: a3d0e4bb-684d-4f22-b509-0e5f8c0de5bb
Revision: 1346
Node Kind: directory
Schedule: normal
Last Changed Author: ZCL
Last Changed Rev: 1345
Last Changed Date: 2012-11-09 16:39:04 +0800 (浜? 09 11?2012)
 
2) 执行svn switch命令切换版本库:
svn switch --relocate svn://172.16.1.27/solution/sc8810/branches/GC svn://172.16.2.53/solution/sc8810/branches/GC --username xxx --password xxx
 
3) 查看切换后的版本库目录:
lyf@ntd-home:~/sc8810/GC$ svn info
Path: .
URL: svn://172.16.2.53/solution/sc8810/branches/GC
Repository Root: svn://172.16.2.53/solution/sc8810
Repository UUID: a3d0e4bb-684d-4f22-b509-0e5f8c0de5bb
Revision: 1346
Node Kind: directory
Schedule: normal
Last Changed Author: ZCL
Last Changed Rev: 1345
Last Changed Date: 2012-11-09 16:39:04 +0800 (浜? 09 11?2012)
... (责任编辑:IT)
------分隔线----------------------------