目录
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.
To use the command-line client, type svn, the subcommand you wish to use, and [54] 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 章 基本使用发现更多使用客户端命令的例子,以及“属性”一节中的管理属性的命令。
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.
--accept
ACTION
Specify action for automatic conflict resolution.
Possible actions are (postpone
,
base
, mine-full
,
theirs-full
, edit
, and
launch.
--auto-props
开启auto-props,覆盖config
文件中的enable-auto-props
指示。
--change
(-c
) ARG
作为引用特定“修改”(也叫做修订版本)的方法,这个选项是“-r ARG-1:ARG”语法上的甜头。
--changelist
ARG
Operate only on members of the changelist named
ARG
. This option can be used
multiple times to specify sets of changelists.
--cl
ARG
This is an alias for the
--changelist
option.
--config-dir
DIR
指导Subversion从指定目录而不是默认位置(用户主目录的.subversion
)读取配置信息。
--depth
ARG
Limit the scope of an operation to a particular tree
depth. ARG
is one of
empty
, files
,
immediates
, or
infinity
.
--diff-cmd
CMD
指定用来表示文件区别的外部程序,当svn diff调用时,会使用Subversion的内置区别引擎,默认会提供统一区别输出,如果你希望使用一个外置区别程序,使用--diff-cmd
。你可以通过--extensions
(本小节后面有更多介绍)把选项传递到区别程序。
--diff3-cmd
CMD
指定一个外置程序用来合并文件。
--dry-run
检验运行一个命令的效果,但没有实际的修改—可以用在磁盘和版本库。
--editor-cmd
CMD
指定一个外部程序来编辑日志信息或是属性值。如何设定缺省编辑器见“配置”一节的editor-cmd
小节。
--encoding
ENC
告诉Subversion你的提交日志信息是通过提供的字符集编码的,缺省时是你的操作系统的本地编码,如果你的提交信息使用其它编码,你一定要指定这个值。
--extensions
(-x
) ARGS
指定一个或多个Subversion传递给提供文件区别的外部区别程序的参数,如果你要传递多个参数,你一定能够要用引号(例如,svn diff --diff-cmd /usr/bin/diff -x "-b -E")括起所有的参数。这个选项只有在使用--diff-cmd
选项时使用。
--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
) or
-?
)
If used with one or more subcommands, shows the built-in help text for each. If used alone, it displays the general client help text.
--ignore-ancestry
告诉Subversion在计算区别(只依赖于路径内容)时忽略祖先。
--ignore-externals
告诉Subversion忽略外部定义和外部定义管理的工作拷贝。
--incremental
打印适合串联的输出格式。
--keep-changelist
Don't delete the changelist after commit.
--keep-local
Keep the local copy of a file or directory (used with the svn delete command).
--limit
NUM
只显示第一个NUM
日志信息。
--message
(-m
) MESSAGE
Indicates that you will specify 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
使用ARG
作为新的目标(结合svn diff使用)。
--no-auth-cache
Prevents caching of authentication information (e.g., username and password) in the Subversion administrative directories.
--no-auto-props
关闭auto-props,覆盖config
文件中的enable-auto-props
指示。
--no-diff-deleted
防止Subversion打印删除文件的区别信息,缺省的行为方式是当你删除了一个文件后运行svn diff打印的区别与删除文件所有的内容得到的结果一样。
--no-ignore
在状态列表中显示global-ignores
配置选项或者是svn:ignore
属性忽略的文件。见“配置”一节和“忽略未版本控制的条目”一节查看详情。
--no-unlock
不自动解锁文件(缺省的提交行为是解锁提交列出的所有文件),更多信息见“锁定”一节。
--non-interactive
In the case of an authentication failure or insufficient credentials, prevents prompting for credentials (e.g., username or password). This is useful if you're running Subversion inside of an automated script, and it's more appropriate to have Subversion fail than to prompt for more information.
--non-recursive
(-N
)Deprecated. Stops a subcommand from recursing into subdirectories. Most subcommands recurse by default, but some subcommands—usually those that have the potential to remove or undo your local modifications—do not.
--notice-ancestry
在计算区别时关注祖先。
--old
ARG
使用ARG
作为旧的目标(结合svn diff使用)。
--parents
Create and add nonexistent or nonversioned parent subdirectories to the working copy or repository as part of an operation. This is useful for automatically creating multiple subdirectories where none currently exist. If performed on a URL, all the directories will be created in a single commit.
--password
PASS
指出在命令行中提供你的密码—另外,如果它是需要的,Subversion会提示你输入。
--quiet
(-q
)请求客户端在执行操作时只显示重要信息。
--record-only
Mark revisions as merged (for use with
--revision
(-r
)
--recursive
(-R
)Deprecated. Makes a subcommand recurse into subdirectories. Most subcommands recurse by default.
--reintegrate
(-R
)Used with the svn merge subcommand, merges all of the source URL's changes into the working copy. See “Keeping a Branch in Sync”一节 for details.
--relocate
目的路径[PATH...]
svn switch子命令中使用,用来修改你的工作拷贝所引用的版本库位置。当版本库的位置修改了,而你有一个工作拷贝,希望继续使用时非常有用。见svn switch的例子。
--remove
ARG
Disassociate ARG
from a
changelist
--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, keywords, or dates (in curly braces) as arguments to the revision option. If you wish to offer 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
操作针对修订版本属性,而不是Subversion文件或目录的属性。这个选项需要你传递--revision
(-r
)参数。
--set-depth
ARG
Set the sticky depth on a directory in a working
copy to one of empty
,
files
, immediates
,
or infinity
.
--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
Causes a Subversion subcommand that traverses the history of a versioned resource to stop harvesting that historical information when a copy—that is, a location in history where that resource was copied from another location in the repository—is encountered.
--strict
Causes Subversion to use strict semantics, a notion that is rather vague unless talking about specific subcommands (namely, svn propget).
--targets
FILENAME
Tells Subversion to get the list of files that you wish to operate on from the filename that you provide instead of listing all the files on the command line.
--username
NAME
表示你要在命令行提供认证的用户名—否则如果需要,Subversion会提示你这一点。
--use-merge-history
(-g
)Use or display additional information from merge history.
--verbose
(-v
)请求客户端在运行子命令打印尽量多的信息,会导致Subversion打印额外的字段,每个文件的细节信息或者是关于动作的附加信息。
--version
打印客户端版本信息,这个信息不仅仅包括客户端的版本号,也有所有客户端可以用来访问Subversion版本库的版本库访问模块列表。
--with-all-revprops
Used with svn log --xml, this option will retrieve and display all revision properties in the log output.
--with-revprop
ARG
When used with any command that writes to the
repository, this sets the revision property, using the
NAME=VALUE
format,
NAME
to
VALUE
. When used with
svn log --xml, this displays the value of
ARG
in the log output.
--xml
使用XML格式打印输出。
[54] Well, you don't need a subcommand to use the
--version
option, but we'll get to that in
just a minute.