svn is the official command-line client of Subversion. It offers no small number of subcommands and options. Subcommands and other non-option arguments must appear in a specified order on the command line used to invoke svn. Options, on the other hand, may appear anywhere on the command line (after the program name, of course), and in general, their order is irrelevant. For example, all of the following are valid ways to use svn status, and are interpreted in exactly the same way:
$ svn -vq status myfile $ svn status -v -q myfile $ svn -q status -v myfile $ svn status -vq myfile $ svn status myfile -qv
While Subversion has different options for its subcommands, all options
exist in a single namespace—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.
The svn command-line client usually exits quickly with an error if you pass it an option which does not apply to the specified subcommand. But as of Subversion 1.5, several of the options which apply to all—or nearly all—of the subcommands have been deemed acceptable by all subcommands, even if they have no effect on some of them. They appear grouped together in the command-line client's usage messages as global options. This was done to assist folks who write scripts which wrap the command-line client. These global options are as follows:
--config-dir
DIR
指导Subversion从指定目录而不是默认位置(用户主目录的.subversion
)读取配置信息。
--config-option
FILE
:SECTION
:OPTION
=[VALUE
]
Sets, for the duration of the command, the value of a runtime configuration
option. FILE
and
SECTION
are the runtime configuration file
(either config
or servers
) and the
section thereof, respectively, which contain the option whose value you wish
to change. OPTION
is, of course, the option
itself, and VALUE
the value (if any) you wish to
assign to the option. For example, to temporarily disable the use of the
automatic property setting feature, use
--config-option=config:miscellany:enable-auto-props=no
.
You can use this option multiple times to change multiple option values
simultaneously.
--no-auth-cache
Prevents caching of authentication information (e.g., username and password) in the Subversion runtime configuration directories.
--non-interactive
Disables all interactive prompting. Some examples of interactive prompting include requests for authentication credentials and conflict resolution decisions. This is useful if you're running Subversion inside an automated script and it's more appropriate to have Subversion fail than to prompt for more information.
--password
PASSWD
Specifies the password to use when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.
--trust-server-cert
When used with --non-interactive
, instructs Subversion to
accept SSL server certificates issued by unknown certificate authorities
without first prompting the user. For security's sake, you should use this
option only when the integrity of the remote server and the network path
between it and your client is known to be trustworthy.
--username
NAME
Specifies the username to use when authenticating against a Subversion server. If not provided, or if incorrect, Subversion will prompt you for this information as needed.
The rest of the options apply and are accepted by only a subset of the subcommand. They are as follows:
--accept
ACTION
Specifies an 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
Used as a means to refer to a specific “change” (a.k.a. a revision). This option is syntactic sugar for “-r ARG-1:ARG”.
--changelist
ARG
Instructs Subversion to operate only on members of the changelist named
ARG
. You can use this option multiple times to
specify sets of changelists.
--cl
ARG
选项 --changelist
的别名。
--depth
ARG
Instructs Subversion to limit the scope of an operation to a particular tree
depth. ARG
is one of empty
(only the target itself), files
(the target and any
immediate file children thereof), immediates
(the target
and any immediate children thereof), or infinity
(the
target and all of its descendants—full recursion).
--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
(-x
) option (more on
that later in this section).
--diff3-cmd
CMD
指定一个外置程序用来合并文件。
--dry-run
Goes through all the motions of running a command, but makes no actual changes—either on disk or in the repository.
--editor-cmd
CMD
Specifies an external program to use to edit a log message or a property
value. See the editor-cmd
section in 第 1.3.2 节 “配置” for ways to specify a default
editor.
--encoding
ENC
Tells Subversion that your commit message is encoded in the charset provided. The default is your operating system's native locale, and you should specify the encoding if your commit message is in any other encoding.
--extensions
(-x
)
ARG
Specifies customizations which Subversion should make when performing difference calculations. Valid extensions include:
--ignore-space-change
(-b
)
Ignore changes in the amount of white space.
--ignore-all-space
(-w
)
Ignore all white space.
--ignore-eol-style
Ignore changes in EOL (end-of-line) style.
--show-c-function
(-p
)
Show C function names in the diff output.
--unified
(-u
)
Show three lines of unified diff context.
The default value of ARG
is
-u
. If you wish to pass multiple arguments, you must
enclose all of them in quotes.
Note that when Subversion is configured to invoke an external diff command,
the value of the --extension
(-x
) option
isn't restricted to the previously mentioned options, but may be
any additional arguments which Subversion should pass
to that command.
--file
(-F
)
FILENAME
Uses the contents of the named file for the specified subcommand, though different subcommands do different things with this content. For example, svn commit uses the content as a commit log, whereas svn propset uses it as a property value.
--force
Forces a particular command or operation to run. Subversion will prevent you from performing some operations 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
Forces a suspicious parameter passed to the --message
(-m
) or --file
(-F
)
option to be accepted as valid. By default, Subversion will produce an
error if parameters to these options look like they might instead be targets
of the subcommand. For example, if you pass a versioned file's path to the
--file
(-F
) option, Subversion will assume
you've made a mistake, that the path was instead intended as the target of
the operation, and that you simply failed to provide some
other—unversioned—file as the source of your log message. To
assert your intent and override these types of errors, pass the
--force-log
option to subcommands that accept log messages.
--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
Tells Subversion to ignore externals definitions and the external working copies managed by them.
--incremental
打印适合串联的输出格式。
--keep-changelists
告诉 Subversion 在提交后不要删除修改集。
--keep-local
保留文件或目录的版本版本 (用于命令 svn delete)。
--limit
(-l
)
NUM
Shows only the first NUM
log messages.
--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."
--native-eol
ARG
Causes svn export to use a specific end-of-line sequence
as if it was the native sequence for the client platform.
ARG
may be one of CR
,
LF
, or CRLF
.
--new
ARG
使用ARG
作为新的目标(结合svn diff使用)。
--no-auto-props
关闭auto-props,覆盖config
文件中的enable-auto-props
指示。
--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 第 1.3.2 节 “配置” and 第 5 节 “忽略未版本控制的条目” for more information.
--no-unlock
Tells Subversion not to automatically unlock files (the default commit behavior is to unlock all files listed as part of the commit). See 第 8 节 “锁定” for more information.
--non-recursive
(-N
)
Deprecated. Stops a subcommand from recursing into
subdirectories. Most subcommands recurse by default, but some do not.
Users should avoid this option and use the more precise
--depth
option instead. For most subcommands, specifying
--non-recursive
produces behavior which is the same as if
you'd specified --depth=files
, but there are exceptions:
non-recursive svn status operates at the
immediates
depth, and the non-recursive forms of
svn revert, svn add, and svn
commit operate at an empty
depth.
--notice-ancestry
在计算差异时关注祖先。
--old
ARG
使用ARG
作为旧的目标(结合svn diff使用)。
--parents
Creates and adds 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.
--quiet
(-q
)
请求客户端在执行操作时只显示重要信息。
--record-only
Marks revisions as merged, for use with --revision
(-r
).
--recursive
(-R
)
让子命令递归子目录,大多数子命令缺省是递归的。
--reintegrate
Used with the svn merge subcommand, merges all of the source URL's changes into the working copy. See 第 3.2 节 “保持分支同步” for details.
--relocate
FROM TO [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 (sw) for more details and an example.
--remove
ARG
从变更列表 ARG
清除
--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}
见第 1.1 节 “修订版本关键字”查看更多信息。
--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.
--set-depth
ARG
Sets the sticky depth on a directory in a working copy to one of
exclude
, empty
,
files
, immediates
, or
infinity
. For detailed coverage of what these mean and
how to use this option, see 第 7 节 “稀疏目录”.
--show-revs
ARG
Used to make svn mergeinfo display either
merged
or eligible
revisions.
--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 then use 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
导致Subversion使用严格的语法,就是明确使用特定而不是含糊的子命令(也就是,svn propget)。
--summarize
Display only high-level summary notifications about the operation instead of its detailed output.
--targets
FILENAME
Tells Subversion to read additional target paths for the operation from
FILENAME
. FILENAME
should contain one path per line, with each path expected to use the same
encoding and formatting that it would if you had specified it directly as an
argument on the command line.
--use-merge-history
(-g
)
从合并历史使用或显示额外的信息。
--verbose
(-v
)
Requests that the client print out as much information as it can while running any subcommand. This may result in Subversion printing out additional fields, detailed information about every file, or additional information regarding its actions.
--version
Prints the client version info. This information includes not only the
version number of the client, but also a listing of all repository access
modules that the client can use to access a Subversion repository. With
--quiet
(-q
) it prints only the version
number in a compact form.
--with-all-revprops
Used with the --xml
option to svn log,
instructs Subversion to retrieve and display all revision
properties—the standard ones used internally by Subversion as well as
any user-defined ones—in the log output.
--with-no-revprops
Used with the --xml
option to svn log,
instructs Subversion to omit all revision properties—including the
standard log message, author, and revision datestamp—from the log
output.
--with-revprop
ARG
When used with any command that writes to the repository, sets the revision
property, using the NAME=VALUE
format,
NAME
to VALUE
. When
used with svn log in --xml
mode, this
displays the value of ARG
in the log output.
--xml
使用XML格式打印输出。
Here are the various subcommands for the svn program. For the sake of brevity, we omit the global options (described in 第 1.1 节 “svn 选项”) from the subcommand descriptions which follow.