附录 B. Quick reference to CVS commands

This appendix describes how to invoke cvs, with references to where each command or feature is described in detail. For other references run the cvs -help command, or see Index.

A cvs command looks like:

cvs [ global_options ] command [ command_options ] [ command_args ]

Global options:

-allow-root=rootdir

Specify legal cvsroot directory (server only) (not in cvs 1.9 and older). See 在服务器端设置密码认证 在 第 2 章.

-a

Authenticate all communication (client only) (not in cvs 1.9 and older). See 全局选项 在 附录 A.

-b

Specify RCS location (cvs 1.9 and older). See 全局选项 在 附录 A.

-d root

Specify the cvsroot. See 第 2 章.

-e editor

Edit messages with editor. See 提交修改 在 第 1 章.

-f

Do not read the ~/.cvsrc file. See 全局选项 在 附录 A.

-H, -help

Print a help message. See 全局选项 在 附录 A.

-l

Do not log in $CVSROOT/CVSROOT/history file. See 全局选项 在 附录 A.

-n

Do not change any files. See 全局选项 在 附录 A.

-Q

Be really quiet. See 全局选项 在 附录 A.

-q

Be somewhat quiet. See 全局选项 在 附录 A.

-r

Make new working files read-only. See 全局选项 在 附录 A.

-s variable=value

Set a user variable. See Expansions in administrative files 在 附录 C.

-T tempdir

Put temporary files in tempdir. See 全局选项 在 附录 A.

-t

Trace cvs execution. See 全局选项 在 附录 A.

-v, -version

Display version and copyright information for cvs.

-w

Make new working files read-write. See 全局选项 在 附录 A.

-x

Encrypt all communication (client only). See 全局选项 在 附录 A.

-z gzip-level

Set the compression level (client only). See 全局选项 在 附录 A.

Keyword expansion modes (替换模式 在 第 12 章):

-kkv  $Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp $
-kkvl $Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
-kk   $Id$
-kv   file1,v 1.1 1993/12/09 03:21:13 joe Exp
-ko   no expansion
-kb   no expansion, file is binary

Keywords (关键字列表 在 第 12 章):

$Author: joe $
$Date: 1993/12/09 03:21:13 $
$Header: /home/files/file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
$Id: file1,v 1.1 1993/12/09 03:21:13 joe Exp harry $
$Locker: harry $
$Name: snapshot_1_14 $
$RCSfile: file1,v $
$Revision: 1.1 $
$Source: /home/files/file1,v $
$State: Exp $
$Log: file1,v $
Revision 1.1  1993/12/09 03:30:17  joe
Initial revision

Commands, command options, and command arguments:

add [options] [files…]

Add a new file/directory. See 添加一个文件到源码库的一个目录 在 第 7 章.

-k kflag

Set keyword expansion.

-m msg

Set file description.

admin [options] [files…]

Administration of history files in the repository. See admin--Administration 在 附录 A.

-b[rev]

Set default branch. See 恢复到最新的发行版本 在 第 13 章.

-cstring

Set comment leader.

-ksubst

Set keyword substitution. See 第 12 章.

-l[rev]

Lock revision rev, or latest revision.

-mrev:msg

Replace the log message of revision rev with msg.

-orange

Delete revisions from the repository. See admin options 在 附录 A.

-q

Run quietly; do not print diagnostics.

-sstate[:rev]

Set the state.

-t

Set file description from standard input.

-tfile

Set file description from file.

-t-string

Set file description to string.

-u[rev]

Unlock revision rev, or latest revision.

annotate [options] [files…]

Show last revision where each line was modified. See Annotate命令 在 第 8 章.

-D date

Annotate the most recent revision no later than date. See 通用命令选项 在 附录 A.

-F

Force annotation of binary files. (Without this option, binary files are skipped with a message.)

-f

Use head revision if tag/date not found. See 通用命令选项 在 附录 A.

-l

Local; run only in current working directory. 第 6 章.

-R

Operate recursively (default). 第 6 章.

-r tag

Annotate revision tag. See 通用命令选项 在 附录 A.

checkout [options] modules

Get a copy of the sources. See checkout--Check out sources for editing 在 附录 A.

-A

Reset any sticky tags/date/options. See 粘性的标签(Sticky tags) 在 第 4 章 and 第 12 章.

-c

Output the module database. See checkout options 在 附录 A.

-D date

Check out revisions as of date (is sticky). See 通用命令选项 在 附录 A.

-d dir

Check out into dir. See checkout options 在 附录 A.

-f

Use head revision if tag/date not found. See 通用命令选项 在 附录 A.

-j rev

Merge in changes. See checkout options 在 附录 A.

-k kflag

Use kflag keyword expansion. See 替换模式 在 第 12 章.

-l

Local; run only in current working directory. 第 6 章.

-N

Don't "shorten" module paths if -d specified. See checkout options 在 附录 A.

-n

Do not run module program (if any). See checkout options 在 附录 A.

-P

Prune empty directories. See 移动和重命名目录 在 第 7 章.

-p

Check out files to standard output (avoids stickiness). See checkout options 在 附录 A.

-R

Operate recursively (default). 第 6 章.

-r tag

Checkout revision tag (is sticky). See 通用命令选项 在 附录 A.

-s

Like -c, but include module status. See checkout options 在 附录 A.

commit [options] [files…]

Check changes into the repository. See commit--Check files into the repository 在 附录 A.

-F file

Read log message from file. See commit options 在 附录 A.

-f

Force the file to be committed; disables recursion. See commit options 在 附录 A.

-l

Local; run only in current working directory. See 第 6 章.

-m msg

Use msg as log message. See commit options 在 附录 A.

-n

Do not run module program (if any). See commit options 在 附录 A.

-R

Operate recursively (default). 第 6 章.

-r rev

Commit to rev. See commit options 在 附录 A.

diff [options] [files…]

Show differences between revisions. See diff--Show differences between revisions 在 附录 A. In addition to the options shown below, accepts a wide variety of options to control output style, for example -c for context diffs.

-D date1

Diff revision for date against working file. See diff options 在 附录 A.

-D date2

Diff rev1/date1 against date2. See diff options 在 附录 A.

-l

Local; run only in current working directory. See 第 6 章.

-N

Include diffs for added and removed files. See diff options 在 附录 A.

-R

Operate recursively (default). 第 6 章.

-r rev1

Diff revision for rev1 against working file. See diff options 在 附录 A.

-r rev2

Diff rev1/date1 against rev2. See diff options 在 附录 A.

edit [options] [files…]

Get ready to edit a watched file. See 怎样编辑一个被观察的文件 在 第 10 章.

-a actions

Specify actions for temporary watch, where actions is edit, unedit, commit, all, or none. See 怎样编辑一个被观察的文件 在 第 10 章.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.

editors [options] [files…]

See who is editing a watched file. See 有关谁正在观察和编辑的信息 在 第 10 章.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.

export [options] modules

Export files from cvs. See export--Export sources from CVS, similar to checkout 在 附录 A.

-D date

Check out revisions as of date. See 通用命令选项 在 附录 A.

-d dir

Check out into dir. See export options 在 附录 A.

-f

Use head revision if tag/date not found. See 通用命令选项 在 附录 A.

-k kflag

Use kflag keyword expansion. See 替换模式 在 第 12 章.

-l

Local; run only in current working directory. 第 6 章.

-N

Don't "shorten" module paths if -d specified. See export options 在 附录 A.

-n

Do not run module program (if any). See export options 在 附录 A.

-P

Prune empty directories. See 移动和重命名目录 在 第 7 章.

-R

Operate recursively (default). 第 6 章.

-r tag

Checkout revision tag. See 通用命令选项 在 附录 A.

history [options] [files…]

Show repository access history. See history--Show status of files and users 在 附录 A.

-a

All users (default is self). See history options 在 附录 A.

-b str

Back to record with str in module/file/repos field. See history options 在 附录 A.

-c

Report on committed (modified) files. See history options 在 附录 A.

-D date

Since date. See history options 在 附录 A.

-e

Report on all record types. See history options 在 附录 A.

-l

Last modified (committed or modified report). See history options 在 附录 A.

-m module

Report on module (repeatable). See history options 在 附录 A.

-n module

In module. See history options 在 附录 A.

-o

Report on checked out modules. See history options 在 附录 A.

-p repository

In repository. See history options 在 附录 A.

-r rev

Since revision rev. See history options 在 附录 A.

-T

Produce report on all TAGs. See history options 在 附录 A.

-t tag

Since tag record placed in history file (by anyone). See history options 在 附录 A.

-u user

For user user (repeatable). See history options 在 附录 A.

-w

Working directory must match. See history options 在 附录 A.

-x types

Report on types, one or more of TOEFWUCGMAR. See history options 在 附录 A.

-z zone

Output for time zone zone. See history options 在 附录 A.

import [options] repository vendor-tag release-tags

Import files into cvs, using vendor branches. See import--Import sources into CVS, using vendor branches 在 附录 A.

-b bra

Import to vendor branch bra. See 多个vendor branches 在 第 13 章.

-d

Use the file's modification time as the time of import. See import options 在 附录 A.

-k kflag

Set default keyword substitution mode. See import options 在 附录 A.

-m msg

Use msg for log message. See import options 在 附录 A.

-I ign

More files to ignore (! to reset). See import options 在 附录 A.

-W spec

More wrappers. See import options 在 附录 A.

init

Create a cvs repository if it doesn't exist. See 创建源码库 在 第 2 章.

kserver

Kerberos authenticated server. See 通过kerberos直接连接 在 第 2 章.

log [options] [files…]

Print out history information for files. See log--Print out log information for files 在 附录 A.

-b

Only list revisions on the default branch. See log options 在 附录 A.

-d dates

Specify dates (d1<d2 for range, d for latest before). See log options 在 附录 A.

-h

Only print header. See log options 在 附录 A.

-l

Local; run only in current working directory. See 第 6 章.

-N

Do not list tags. See log options 在 附录 A.

-R

Only print name of RCS file. See log options 在 附录 A.

-rrevs

Only list revisions revs. See log options 在 附录 A.

-s states

Only list revisions with specified states. See log options 在 附录 A.

-t

Only print header and descriptive text. See log options 在 附录 A.

-wlogins

Only list revisions checked in by specified logins. See log options 在 附录 A.

login

Prompt for password for authenticating server. See 在客户端使用密码认证 在 第 2 章.

logout

Remove stored password for authenticating server. See 在客户端使用密码认证 在 第 2 章.

pserver

Password authenticated server. See 在服务器端设置密码认证 在 第 2 章.

rannotate [options] [modules…]

Show last revision where each line was modified. See Annotate命令 在 第 8 章.

-D date

Annotate the most recent revision no later than date. See 通用命令选项 在 附录 A.

-F

Force annotation of binary files. (Without this option, binary files are skipped with a message.)

-f

Use head revision if tag/date not found. See 通用命令选项 在 附录 A.

-l

Local; run only in current working directory. 第 6 章.

-R

Operate recursively (default). 第 6 章.

-r tag

Annotate revision tag. See 通用命令选项 在 附录 A.

rdiff [options] modules

Show differences between releases. See rdiff--'patch' format diffs between releases 在 附录 A.

-c

Context diff output format (default). See rdiff options 在 附录 A.

-D date

Select revisions based on date. See 通用命令选项 在 附录 A.

-f

Use head revision if tag/date not found. See 通用命令选项 在 附录 A.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.

-r rev

Select revisions based on rev. See 通用命令选项 在 附录 A.

-s

Short patch - one liner per file. See rdiff options 在 附录 A.

-t

Top two diffs - last change made to the file. See diff options 在 附录 A.

-u

Unidiff output format. See rdiff options 在 附录 A.

-V vers

Use RCS Version vers for keyword expansion (obsolete). See rdiff options 在 附录 A.

release [options] directory

Indicate that a directory is no longer in use. See release--Indicate that a Module is no longer in use 在 附录 A.

-d

Delete the given directory. See release options 在 附录 A.

remove [options] [files…]

Remove an entry from the repository. See 删除文件 在 第 7 章.

-f

Delete the file before removing it. See 删除文件 在 第 7 章.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.

rlog [options] [files…]

Print out history information for modules. See log--Print out log information for files 在 附录 A.

-b

Only list revisions on the default branch. See log options 在 附录 A.

-d dates

Specify dates (d1<d2 for range, d for latest before). See log options 在 附录 A.

-h

Only print header. See log options 在 附录 A.

-l

Local; run only in current working directory. See 第 6 章.

-N

Do not list tags. See log options 在 附录 A.

-R

Only print name of RCS file. See log options 在 附录 A.

-rrevs

Only list revisions revs. See log options 在 附录 A.

-s states

Only list revisions with specified states. See log options 在 附录 A.

-t

Only print header and descriptive text. See log options 在 附录 A.

-wlogins

Only list revisions checked in by specified logins. See log options 在 附录 A.

rtag [options] tag modules

Add a symbolic tag to a module. See 第 4 章 and 第 5 章.

-a

Clear tag from removed files that would not otherwise be tagged. See 打标签与添加、删除文件 在 第 4 章.

-b

Create a branch named tag. See 第 5 章.

-B

Used in conjuntion with -F or -d, enables movement and deletion of branch tags. Use with extreme caution.

-D date

Tag revisions as of date. See 通过日期或版本打标签 在 第 4 章.

-d

Delete tag. See 删除,移动和重命名标签 在 第 4 章.

-F

Move tag if it already exists. See 删除,移动和重命名标签 在 第 4 章.

-f

Force a head revision match if tag/date not found. See 通过日期或版本打标签 在 第 4 章.

-l

Local; run only in current working directory. See 第 6 章.

-n

No execution of tag program. See 通用命令选项 在 附录 A.

-R

Operate recursively (default). 第 6 章.

-r rev

Tag existing tag rev. See 通过日期或版本打标签 在 第 4 章.

server

Rsh server. See 通过rsh连接 在 第 2 章.

status [options] files

Display status information in a working directory. See 文件状态 在 第 10 章.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.

-v

Include tag information for file. See 标签形式的版本号 在 第 4 章.

tag [options] tag [files…]

Add a symbolic tag to checked out version of files. See 第 4 章 and 第 5 章.

-b

Create a branch named tag. See 第 5 章.

-c

Check that working files are unmodified. See 在工作目录内指定哪些文件需要打标签 在 第 4 章.

-D date

Tag revisions as of date. See 通过日期或版本打标签 在 第 4 章.

-d

Delete tag. See 删除,移动和重命名标签 在 第 4 章.

-F

Move tag if it already exists. See 删除,移动和重命名标签 在 第 4 章.

-f

Force a head revision match if tag/date not found. See 通过日期或版本打标签 在 第 4 章.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.

-r rev

Tag existing tag rev. See 通过日期或版本打标签 在 第 4 章.

unedit [options] [files…]

Undo an edit command. See 怎样编辑一个被观察的文件 在 第 10 章.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.

update [options] [files…]

Bring work tree in sync with repository. See update--Bring work tree in sync with repository 在 附录 A.

-A

Reset any sticky tags/date/options. See 粘性的标签(Sticky tags) 在 第 4 章 and 第 12 章.

-C

Overwrite locally modified files with clean copies from the repository (the modified file is saved in .#file.revision, however).

-D date

Check out revisions as of date (is sticky). See 通用命令选项 在 附录 A.

-d

Create directories. See update options 在 附录 A.

-f

Use head revision if tag/date not found. See 通用命令选项 在 附录 A.

-I ign

More files to ignore (! to reset). See import options 在 附录 A.

-j rev

Merge in changes. See update options 在 附录 A.

-k kflag

Use kflag keyword expansion. See 替换模式 在 第 12 章.

-l

Local; run only in current working directory. 第 6 章.

-P

Prune empty directories. See 移动和重命名目录 在 第 7 章.

-p

Check out files to standard output (avoids stickiness). See update options 在 附录 A.

-R

Operate recursively (default). 第 6 章.

-r tag

Checkout revision tag (is sticky). See 通用命令选项 在 附录 A.

-W spec

More wrappers. See import options 在 附录 A.

version

Display the version of cvs being used. If the repository is remote, display both the client and server versions.

watch [on|off|add|remove] [options] [files…]

on/off: turn on/off read-only checkouts of files. See 用cvs观察(watch)指定的文件 在 第 10 章.

add/remove: add or remove notification on actions. See 使用cvs通知 在 第 10 章.

-a actions

Specify actions for temporary watch, where actions is edit, unedit, commit, all, or none. See 怎样编辑一个被观察的文件 在 第 10 章.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.

watchers [options] [files…]

See who is watching a file. See 有关谁正在观察和编辑的信息 在 第 10 章.

-l

Local; run only in current working directory. See 第 6 章.

-R

Operate recursively (default). 第 6 章.