区分状态和更新

Subversion attempts to erase a lot of the confusion between the cvs status and cvs update commands.

The cvs status command has two purposes: first, to show the user any local modifications in the working copy, and second, to show the user which files are out of date. Unfortunately, because of CVS's hard-to-read status output, many CVS users don't take advantage of this command at all. Instead, they've developed a habit of running cvs update or cvs -n update to quickly see their changes. If users forget to use the -n option, this has the side effect of merging repository changes they may not be ready to deal with.

Subversion removes this muddle by making the output of svn status easy to read for both humans and parsers. Also, svn update prints only information about files that are updated, not local modifications.

状态

svn status打印所有本地修改的文件,缺省情况下,不会联系版本库,然而这个命令接受一些选项,如下是一些最常用的:

-u

访问版本库检测并显示过期的信息。

-v

显示所有版本控制下的文件。

-N

Run nonrecursively (do not descend into subdirectories).

status命令有两种输出格式,缺省是“”格式,本地修改像这样:

$ svn status
M      foo.c
M      bar/baz.c

如果你指定--show-updates(-u)选项,就会使用较长的格式输出:

$ svn status -u
M            1047   foo.c
       *     1045   faces.html
       *            bloo.png
M            1050   bar/baz.c
Status against revision:   1066

In this case, two new columns appear. The second column contains an asterisk if the file or directory is out of date. The third column shows the working copy's revision number of the item. In the previous example, the asterisk indicates that faces.html would be patched if we updated, and that bloo.png is a newly added file in the repository. (The absence of any revision number next to bloo.png means that it doesn't yet exist in the working copy.)

此刻,你必须赶快看一下svn status中所说的可能属性代码,下面是一些你会看到的常用状态代码:

A    Resource is scheduled for Addition
D    Resource is scheduled for Deletion
M    Resource has local Modifications
C    Resource has Conflicts (changes have not been completely merged
       between the repository and working copy version)
X    Resource is eXternal to this working copy (may come from another
       repository).  See “外部定义”一节
?    Resource is not under version control
!    Resource is missing or incomplete (removed by another tool than
       Subversion)

关于svn status的详细讨论,见“查看你的修改概况”一节

更新

svn update updates your working copy, and prints only information about files that it updates.

Subversion has combined CVS's P and U codes into just U. When a merge or conflict occurs, Subversion simply prints G or C, rather than a whole sentence about it.

关于svn update的详细讨论,见“更新你的工作拷贝”一节