名称

svn update (up) — 更新你的工作副本。

概要

svn update [PATH...]

描述

svn update brings changes from the repository into your working copy. If no revision is given, it brings your working copy up to date with the HEAD revision. Otherwise, it synchronizes the working copy to the revision given by the --revision (-r) option. As part of the synchronization, svn update also removes any stale locks (see 第 6 节 “有时你只需要清理”) found in the working copy.

For each updated item, it prints a line that starts with a character reporting the action taken. These characters have the following meaning:

A

添加

B

损坏的锁 (仅第三列)

D

删除

U

更新

C

冲突

G

合并

E

已经存在

A character in the first column signifies an update to the actual file, whereas updates to the file's properties are shown in the second column. Lock information is printed in the third column.

As with most subcommands, you can limit the scope of the update operation to a particular tree depth using the --depth option. Alternatively, you can use the --set-depth option to set a new sticky working copy depth on the update target.

选项

--accept ACTION
--changelist
--depth ARG
--diff3-cmd CMD
--editor-cmd CMD
--force
--ignore-externals
--quiet (-q)
--revision (-r) REV
--set-depth ARG

例子

获取你上次更新之后版本库的修改:

$ svn update
A    newdir/toggle.c
A    newdir/disclose.c
A    newdir/launch.c
D    newdir/README
Updated to revision 32.

你也可以将工作副本更新到旧的修订版本(Subversion没有CVS的sticky文件的概念;见附录 B, CVS 用户的 Subversion 指南):

$ svn update -r30
A    newdir/README
D    newdir/toggle.c
D    newdir/disclose.c
D    newdir/launch.c
U    foo.c
Updated to revision 30.
[提示] 提示

If you want to examine an older revision of a single file, you may want to use svn cat instead—it won't change your working copy.

svn update is also the primary mechanism used to configure sparse working copies. When used with the --set-depth, the update operation will omit or reenlist individual working copy members by modifying their recorded ambient depth to the depth you specify (fetching information from the repository as necessary). See 第 7 节 “稀疏目录” for more about sparse directories.