Subversion 完全参考

目录

The Subversion Command Line Client: svn
svn Options
svn Subcommands
svnadmin
svnadmin Options
svnadmin Subcommands
svnlook
svnlook Options
svnlook Subcommands
svnsync
svnsync Options
svnsync Subcommands
svnserve
svnserve Options
svnversion
mod_dav_svn
Subversion 属性
版本控制的属性
未版本控制的属性
版本库钩子

This chapter is intended to be a complete reference to using Subversion. This includes the command line client (svn) and all its subcommands, as well as the repository administration programs (svnadmin and svnlook) and their respective subcommands.

The Subversion Command Line Client: svn

To use the command line client, you type svn, the subcommand you wish to use [55], and any options or targets that you wish to operate on—there is no specific order that the subcommand and the options must appear in. For example, all of the following are valid ways to use svn status:

$ svn -v status
$ svn status -v 
$ svn status -v myfile

你可以在第 2 章 基本使用发现更多使用客户端命令的例子,以及“属性”一节中的管理属性的命令。

svn Options

While Subversion has different options for its subcommands, all options are global—that is, each option is guaranteed to mean the same thing regardless of the subcommand you use it with. For example, --verbose (-v) always means “verbose output”, regardless of the subcommand you use it with.

--auto-props

Enables auto-props, overriding the enable-auto-props directive in the config file.

--change (-c) ARG

作为引用特定“修改”(也叫做修订版本)的方法,这个选项是“-r ARG-1:ARG”语法上的甜头。

--config-dir DIR

Instructs Subversion to read configuration information from the specified directory instead of the default location (.subversion in the user's home directory).

--diff-cmd CMD

Specifies an external program to use to show differences between files. When svn diff is invoked without this option, it uses Subversion's internal diff engine, which provides unified diffs by default. If you want to use an external diff program, use --diff-cmd. You can pass options to the diff program with the --extensions option (more on that later in this section).

--diff3-cmd CMD

指定一个外置程序用来合并文件。

--dry-run

检验运行一个命令的效果,但没有实际的修改—可以用在磁盘和版本库。

--editor-cmd CMD

Specifies an external program to use to edit a log message or a property value. See the editor-cmd section in “配置”一节 for ways to specify a default editor.

--encoding ENC

告诉Subversion你的提交日志信息是通过提供的字符集编码的,缺省时是你的操作系统的本地编码,如果你的提交信息使用其它编码,你一定要指定这个值。

--extensions (-x) ARGS

Specifies an argument or arguments that Subversion should pass to an external diff command. This option is valid only when used with the svn diff or svn merge commands, with the --diff-cmd option. If you wish to pass multiple arguments, you must enclose all of them in quotes (for example, svn diff --diff-cmd /usr/bin/diff -x "-b -E").

--file (-F) FILENAME

为特定子命令使用命名文件的的内容,尽管不同的子命令对这些内容做不同的事情。例如,svn commit使用内容作为提交日志,而svn propset使用它作为属性值。

--force

Forces a particular command or operation to run. There are some operations that Subversion will prevent you from doing in normal usage, but you can pass the force option to tell Subversion “I know what I'm doing as well as the possible repercussions of doing it, so let me at 'em”. This option is the programmatic equivalent of doing your own electrical work with the power on—if you don't know what you're doing, you're likely to get a nasty shock.

--force-log

将传递给--message-m)或者--file-F)的可疑参数指定为有效可接受。缺省情况下,如果选项的参数看起来会成为子命令的目标,Subversion会提出一个错误,例如,你传递一个版本化的文件路径给--file-F)选项,Subversion会认为出了点错误,认为你将目标对象当成了参数,而你并没有提供其它的—未版本化的文件作为日志信息的文件。为了确认你的意图并且不考虑这类错误,传递--force-log选项给命令来接受它作为日志信息。

--help (-h-?)

如果同一个或多个子命令一起使用,会显示每个子命令内置的帮助文本,如果单独使用,它会显示常规的客户端帮助文本。

--ignore-ancestry

告诉Subversion在计算区别(只依赖于路径内容)时忽略祖先。

--ignore-externals

告诉Subversion忽略外部定义和外部定义管理的工作拷贝。

--incremental

打印适合串联的输出格式。

--limit NUM

只显示第一个NUM日志信息。

--message (-m) MESSAGE

Indicates that you will specify a either a log message or a lock comment on the command line, following this option. For example:

$ svn commit -m "They don't make Sunday."
--new ARG

Uses ARG as the newer target (for use with svn diff).

--no-auth-cache

阻止在Subversion管理区缓存认证信息(如用户名密码)。

--no-auto-props

Disables auto-props, overriding the enable-auto-props directive in the config file.

--no-diff-added

Prevents Subversion from printing differences for added files. The default behavior when you add a file is for svn diff to print the same differences that you would see if you had added the entire contents of an existing (empty) file.

--no-diff-deleted

Prevents Subversion from printing differences for deleted files. The default behavior when you remove a file is for svn diff to print the same differences that you would see if you had left the file but removed all the content.

--no-ignore

Shows files in the status listing that would normally be omitted since they match a pattern in the global-ignores configuration option or the svn:ignore property. See “配置”一节 and “忽略未版本控制的条目”一节 for more information.

--no-unlock

不自动解锁文件(缺省的提交行为是解锁提交列出的所有文件),更多信息见“锁定”一节

--non-interactive

如果认证失败,或者是不充分的凭证时,防止出现要求凭证的提示(例如用户名和密码)。这在运行自动脚本时非常有用,只是让Subversion失败而不是提示更多的信息。

--non-recursive (-N)

防止子命令迭代到子目录,大多数子命令缺省是迭代的,但是一些子命令—通常是那些潜在的删除或者是取消本地修改的命令—不是。

--notice-ancestry

在计算区别时关注祖先。

--old ARG

Uses ARG as the older target (for use with svn diff).

--password PASS

指出在命令行中提供你的密码—另外,如果它是需要的,Subversion会提示你输入。

--quiet (-q)

请求客户端在执行操作时只显示重要信息。

--recursive (-R)

让子命令迭代到子目录,大多数子命令缺省是迭代的。

--relocate 目的路径[PATH...]

Used with the svn switch subcommand, changes the location of the repository that your working copy references. This is useful if the location of your repository changes and you have an existing working copy that you'd like to continue to use. See svn switch for an example.

--revision (-r) REV

Indicates that you're going to supply a revision (or range of revisions) for a particular operation. You can provide revision numbers, revision keywords or dates (in curly braces), as arguments to the revision option. If you wish to provide a range of revisions, you can provide two revisions separated by a colon. For example:

$ svn log -r 1729
$ svn log -r 1729:HEAD
$ svn log -r 1729:1744
$ svn log -r {2001-12-04}:{2002-02-17}
$ svn log -r 1729:{2002-02-17}

“修订版本关键字”一节查看更多信息。

--revprop

Operates on a revision property instead of a property specific to a file or directory. This option requires that you also pass a revision with the --revision (-r) option.

--show-updates (-u)

Causes the client to display information about which files in your working copy are out-of-date. This doesn't actually update any of your files—it just shows you which files will be updated if you run svn update.

--stop-on-copy

导致Subversion子命令在传递历史时会在版本化资源拷贝时停止收集历史信息—也就是历史中资源从另一个位置拷贝过来时。

--strict

Causes Subversion to use strict semantics, a notion which is rather vague unless talking about specific subcommands (namely, svn propget).

--targets FILENAME

告诉Subversion从你提供的文件中得到希望操作的文件列表,而不是在命令行列出所有的文件。

--username NAME

表示你要在命令行提供认证的用户名—否则如果需要,Subversion会提示你这一点。

--verbose (-v)

请求客户端在运行子命令打印尽量多的信息,会导致Subversion打印额外的字段,每个文件的细节信息或者是关于动作的附加信息。

--version

打印客户端版本信息,这个信息不仅仅包括客户端的版本号,也有所有客户端可以用来访问Subversion版本库的版本库访问模块列表。

--xml

使用XML格式打印输出。

svn Subcommands

下面是一些子命令:



[55] Yes, yes, you don't need a subcommand to use the --version option, but we'll get to that in just a minute.