svn status

名称

svn status (stat, st) — 打印工作副本文件和目录的状态。

概要

svn status [PATH…]

描述

Print the status of working copy files and directories. With no arguments, it prints only locally modified items (no repository access). With –show-updates (-u), it adds working revision and server out-of-date information. With –verbose (-v), it prints full revision information on every item. With –quiet (-q), it prints only summary information about locally modified items.

The first seven columns in the output are each one character wide, and each column gives you information about a different aspect of each working copy item.

第一列指出一个项目的是添加, 删除还是其它的修改:

‘ ‘
没有修改。

‘A’
预定要添加的项目。

‘D’
预定要删除的项目。

‘M’
项目已经修改了。

‘R’
Item has been replaced in your working copy. This means the file was scheduled for deletion, and then a new file with the same name was scheduled for addition in its place.

‘C’
项目的内容(相对于属性)与更新得到的数据冲突了。

‘X’
项目与外部定义相关。

‘I’
项目被忽略(例如使用svn:ignore属性)。

‘?’
项目不在版本控制之下。

‘!’
Item is missing (e.g., you moved or deleted it without using svn). This also indicates that a directory is incomplete (a checkout or update was interrupted).

‘~’
Item is versioned as one kind of object (file, directory, link), but has been replaced by a different kind of object.

The second column tells the status of a file’s or directory’s properties:

‘ ‘
没有修改。

‘M’
这个项目的属性已经修改。

‘C’
这个项目的属性与从版本库得到的更新有冲突。

The third column is populated only if the working copy directory is locked (see 第 6 节 “有时你只需要清理”):

‘ ‘
项目没有锁定。

‘L’
项目已经锁定。

The fourth column is populated only if the item is scheduled for addition-with-history:

‘ ‘
没有历史预定要提交。

‘+’
历史预定要伴随提交。

The fifth column is populated only if the item is switched relative to its parent (see 第 5 节 “使用分支”):

‘ ‘
项目是它的父目录的孩子。

‘S’
项目已经转换。

The sixth column is populated with lock information:

‘ ‘
When –show-updates (-u) is used, the file is not locked. If –show-updates (-u) is not used, this merely means that the file is not locked in this working copy.

K
文件锁定在工作副本。

O
File is locked either by another user or in another working copy. This appears only when –show-updates (-u) is used.

T
File was locked in this working copy, but the lock has been “stolen” and is invalid. The file is currently locked in the repository. This appears only when –show-updates (-u) is used.

B
File was locked in this working copy, but the lock has been “broken” and is invalid. The file is no longer locked. This appears only when –show-updates (-u) is used.

The seventh column is populated only if the item is the victim of a tree conflict:

‘ ‘
项目不是树冲突的受害者。

‘C’
项目是树冲突的受害者

第八列始终为空。

The out-of-date information appears in the ninth column (only if you pass the –show-updates (-u) option):

‘ ‘
这个项目在工作副本是最新的。

‘*‘
在服务器这个项目有了新的修订版本。

The remaining fields are variable width and delimited by spaces. The working revision is the next field if the –show-updates (-u) or –verbose (-v) option is passed.

If the –verbose (-v) option is passed, the last committed revision and last committed author are displayed next.

工作副本路径永远是最后一个字段,所以它可以包括空格。

选项

–changelist ARG
–depth ARG
–ignore-externals
–incremental
–no-ignore
–quiet (-q)
–show-updates (-u)
–verbose (-v)
–xml
例子

这是查看你在工作副本所做的修改的最简单的方法。

$ svn status wc
M wc/bar.c
A + wc/qax.c
If you want to find out what files in your working copy are out of date, pass the –show-updates (-u) option (this will not make any changes to your working copy). Here you can see that wc/foo.c has changed in the repository since we last updated our working copy:

$ svn status -u wc
M 965 wc/bar.c

*     965    wc/foo.c

A + 965 wc/qax.c
Status against revision: 981
[注意] 注意
–show-updates (-u) only places an asterisk next to items that are out of date (i.e., items that will be updated from the repository if you later use svn update). –show-updates (-u) does not cause the status listing to reflect the repository’s version of the item (although you can see the revision number in the repository by passing the –verbose (-v) option).

The most information you can get out of the status subcommand is as follows:

$ svn status -u -v wc
M 965 938 sally wc/bar.c

*     965       922 harry        wc/foo.c

A + 965 687 harry wc/qax.c
965 687 harry wc/zig.c
Status against revision: 981
Lastly, you can get svn status output in XML format with the –xml option:

$ svn status –xml wc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?xml version="1.0"?>
<status>
<target
path="wc">
<entry
path="qax.c">
<wc-status
props="none"
item="added"
revision="0">
</wc-status>
</entry>
<entry
path="bar.c">
<wc-status
props="normal"
item="modified"
revision="965">
<commit
revision="965">
<author>sally</author>
<date>2008-05-28T06:35:53.048870Z</date>
</commit>
</wc-status>
</entry>
</target>
</status>