【SVN】linux下svn命令参数详解(一)

一、安装

1、ubuntu
 sudo apt install subversion

二、全部命令

~# svn --help
usage: svn <subcommand> [options] [args]
Subversion command-line client.
Type 'svn help <subcommand>' for help on a specific subcommand.
Type 'svn --version' to see the program version and RA modules
  or 'svn --version --quiet' to see just the version number.

大多数子命令接受文件和/或目录参数,递归在目录上。
如果没有参数被提供给命令,它在默认情况下递归当前目录(包括)

可用的子命令:
   add	: 把文件和目录纳入版本控制,通过调度加到版本库。它们会在下一次提交时加入。
   auth
   blame (praise, annotate, ann) :追溯
   cat				:显示特定版本的某文件内容
   changelist (cl)	:耦合(或解耦)文件与修改列表
   checkout (co)	:检出
   cleanup			:递归清理工作副本,删除锁,继续未完成操作,等等。
   commit (ci)		:把工作副本的修改提交到版本库。
   copy (cp)		:在工作副本或版本库中复制数据,保留历史。
   delete (del, remove, rm):从版本库中删除文件和目录。
   diff (di)		:显示两个版本或路径的差异。
   export			:导出一个无版本控制的目录树副本。
   help (?, h)		:描述本程序或其子命令的用法。
   import			:将未纳入版本控制的文件或目录树提交到版本库。
   info				:显示本地或远程条目的信息。
   list (ls)		:列出版本库中的目录内容。
   lock				:锁定版本库中的路径,使得其他用户不能向其提交修改。
   log				:显示svn 的版本log,含作者、日期、路径等。
   merge			:合并svn和本地代码
   mergeinfo		:显示合并的相关信息。
   mkdir			:创建纳入版本控制的新目录。
   move (mv, rename, ren):在工作副本或版本库中移动或改名文件或目录。
   patch			:打补丁
   propdel (pdel, pd)	:删除目录、文件或版本的属性。
   propedit (pedit, pe)	:使用外部编辑器编辑属性。
   propget (pget, pg)	:显示目录、文件或版本的属性取值。
   proplist (plist, pl)	:列出目录、文件或版本的所有属性。
   propset (pset, ps)	:设定目录、文件或版本的属性。
   relocate				:当svn服务器url发生变更,又不想在本地重新进行checkout操作,这时候可以使用svn relocate命令进行url的重新定位;
   resolve				:解决工作副本中目录或文件的冲突。
   resolved				:删除工作副本中目录或文件的"冲突"状态。
   revert				:撤销本地修改代码
   status (stat, st)	:查看本地修改代码情况:修改的或本地独有的文件详细信息
   switch (sw)			:更新工作副本至不同的 URL。
   unlock				:解除工作副本或URL的锁定。
   update (up)			:将版本库的修改合并到工作副本中。
   upgrade

Subversion 是版本控制工具。
欲取得详细资料,请参阅 http://subversion.apache.org/

三 、常用命令(客户端)

1、检出
:~# svn help checkout
checkout (co): 从版本库签出工作副本。
使用: checkout URL[@REV]... [PATH]
# Rev.是revision的缩写,即版本的意思
  如果指定 REV,那么它确定了从 URL 首先查找的版本。

  如果省略路径参数,则 URL 最末尾的目录名作为目标目录名。如果指定多个 URL,
  则依次将其签出到 PATH 的子目录中,子目录名就是 URL 最末尾的目录名。

  如果使用了 “--force” 选项,在工作副本中未版本控制的障碍路径,不会自动导
  致签出失败。 如果障碍路径与版本库中的对应路径类型相同(文件或目录),它将成
  为受版本控制的路径,但是内容不改变。它意味着障碍路径的孩子,如果也是障碍路
  径,那么也会受版本控制。对于障碍路径中的文件,如果与版本库内的不同,将视为工
  作副本发生本地修改。版本库中的所有属性都应用于障碍路径。

  参见 “svn help update” 以获取报告执行动作的字符列表。

有效选项:
  -r [--revision] ARG      : ARG (一些命令也接受ARG1:ARG2范围)
                             版本参数可以是如下之一:
                                NUMBER       版本号
                                '{' DATE '}' 在指定时间以后的版本
                                'HEAD'       版本库中的最新版本
                                'BASE'       工作副本的基线版本
                                'COMMITTED'  最后提交或基线之前
                                'PREV'       COMMITTED的前一版本
  -q [--quiet]             : 不打印信息,或只打印概要信息
  -N [--non-recursive]     : 过时;尝试 --depth=files 或 --depth=immediates
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  --force                  : 强制操作运行
  --ignore-externals       : 忽略外部项目

全局选项:
  --username ARG           : 指定用户名称 ARG(变量)
  --password ARG           : 指定一个密码 ARG (注意:对许多操作系统,其他用户将能够看到这一点)
  --no-auth-cache          : 不要缓存用户认证令牌
  --non-interactive        : 不要交互式提示 (默认是提示仅当标准输入是终端设备时)
  --force-interactive      : 强制交互式提示即使是标准输入是不是终端设备
  --trust-server-cert      : 弃用; same as
                             --trust-server-cert-failures=unknown-ca
  --trust-server-cert-failures ARG : with --non-interactive, accept SSL server
                             certificates with failures; ARG is comma-separated
                             list of 'unknown-ca' (Unknown Authority),
                             'cn-mismatch' (Hostname mismatch), 'expired'
                             (Expired certificate), 'not-yet-valid' (Not yet
                             valid certificate) and 'other' (all other not
                             separately classified certificate errors).
  --config-dir ARG         : 从目录 ARG 读取用户配置文件
  --config-option ARG      : 以下属格式设置用户配置选项:
                                 FILE:SECTION:OPTION=[VALUE]
                             例如:
                                 servers:global:http-library=serf

2、查看当前的状态
 svn help status
status (stat, st): 打印工作副本文件和目录的状态。
usage: status [PATH...]

  如果没有参数,只打印本地修改的项(没有网络访问)。
  使用-q,只打印有关本地修改项的摘要信息。
  使用-u,添加工作修订和服务器过期信息。
  使用-v,打印每个项目的完整修订信息。

  输出的前七列是等宽字符:
  	第一列:表示是否添加、删除或以其他方式更改了项
      ' ' no modifications 没有修改的
      'A' Added 新添加的
      'C' Conflicted 有冲突的
      'D' Deleted 被删除的
      'I' Ignored 被忽视的
      'M' Modified 修改的
      'R' Replaced  被替换的
      'X' an unversioned directory created by an externals definition 由外部定义创建的未版本化目录(没有理解)
      '?' item is not under version control 不受版本控制的
      '!' item is missing (removed by non-svn command) or incomplete 项目缺失(被非svn命令删除)或不完整
      '~' versioned item obstructed by some item of a different kind 被另一种类型的项目所阻碍的版本化项目(没有理解)
    第二列:文件或目录属性的修改
      ' ' no modifications 没有修改的
      'C' Conflicted 有冲突的
      'M' Modified 修改的
    第三列:工作副本是否被锁定,另一个Subversion客户端修改工作副本
      ' ' not locked for writing 没有锁定
      'L' locked for writing	锁定
    第四列:计划提交将创建一个副本(添加与历史)
      ' ' no history scheduled with commit (item was newly added)
      '+' history scheduled with commit (item was copied)
    第五列:项目是否被交换或外部文件
      ' ' normal
      'S' the item has a Switched URL relative to the parent
      'X' a versioned file created by an eXternals definition
    第六列:该项是否锁定在存储库中进行排他提交
      (without -u)
      ' ' not locked by this working copy
      'K' locked by this working copy, but lock might be stolen or broken
      (with -u)
      ' ' not locked in repository, not locked by this working copy
      'K' locked in repository, lock owned by this working copy
      'O' locked in repository, lock owned by another working copy
      'T' locked in repository, lock owned by this working copy was stolen
      'B' not locked in repository, lock owned by this working copy is broken
    第七列:该物品是否是树冲突的受害者
      ' ' normal
      'C' tree-Conflicted
    如果项目是树冲突的受害者,则打印额外的行在项目状态栏后,解释冲突的性质。

  过时的信息出现在第九列(-u):
      '*' a newer revision exists on the server
      ' ' the working copy is up to date

  其余字段的宽度可变,用空格分隔:
最后一次修改时出现问号('?')提交的修订,或最后提交的作者预期表明该信息是未知的或无关的给定状态项(例如,当项是复制操作的结果时)。
问号作为一个可视化占位符来方便解析。

  Example output:
    svn status wc
     M      wc/bar.c
    A  +    wc/qax.c

    svn status -u wc
     M             965   wc/bar.c
            *      965   wc/foo.c
    A  +             -   wc/qax.c
    Status against revision:   981

    svn status --show-updates --verbose wc
     M             965      938 kfogel       wc/bar.c
            *      965      922 sussman      wc/foo.c
    A  +             -      687 joe          wc/qax.c
                   965      687 joe          wc/zig.c
    Status against revision:   981

    svn status
     M      wc/bar.c
    !     C wc/qaz.c
          >   local missing, incoming edit upon update
    D       wc/qax.c

有效选项:
  -u [--show-updates]      : 显示更新信息
  -v [--verbose]           : 打印附加信息
  -N [--non-recursive]     : 过时;尝试 --depth=files 或 --depth=immediates
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  -r [--revision] ARG      : ARG (一些命令也接受ARG1:ARG2范围)
                             版本参数可以是如下之一:
                                NUMBER       版本号
                                '{' DATE '}' 在指定时间以后的版本
                                'HEAD'       版本库中的最新版本
                                'BASE'       工作副本的基线版本
                                'COMMITTED'  最后提交或基线之前
                                'PREV'       COMMITTED的前一版本
  -q [--quiet]             : 不打印未版本控制的条目
  --no-ignore              : disregard default and svn:ignore and
                             svn:global-ignores property ignores
  --incremental            : 给予适合串联的输出
  --xml                    : 输出为 XML
  --ignore-externals       : 忽略外部项目
  --changelist [--cl] ARG  : 只能对修改列表 ARG 的成员操作
3、添加新文件到版本管理中
~# svn help add
add: 把文件和目录纳入版本控制,通过调度加到版本库。它们会在下一次提交时加入。
用法: add 路径...

有效选项:
  --targets ARG            : 传递文件 ARG 内容为附件参数
  -N [--non-recursive]     : 过时;尝试 --depth=files 或 --depth=immediates
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  -q [--quiet]             : 不打印信息,或只打印概要信息
  --force                  : 强制操作运行
  --no-ignore              : disregard default and svn:ignore and
                             svn:global-ignores property ignores
  --auto-props             : 启用自动属性
  --no-auto-props          : 关闭自动属性
  --parents                : 增加中间父目录
4、提交
~# svn help commit
commit (ci): 将更改从工作副本发送到存储库。
usage: commit [PATH...]

必须提供一个日志消息,但它可以是空的。如果不是通过——message或——file选项,编辑器将被启动。
如果任何目标是(或包含)锁定的物品,它们就会被锁定成功提交后解锁。

  If --include-externals is given, also commit file and directory
  externals reached by recursion. Do not commit externals with a
  fixed revision.

有效选项:
  -q [--quiet]             : 不打印信息,或只打印概要信息
  -N [--non-recursive]     : 过时;尝试 --depth=files 或 --depth=immediates
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  --targets ARG            : 传递文件 ARG 内容为附件参数
  --no-unlock              : 不要解锁目标
  -m [--message] ARG       : 指定日志信息ARG
  -F [--file] ARG          : 从文件ARG读取日志信息
  --force-log              : 强制校验日志信息资源
  --editor-cmd ARG         : 使用 ARG 作为外部编辑器
  --encoding ARG           : 将ARG的值视为字符编码
  --with-revprop ARG       : 在新版本设置版本属性 ARG
                使用格式 name[=value]
  --changelist [--cl] ARG  : 只能对修改列表 ARG 的成员操作
  --keep-changelists       : 不要在提交后删除修改列表
  --include-externals      : also operate on externals defined by
                             svn:externals properties
5、更新
~# svn help update
update (up): 将版本库的修改合并到工作副本中。
用法: update [PATH...]

  如果没有指定版本,则将工作副本更新到 HEAD 版本。否则同步到 -r 选项所
  指定的版本。

  每更新一项就输出一行信息,使用首字符来报告执行的动作。这些字符的含义是:

    A  已添加
    D  已删除
    U  已更新
    C  合并冲突
    G  合并成功
    E  已存在
    R  已替换

  第一列字符报告项目本身。
  第二列表示报告项目属性。
  第三列中的字符“B”表示此文件上的锁被终止或窃取。
  第四列中的字符“C”表示树冲突,同时“C”出现在第一列或第二列,分别表示
  内容冲突或属性冲突。

  如果使用了 “--force” 选项,在工作副本中未版本控制的障碍路径,不会自动
  导致签出失败。 如果障碍路径与版本库中的对应路径类型相同(文件或目录),它
  将成为受版本控制的路径,但是内容不改变。它意味着障碍路径的子孙,也可能
  是障碍路径,同样会受版本控制。对于障碍路径中的文件,如果与版本库内的
  不同,将视为工作副本发生本地修改。版本库中的所有属性都应用于障碍路径。
  用第一列字符 “E” 来报告障碍路径。

  如果工作副本中并没有指定的更新目标,但是有其父目录,那么就在指定路径上
  将目标检出到其父目录中。如果使用了选项 --parents,就会创建目标的所有不
  存在的父目录 (使用选项 --depth=empty)。

  使用“--set-depth”选项设置此操作目标的工作副本之新深度。

有效选项:
  -r [--revision] ARG      : ARG (一些命令也接受ARG1:ARG2范围)
                             版本参数可以是如下之一:
                                NUMBER       版本号
                                '{' DATE '}' 在指定时间以后的版本
                                'HEAD'       版本库中的最新版本
                                'BASE'       工作副本的基线版本
                                'COMMITTED'  最后提交或基线之前
                                'PREV'       COMMITTED的前一版本
  -N [--non-recursive]     : 过时;尝试 --depth=files 或 --depth=immediates
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  --set-depth ARG          : 设置工作副本的新深度为 ARG('exclude',
                             'empty', 'files', 'immediates','infinity')
  -q [--quiet]             : 不打印信息,或只打印概要信息
  --diff3-cmd ARG          : 使用 ARG 作为合并命令
  --force                  : handle unversioned obstructions as changes
  --ignore-externals       : 忽略外部项目
  --changelist [--cl] ARG  : 只能对修改列表 ARG 的成员操作
  --editor-cmd ARG         : 使用 ARG 作为外部编辑器
  --accept ARG             : 指定自动解决冲突动作
                             ('postpone', 'working', 'base', 'mine-conflict',
                             'theirs-conflict', 'mine-full', 'theirs-full',
                             'edit', 'launch')
                             (shorthand: 'p', 'mc', 'tc', 'mf', 'tf', 'e', 'l')
  --parents                : 创建中间目录

6、撤销修改
:~# svn help revert
revert: 恢复原始的工作复制状态(撤消本地更改)。
usage: revert PATH...

  在PATH上或在PATH内恢复工作副本中的更改,并删除冲突标记(如果有的话)。

  此子命令不会还原已经提交的更改。
  关于撤销已经提交的更改的信息,搜索“svn help merge”的输出为“undo”。

有效选项:
  --targets ARG            : 传递文件 ARG 内容为附件参数
  -R [--recursive]         : 向下递归,与 --depth=infinity 相同
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  -q [--quiet]             : 不打印信息,或只打印概要信息
  --changelist [--cl] ARG  : 只能对修改列表 ARG 的成员操作
7、合并
~# svn help merge
merge: 将更改合并到工作副本中。
usage: 1. merge SOURCE[@REV] [TARGET_WCPATH]
          (the 'complete' merge)
       2. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH]
          (the 'cherry-pick' merge)
       3. merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH]
          (the '2-URL' merge)

  1. 这个表单只有一个源路径,没有修改范围,称为“完全”合并:

       svn merge SOURCE[@REV] [TARGET_WCPATH]

     完全合并用于“同步”和“重新集成”合并在下面描述的“特性分支”模式中。
     它会找到所有源分支上尚未合并到目标分支,并将它们合并到工作副本中。
     合并跟踪用于知道哪些更改已经被合并。

	 SOURCE指定将从何处提取更改的分支,并且TARGET_WCPATH指定目标分支的工作副本更改将被应用。
	 通常SOURCE和TARGET_WCPATH应该是每一个都对应于一个分支的根。
	 (如果你只想合并子树,则子树路径必须包含在SOURCE和TARGET_WCPATH;这是不鼓励的,以避免子树合并信息。)
     
     SOURCE通常是一个URL。可选的'@REV'指定了URL的修订和将被考虑的最新版本合并;如果未指定REV,则假定HEAD修订。
     如果“SOURCE”为工作拷贝路径,路径对应的URL为REV的默认值是基本修订版本(通常是修订最近更新到)。
     
	 TARGET_WCPATH是一个工作拷贝路径;默认是当前目录。有一些特殊情况:

       - 如果SOURCE是一个URL:

           - 如果URL的基名和'.'的基名相同,然后区别被应用于。
          	否则,如果找到一个与URL的基名相同的文件在”.’,那么这些差异就适用于该文件。
			在所有其他情况下,目标默认为'.'- 如果SOURCE是工作拷贝路径:

           - 如果源文件是一个文件,则对其应用差异文件(对于反向合并早期的更改很有用)- 否则,如果源是一个目录,则目标默认为'.'。

     在正常使用中,工作副本应是最新的,在单个修订,没有本地修改和切换子树。

       - The 'Feature Branch' Merging Pattern -

     在这个常用的工作流程中,也称为“开发”分支模式,开发者创建一个分支并提交一系列实现新特性的更改。
     开发人员定期合并来自父分支的所有最新更改,以保持开发分支更新这些更改。
     当特性是完成后,开发人员执行从特性分支到父分支重新集成更改。

         parent --+----------o------o-o-------------o--
                   \            \           \      /
                    \          merge      merge  merge
                     \            \           \  /
         feature      +--o-o-------o----o-o----o-------

     从父分支到特性分支的合并称为“同步”或“追赶”合并,以及从特性分支到父分支称为“重新集成”合并。

       - Sync Merge Example -
                                 ............
                                .            .
         trunk  --+------------L--------------R------
                   \                           \
                    \                          |
                     \                         v
         feature      +------------------------o-----
                             r100            r200

     Subversion will locate all the changes on 'trunk' that have not yet
     been merged into the 'feature' branch. In this case that is a single
     range, r100:200. In the diagram above, L marks the left side (trunk@100)
     and R marks the right side (trunk@200) of the merge source. The
     difference between L and R will be applied to the target working copy
     path. In this case, the working copy is a clean checkout of the entire
     'feature' branch.
     Subversion将定位到“主干”上尚未出现的所有更改已经被合并到“feature”分支中。在本例中,这是一个单范围,r100:200。
     在上图中,L标记了左边(trunk@100)R标记合并源的右侧(trunk@200)的L和R之间的差异将应用于目标工作副本路径。
     在本例中,工作副本是完整的签出“feature”分支。

     To perform this sync merge, have a clean working copy of the feature
     branch and run the following command in its top-level directory:
     要执行此同步合并,请拥有该特性的干净工作副本在其顶级目录中运行以下命令:

         svn merge ^/trunk

     Note that the merge is now only in your local working copy and still
     needs to be committed to the repository so that it can be seen by
     others. You can review the changes and you may have to resolve
     conflicts before you commit the merge.
     注意,合并现在只在本地工作副本中,而且仍然需要提交到存储库,以便被别人。
     您可以查看更改,并可能需要解决这些更改在提交合并之前发生冲突。
	
       - Reintegrate Merge Example -

     The feature branch was last synced with trunk up to revision X. So the
     difference between trunk@X and feature@HEAD contains the complete set
     of changes that implement the feature, and no other changes. These
     changes are applied to trunk.

                    rW                   rX
         trunk ------+--------------------L------------------o
                      \                    .                 ^
                       \                    .............   /
                        \                                . /
         feature         +--------------------------------R

     In the diagram above, L marks the left side (trunk@X) and R marks the
     right side (feature@HEAD) of the merge. The difference between the
     left and right side is merged into trunk, the target.

     To perform the merge, have a clean working copy of trunk and run the
     following command in its top-level directory:

         svn merge ^/feature

     To prevent unnecessary merge conflicts, a reintegrate merge requires
     that TARGET_WCPATH is not a mixed-revision working copy, has no local
     modifications, and has no switched subtrees.

     A reintegrate merge also requires that the source branch is coherently
     synced with the target -- in the above example, this means that all
     revisions between the branch point W and the last merged revision X
     are merged to the feature branch, so that there are no unmerged
     revisions in-between.


  2. This form is called a 'cherry-pick' merge:这种形式被称为“精选”合并:

       svn merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH]

     A cherry-pick merge is used to merge specific revisions (or revision
     ranges) from one branch to another. By default, this uses merge
     tracking to automatically skip any revisions that have already been
     merged to the target; you can use the --ignore-ancestry option to
     disable such skipping.

     SOURCE is usually a URL. The optional '@REV' specifies only the peg
     revision of the URL and does not affect the merge range; if REV is not
     specified, the HEAD revision is assumed. If SOURCE is a working copy
     path, the corresponding URL of the path is used, and the default value
     of 'REV' is the base revision (usually the revision last updated to).

     TARGET_WCPATH is a working copy path; if omitted, '.' is generally
     assumed. The special cases noted above in the 'complete' merge form
     also apply here.

     The revision ranges to be merged are specified by the '-r' and/or '-c'
     options. '-r N:M' refers to the difference in the history of the
     source branch between revisions N and M. You can use '-c M' to merge
     single revisions: '-c M' is equivalent to '-r <M-1>:M'. Each such
     difference is applied to TARGET_WCPATH.

     If the mergeinfo in TARGET_WCPATH indicates that revisions within the
     range were already merged, changes made in those revisions are not
     merged again. If needed, the range is broken into multiple sub-ranges,
     and each sub-range is merged separately.

     A 'reverse range' can be used to undo changes. For example, when
     source and target refer to the same branch, a previously committed
     revision can be 'undone'. In a reverse range, N is greater than M in
     '-r N:M', or the '-c' option is used with a negative number: '-c -M'
     is equivalent to '-r M:<M-1>'. Undoing changes like this is also known
     as performing a 'reverse merge'.

     Multiple '-c' and/or '-r' options may be specified and mixing of
     forward and reverse ranges is allowed.

       - Cherry-pick Merge Example -

     A bug has been fixed on trunk in revision 50. This fix needs to
     be merged from trunk onto the release branch.

            1.x-release  +-----------------------o-----
                        /                        ^
                       /                         |
                      /                          |
         trunk ------+--------------------------LR-----
                                                r50

     In the above diagram, L marks the left side (trunk@49) and R marks the
     right side (trunk@50) of the merge. The difference between the left
     and right side is applied to the target working copy path.

     Note that the difference between revision 49 and 50 is exactly those
     changes that were committed in revision 50, not including changes
     committed in revision 49.

     To perform the merge, have a clean working copy of the release branch
     and run the following command in its top-level directory; remember
     that the default target is '.':

         svn merge -c50 ^/trunk

     You can also cherry-pick several revisions and/or revision ranges:

         svn merge -c50,54,60 -r65:68 ^/trunk


  3. This form is called a '2-URL merge':这个表单叫做“2-URL合并”:

       svn merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH]

     You should use this merge variant only if the other variants do not
     apply to your situation, as this variant can be quite complex to
     master.

     Two source URLs are specified, identifying two trees on the same
     branch or on different branches. The trees are compared and the
     difference from SOURCE1@REV1 to SOURCE2@REV2 is applied to the
     working copy of the target branch at TARGET_WCPATH. The target
     branch may be the same as one or both sources, or different again.
     The three branches involved can be completely unrelated.

     TARGET_WCPATH is a working copy path; if omitted, '.' is generally
     assumed. The special cases noted above in the 'complete' merge form
     also apply here.

     SOURCE1 and/or SOURCE2 can also be specified as a working copy path,
     in which case the merge source URL is derived from the working copy.

       - 2-URL Merge Example -

     Two features have been developed on separate branches called 'foo' and
     'bar'. It has since become clear that 'bar' should be combined with
     the 'foo' branch for further development before reintegration.

     Although both feature branches originate from trunk, they are not
     directly related -- one is not a direct copy of the other. A 2-URL
     merge is necessary.

     The 'bar' branch has been synced with trunk up to revision 500.
     (If this revision number is not known, it can be located using the
     'svn log' and/or 'svn mergeinfo' commands.)
     The difference between trunk@500 and bar@HEAD contains the complete
     set of changes related to feature 'bar', and no other changes. These
     changes are applied to the 'foo' branch.

                           foo  +-----------------------------------o
                               /                                    ^
                              /                                    /
                             /              r500                  /
         trunk ------+------+-----------------L--------->        /
                      \                        .                /
                       \                        ............   /
                        \                                   . /
                    bar  +-----------------------------------R

     In the diagram above, L marks the left side (trunk@500) and R marks
     the right side (bar@HEAD) of the merge. The difference between the
     left and right side is applied to the target working copy path, in
     this case a working copy of the 'foo' branch.

     To perform the merge, have a clean working copy of the 'foo' branch
     and run the following command in its top-level directory:

         svn merge ^/trunk@500 ^/bar

     The exact changes applied by a 2-URL merge can be previewed with svn's
     diff command, which is a good idea to verify if you do not have the
     luxury of a clean working copy to merge to. In this case:

         svn diff ^/trunk@500 ^/bar@HEAD


  The following applies to all types of merges:

  To prevent unnecessary merge conflicts, svn merge requires that
  TARGET_WCPATH is not a mixed-revision working copy. Running 'svn update'
  before starting a merge ensures that all items in the working copy are
  based on the same revision.

  If possible, you should have no local modifications in the merge's target
  working copy prior to the merge, to keep things simpler. It will be
  easier to revert the merge and to understand the branch's history.

  Switched sub-paths should also be avoided during merging, as they may
  cause incomplete merges and create subtree mergeinfo.

  For each merged item a line will be printed with characters reporting the
  action taken. These characters have the following meaning:

    A  Added
    D  Deleted
    U  Updated
    C  Conflict
    G  Merged
    E  Existed
    R  Replaced

  Characters in the first column report about the item itself.
  Characters in the second column report about properties of the item.
  A 'C' in the third column indicates a tree conflict, while a 'C' in
  the first and second columns indicate textual conflicts in files
  and in property values, respectively.

    - Merge Tracking -

  Subversion uses the svn:mergeinfo property to track merge history. This
  property is considered at the start of a merge to determine what to merge
  and it is updated at the conclusion of the merge to describe the merge
  that took place. Mergeinfo is used only if the two sources are on the
  same line of history -- if the first source is an ancestor of the second,
  or vice-versa (i.e. if one has originally been created by copying the
  other). This is verified and enforced when using sync merges and
  reintegrate merges.

  The --ignore-ancestry option prevents merge tracking and thus ignores
  mergeinfo, neither considering it nor recording it.

    - Merging from foreign repositories -

  Subversion does support merging from foreign repositories.
  While all merge source URLs must point to the same repository, the merge
  target working copy may come from a different repository than the source.
  However, there are some caveats. Most notably, copies made in the
  merge source will be transformed into plain additions in the merge
  target. Also, merge-tracking is not supported for merges from foreign
  repositories.

有效选项:
  -r [--revision] ARG      : ARG (一些命令也接受ARG1:ARG2范围)
                             版本参数可以是如下之一:
                                NUMBER       版本号
                                '{' DATE '}' 在指定时间以后的版本
                                'HEAD'       版本库中的最新版本
                                'BASE'       工作副本的基线版本
                                'COMMITTED'  最后提交或基线之前
                                'PREV'       COMMITTED的前一版本
  -c [--change] ARG        : 版本 ARG (如同 -r ARG-1:ARG) 做的修改
                             如果 ARG 为负数则等价于 -r ARG:ARG-1 如果 ARG 的格式是 ARG1-ARG2,那么它等价于
                             ARG1:ARG2,包含 ARG1
  -N [--non-recursive]     : 过时;尝试 --depth=files 或 --depth=immediates
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  -q [--quiet]             : 不打印信息,或只打印概要信息
  --force                  : force deletions even if deleted contents don't match
  --dry-run                : 尝试操作但没有修改
  --diff3-cmd ARG          : 使用 ARG 作为合并命令
  --record-only            : 只合并合并信息的差异
  -x [--extensions] ARG    : Specify differencing options for external diff or
                             internal diff or blame. Default: '-u'. Options are
                             separated by spaces. Internal diff and blame take:
                               -u, --unified: Show 3 lines of unified context
                               -b, --ignore-space-change: Ignore changes in
                                 amount of white space
                               -w, --ignore-all-space: Ignore all white space
                               --ignore-eol-style: Ignore changes in EOL style
                               -U ARG, --context ARG: Show ARG lines of context
                               -p, --show-c-function: Show C function name
  --ignore-ancestry        : disable merge tracking; diff nodes as if related
  --accept ARG             : 指定自动解决冲突动作
                             ('postpone', 'working', 'base', 'mine-conflict',
                             'theirs-conflict', 'mine-full', 'theirs-full',
                             'edit', 'launch')
                             (shorthand: 'p', 'mc', 'tc', 'mf', 'tf', 'e', 'l')
  --reintegrate            : 已经淘汰
  --allow-mixed-revisions  : Allow operation on mixed-revision working copy.
                             Use of this option is not recommended!
                             Please run 'svn update' instead.
  -v [--verbose]           : 打印附加信息
8、查看历史版本
~# svn help log
log: Show the log messages for a set of revision(s) and/or path(s).
usage: 1. log [PATH][@REV]
       2. log URL[@REV] [PATH...]

  1. Print the log messages for the URL corresponding to PATH
     (default: '.'). If specified, REV is the revision in which the
     URL is first looked up, and the default revision range is REV:1.
     If REV is not specified, the default revision range is BASE:1,
     since the URL might not exist in the HEAD revision.

  2. Print the log messages for the PATHs (default: '.') under URL.
     If specified, REV is the revision in which the URL is first
     looked up, and the default revision range is REV:1; otherwise,
     the URL is looked up in HEAD, and the default revision range is
     HEAD:1.

  Multiple '-c' or '-r' options may be specified (but not a
  combination of '-c' and '-r' options), and mixing of forward and
  reverse ranges is allowed.

  With -v, also print all affected paths with each log message.
  With -q, don't print the log message body itself (note that this is
  compatible with -v).

  Each log message is printed just once, even if more than one of the
  affected paths for that revision were explicitly requested.  Logs
  follow copy history by default.  Use --stop-on-copy to disable this
  behavior, which can be useful for determining branchpoints.

  The --depth option is only valid in combination with the --diff option
  and limits the scope of the displayed diff to the specified depth.

  If the --search option is used, log messages are displayed only if the
  provided search pattern matches any of the author, date, log message
  text (unless --quiet is used), or, if the --verbose option is also
  provided, a changed path.
  The search pattern may include "glob syntax" wildcards:
      ?      matches any single character
      *      matches a sequence of arbitrary characters
      [abc]  matches any of the characters listed inside the brackets
  If multiple --search options are provided, a log message is shown if
  it matches any of the provided search patterns. If the --search-and
  option is used, that option's argument is combined with the pattern
  from the previous --search or --search-and option, and a log message
  is shown only if it matches the combined search pattern.
  If --limit is used in combination with --search, --limit restricts the
  number of log messages searched, rather than restricting the output
  to a particular number of matching log messages.

  Examples:

    Show the latest 5 log messages for the current working copy
    directory and display paths changed in each commit:
      svn log -l 5 -v

    Show the log for bar.c as of revision 42:
      svn log bar.c@42

    Show log messages and diffs for each commit to foo.c:
      svn log --diff http://www.example.com/repo/project/foo.c
    (Because the above command uses a full URL it does not require
     a working copy.)

    Show log messages for the children foo.c and bar.c of the directory
    '/trunk' as it appeared in revision 50, using the ^/ URL shortcut:
      svn log ^/trunk@50 foo.c bar.c

    Show the log messages for any incoming changes to foo.c during the
    next 'svn update':
      svn log -r BASE:HEAD foo.c

    Show the log message for the revision in which /branches/foo
    was created:
      svn log --stop-on-copy --limit 1 -r0:HEAD ^/branches/foo

有效选项:
  -r [--revision] ARG      : ARG (一些命令也接受ARG1:ARG2范围)
                             版本参数可以是如下之一:
                                NUMBER       版本号
                                '{' DATE '}' 在指定时间以后的版本
                                'HEAD'       版本库中的最新版本
                                'BASE'       工作副本的基线版本
                                'COMMITTED'  最后提交或基线之前
                                'PREV'       COMMITTED的前一版本
  -c [--change] ARG        : 版本 ARG 引起的改变
  -q [--quiet]             : do not print the log message
  -v [--verbose]           : also print all affected paths
  -g [--use-merge-history] : 从合并历史使用/显示额外信息
  --targets ARG            : 传递文件 ARG 内容为附件参数
  --stop-on-copy           : 查看历史不要跨越不同的副本
  --incremental            : 给予适合串联的输出
  --xml                    : 输出为 XML
  -l [--limit] ARG         : 日值项最大值
  --with-all-revprops      : 获取所有版本属性
  --with-no-revprops       : 没有找回版本属性
  --with-revprop ARG       : 获取版本属性 ARG
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  --diff                   : 产生差异输出
  --diff-cmd ARG           : 使用 ARG 作为比较命令
  --internal-diff          : 覆盖配置文件中指定的 diff-cmd
  -x [--extensions] ARG    : Specify differencing options for external diff or
                             internal diff or blame. Default: '-u'. Options are
                             separated by spaces. Internal diff and blame take:
                               -u, --unified: Show 3 lines of unified context
                               -b, --ignore-space-change: Ignore changes in
                                 amount of white space
                               -w, --ignore-all-space: Ignore all white space
                               --ignore-eol-style: Ignore changes in EOL style
                               -U ARG, --context ARG: Show ARG lines of context
                               -p, --show-c-function: Show C function name
  --search ARG             : use ARG as search pattern (glob syntax)
  --search-and ARG         : combine ARG with the previous search pattern
9、查看不同
# svn help diff
diff (di): Display local changes or differences between two revisions or paths.
usage: 1. diff
       2. diff [-c M | -r N[:M]] [TARGET[@REV]...]
       3. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \
               [PATH...]
       4. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]
       5. diff OLD-URL[@OLDREV] NEW-PATH[@NEWREV]
       6. diff OLD-PATH[@OLDREV] NEW-URL[@NEWREV]

  1. Use just 'svn diff' to display local modifications in a working copy.

  2. Display the changes made to TARGETs as they are seen in REV between
     two revisions.  TARGETs may be all working copy paths or all URLs.
     If TARGETs are working copy paths, N defaults to BASE and M to the
     working copy; if URLs, N must be specified and M defaults to HEAD.
     The '-c M' option is equivalent to '-r N:M' where N = M-1.
     Using '-c -M' does the reverse: '-r M:N' where N = M-1.

  3. Display the differences between OLD-TGT as it was seen in OLDREV and
     NEW-TGT as it was seen in NEWREV.  PATHs, if given, are relative to
     OLD-TGT and NEW-TGT and restrict the output to differences for those
     paths.  OLD-TGT and NEW-TGT may be working copy paths or URL[@REV].
     NEW-TGT defaults to OLD-TGT if not specified.  -r N makes OLDREV default
     to N, -r N:M makes OLDREV default to N and NEWREV default to M.
     If OLDREV or NEWREV are not specified, they default to WORKING for
     working copy targets and to HEAD for URL targets.

     Either or both OLD-TGT and NEW-TGT may also be paths to unversioned
     targets. Revisions cannot be specified for unversioned targets.
     Both targets must be of the same node kind (file or directory).
     Diffing unversioned targets against URL targets is not supported.

  4. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]'
  5. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-PATH[@NEWREV]'
  6. Shorthand for 'svn diff --old=OLD-PATH[@OLDREV] --new=NEW-URL[@NEWREV]'

有效选项:
  -r [--revision] ARG      : ARG (一些命令也接受ARG1:ARG2范围)
                             版本参数可以是如下之一:
                                NUMBER       版本号
                                '{' DATE '}' 在指定时间以后的版本
                                'HEAD'       版本库中的最新版本
                                'BASE'       工作副本的基线版本
                                'COMMITTED'  最后提交或基线之前
                                'PREV'       COMMITTED的前一版本
  -c [--change] ARG        : 版本 ARG (如同 -r ARG-1:ARG) 做的修改
                             如果 ARG 为负数则等价于 -r ARG:ARG-1                             如果 ARG 的格式是 ARG1-ARG2,那么它等价于
                             ARG1:ARG2,包含 ARG1
  --old ARG                : 使用 ARG 作为旧目标
  --new ARG                : 使用 ARG 作为新目标
  -N [--non-recursive]     : 过时;尝试 --depth=files 或 --depth=immediates
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  --diff-cmd ARG           : 使用 ARG 作为比较命令
  --internal-diff          : 覆盖配置文件中指定的 diff-cmd
  -x [--extensions] ARG    : Specify differencing options for external diff or
                             internal diff or blame. Default: '-u'. Options are
                             separated by spaces. Internal diff and blame take:
                               -u, --unified: Show 3 lines of unified context
                               -b, --ignore-space-change: Ignore changes in
                                 amount of white space
                               -w, --ignore-all-space: Ignore all white space
                               --ignore-eol-style: Ignore changes in EOL style
                               -U ARG, --context ARG: Show ARG lines of context
                               -p, --show-c-function: Show C function name
  --no-diff-added          : 不要输出增加文件造成的差异
  --no-diff-deleted        : 不要输出删除文件造成的差异
  --ignore-properties      : 操作时忽略属性
  --properties-only        : 操作时只显示属性
  --show-copies-as-adds    : 请不要将复制或移动的文件与其源文件比较
  --notice-ancestry        : diff unrelated nodes as delete and add
  --summarize              : 显示结果的概要
  --changelist [--cl] ARG  : 只能对修改列表 ARG 的成员操作
  --force                  : 强制操作运行
  --xml                    : 输出为 XML
  --git                    : 使用 git 的扩展差异格式
  --patch-compatible       : generate diff suitable for generic third-party
                             patch tools; currently the same as
                             --show-copies-as-adds --ignore-properties
10、在工作副本或存储库中复制文件和目录
:~# svn help copy
copy (cp): 在工作副本或存储库中复制文件和目录。
usage: copy SRC[@REV]... DST

  SRC and DST can each be either a working copy (WC) path or URL:
    WC  -> WC:   copy and schedule for addition (with history)
    WC  -> URL:  immediately commit a copy of WC to URL
    URL -> WC:   check out URL into WC, schedule for addition
    URL -> URL:  complete server-side copy;  used to branch and tag
  All the SRCs must be of the same type. When copying multiple sources,
  they will be added as children of DST, which must be a directory.

  WARNING: For compatibility with previous versions of Subversion,
  copies performed using two working copy paths (WC -> WC) will not
  contact the repository.  As such, they may not, by default, be able
  to propagate merge tracking information from the source of the copy
  to the destination.

有效选项:
  -r [--revision] ARG      : ARG (一些命令也接受ARG1:ARG2范围)
                             版本参数可以是如下之一:
                                NUMBER       版本号
                                '{' DATE '}' 在指定时间以后的版本
                                'HEAD'       版本库中的最新版本
                                'BASE'       工作副本的基线版本
                                'COMMITTED'  最后提交或基线之前
                                'PREV'       COMMITTED的前一版本
  -q [--quiet]             : 不打印信息,或只打印概要信息
  --ignore-externals       : 忽略外部项目
  --parents                : 创建中间目录
  -m [--message] ARG       : 指定日志信息ARG
  -F [--file] ARG          : 从文件ARG读取日志信息
  --force-log              : 强制校验日志信息资源
  --editor-cmd ARG         : 使用 ARG 作为外部编辑器
  --encoding ARG           : 将ARG的值视为字符编码
  --with-revprop ARG       : 在新版本设置版本属性 ARG
                使用格式 name[=value]
  --pin-externals          : pin externals with no explicit revision to their
                             current revision (recommended when tagging)
11、清理
~# svn help cleanup
cleanup: 递归地清理工作副本,删除写锁,恢复未完成的操作等。
usage: cleanup [WCPATH...]

  By default, finish any unfinished business in the working copy at WCPATH,
  and remove write locks (shown as 'L' by the 'svn status' command) from
  the working copy. Usually, this is only necessary if a Subversion client
  has crashed while using the working copy, leaving it in an unusable state.

  WARNING: There is no mechanism that will protect write locks still
           being used by other Subversion clients. Running this command
           while another client is using the working copy can corrupt
           the working copy beyond repair!

  If the --remove-unversioned option or the --remove-ignored option
  is given, remove any unversioned or ignored items within WCPATH.
  To prevent accidental working copy corruption, unversioned or ignored
  items can only be removed if the working copy is not already locked
  for writing by another Subversion client.
  Note that the 'svn status' command shows unversioned items as '?',
  and ignored items as 'I' if the --no-ignore option is given to it.

有效选项:
  --diff3-cmd ARG          : 使用 ARG 作为合并命令
  --remove-unversioned     : remove unversioned items
  --remove-ignored         : remove ignored items
  --include-externals      : also operate on externals defined by
                             svn:externals properties
  -q [--quiet]             : 不打印信息,或只打印概要信息

12、导出一个无版本控制的副本
~# svn help export
export: 产生一个无版本控制的目录树副本。
用法: 1、export [-r REV] URL[@PEGREV] [PATH]
      2、export [-r REV] PATH1[@PEGREV] [PATH2]

  1、从 URL 指定的版本库,导出一个干净的目录树到 PATH。如果有指定
     REV 的话,内容即为该版本的,否则就是 HEAD 版本。如果 PATH
     被省略的话,URL的最后部分会被用来当成本地的目录名称。

  2、在工作副本中,从指定的 PATH1 导出一个干净的目录树到 PATH2。如果
     有指定 REV 的话,会从指定的版本导出,否则从工作副本导出。如果
     PATH2 被省略的话,PATH1 的最后部分会被用来当成本地的目录名称。
     如果没有指定 REV 的话,所有的本地修改都保留,但是未纳入版本控制
     的文件不会被复制。

     如果指定了 PEGREV ,将从指定的版本本开始查找。

有效选项:
  -r [--revision] ARG      : ARG (一些命令也接受ARG1:ARG2范围)
                             版本参数可以是如下之一:
                                NUMBER       版本号
                                '{' DATE '}' 在指定时间以后的版本
                                'HEAD'       版本库中的最新版本
                                'BASE'       工作副本的基线版本
                                'COMMITTED'  最后提交或基线之前
                                'PREV'       COMMITTED的前一版本
  -q [--quiet]             : 不打印信息,或只打印概要信息
  -N [--non-recursive]     : 过时;尝试 --depth=files 或 --depth=immediates
  --depth ARG              : 限制操作深度是 ARG ('empty', 'files',
                             'immediates','infinity')
  --force                  : 强制操作运行
  --native-eol ARG         : 使用非标准的 EOL 标记
                系统中立的文件标记 svn:eol-style 属性取值为 “native”。
                ARG 可以是以下之一“LF”,“CR”,“CRLF”
  --ignore-externals       : 忽略外部项目
  --ignore-keywords        : 不要展开关键字
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

郭老二

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值