CVS命令深入研究
标签:
命令
CVS命令深入研究
作者:leizhimin
日期:2006-11-2
日期:2006-11-2
环境:
Windows server 2003 sp1简体中文版
cvsnt-2.5.03.2260.msi
Windows server 2003 sp1简体中文版
cvsnt-2.5.03.2260.msi
目录:
一、CVS命令整体结构
二、CVS帮助察看方法概述
三、CVS选项
四、CVS命令
五、CVS命令缩写
六、CVS命令详解
七、CVS实践
一、CVS命令整体结构
二、CVS帮助察看方法概述
三、CVS选项
四、CVS命令
五、CVS命令缩写
六、CVS命令详解
七、CVS实践
======================================================
一、CVS命令整体结构
一、CVS命令整体结构
cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
cvs
cvs程序的名字.
cvs程序的名字.
cvs_options
一些会影响所有的cvs子命令的选项。这将在下面描述.
一些会影响所有的cvs子命令的选项。这将在下面描述.
cvs_command
一个或多个不同的子命令。一些命令可以使用别名;命令的别名在相应命令的参考手册中有说明。只有两种情况可以忽略cvs_command: cvs -H 显示可选的命令列表,cvs -v 显示cvs自己的版本信息。
一个或多个不同的子命令。一些命令可以使用别名;命令的别名在相应命令的参考手册中有说明。只有两种情况可以忽略cvs_command: cvs -H 显示可选的命令列表,cvs -v 显示cvs自己的版本信息。
command_options
说明该命令的选项
说明该命令的选项
command_args
这些命令的参数。
这些命令的参数。
不幸的是在cvs_options和command_options之间存在一些混淆。 -l,当作为一个cvs_option时,只会影响一些命令。当作为command_option时有不同的含义,并会影响更多的命令。换句话说,不要把以上的分类看的很严格。而应该参考相应命令的文档。
======================================================
二、CVS帮助察看方法概述
D:\>cvs
Usage: cvs [cvs-options] command [command-options-and-arguments]
where cvs-options are -q, -n, etc.
(specify --help-options for a list of options)
where command is add, admin, etc.
(specify --help-commands for a list of commands
or --help-synonyms for a list of command synonyms)
where command-options-and-arguments depend on the specific command
(specify -H followed by a command name for command-specific help)
Specify --help to receive this message
The Concurrent Versions System (CVS) is a tool for version control.
For CVS updates and additional information, see
the CVSNT home page at [url]http://www.cvsnt.org/[/url]
For CVS updates and additional information, see
the CVSNT home page at [url]http://www.cvsnt.org/[/url]
翻译:
C:\>cvs
用法: cvs [cvs-options(cvs选项)] command(命令) [command-options-and-arguments(选项和主题)]
cvs选项有-q, -n, 等等.
(说明 --help-options 查看cvs选项列表)
cvs的命令有 add, admin, 等等.
(说明 --help-commands 查看所有命令
或者 --help-synonyms 查看所有命令的缩写)
选项和主题依赖于特定的cvs命令
(说明 -H 放在命令名后,查看特定命令的帮助)
Specify --help to receive this message
C:\>cvs
用法: cvs [cvs-options(cvs选项)] command(命令) [command-options-and-arguments(选项和主题)]
cvs选项有-q, -n, 等等.
(说明 --help-options 查看cvs选项列表)
cvs的命令有 add, admin, 等等.
(说明 --help-commands 查看所有命令
或者 --help-synonyms 查看所有命令的缩写)
选项和主题依赖于特定的cvs命令
(说明 -H 放在命令名后,查看特定命令的帮助)
Specify --help to receive this message
The Concurrent Versions System (CVS) is a tool for version control.
For CVS updates and additional information, see
the CVSNT home page at [url]http://www.cvsnt.org/[/url]
For CVS updates and additional information, see
the CVSNT home page at [url]http://www.cvsnt.org/[/url]
======================================================
三、CVS选项
D:\>cvs --help-options
CVS global options (specified before the command name) are:
-H Displays usage information for command.
-Q Cause CVS to be really quiet.
-q Cause CVS to be somewhat quiet.
-r Make checked-out files read-only.
-w Make checked-out files read-write (default).
-t Show trace of program execution (repeat for more verbosity) -- try with -n.
-v CVS version and copyright.
-T tmpdir Use 'tmpdir' for temporary files.
-e editor Use 'editor' for editing log information.
-d CVS_root Overrides $CVSROOT as the root of the CVS tree.
-f Do not use the ~/.cvsrc file.
-F file Read command arguments from file.
-z # Use compression level '#' for net traffic.
-c Checksum files as they are sent to the server.
-x Encrypt all net traffic (fail if not encrypted). Implies -a.
-y Encrypt all net traffic (if supported by protocol). Implies -a.
-a Authenticate/sign all net traffic.
-N Supress network share error. (UNSUPPORTED OPTION)
-s VAR=VAL Set CVS user variable.
-L Override cvs library directory
-C Override cvs configuration directory
-o[locale] Translate between server and client locale.
Specifying a locale here overrides the default (autodetected on CVSNT 2.0.58+).
-O Disable client/server locale translation.
CVS global options (specified before the command name) are:
-H Displays usage information for command.
-Q Cause CVS to be really quiet.
-q Cause CVS to be somewhat quiet.
-r Make checked-out files read-only.
-w Make checked-out files read-write (default).
-t Show trace of program execution (repeat for more verbosity) -- try with -n.
-v CVS version and copyright.
-T tmpdir Use 'tmpdir' for temporary files.
-e editor Use 'editor' for editing log information.
-d CVS_root Overrides $CVSROOT as the root of the CVS tree.
-f Do not use the ~/.cvsrc file.
-F file Read command arguments from file.
-z # Use compression level '#' for net traffic.
-c Checksum files as they are sent to the server.
-x Encrypt all net traffic (fail if not encrypted). Implies -a.
-y Encrypt all net traffic (if supported by protocol). Implies -a.
-a Authenticate/sign all net traffic.
-N Supress network share error. (UNSUPPORTED OPTION)
-s VAR=VAL Set CVS user variable.
-L Override cvs library directory
-C Override cvs configuration directory
-o[locale] Translate between server and client locale.
Specifying a locale here overrides the default (autodetected on CVSNT 2.0.58+).
-O Disable client/server locale translation.
--version CVS version and copyright.
--encrypt Encrypt all net traffic (if supported by protocol).
--authenticate Authenticate all net traffic (if supported by protocol).
--readonly Server is read only for all users.
--encrypt Encrypt all net traffic (if supported by protocol).
--authenticate Authenticate all net traffic (if supported by protocol).
--readonly Server is read only for all users.
(Specify the --help option for a list of other help options)
======================================================
四、CVS命令
D:\>cvs --help-commands
CVS commands are:
add Add a new file/directory to the repository
admin Administration front end for rcs
annotate Show last revision where each line was modified
chacl Change the Access Control List for a directory
checkout Checkout sources for editing
chown Change the owner of a directory
commit Check files into the repository
diff Show differences between revisions
edit Get ready to edit a watched file
editors See who is editing a watched file
export Export sources from CVS, similar to checkout
history Show repository access history
import Import sources into CVS, using vendor branches
init Create a CVS repository if it doesn't exist
info Display information about supported protocols
log Print out history information for files
login Prompt for password for authenticating server
logout Removes entry in .cvspass for remote repository
ls List files in the repository
lsacl List the directories Access Control List
passwd Set the user's password (Admin: Administer users)
authserver Authentication server mode
rannotate Show last revision where each line of module was modified
rdiff Create 'patch' format diffs between releases
release Indicate that a Module is no longer in use
remove Remove an entry from the repository
rename Rename a file or directory
rchacl Change the Access Control List for a directory
rchown Change the owner of a directory
rlsacl List the directories Access Control List
rlog Print out history information for a module
rtag Add a symbolic tag to a module
server Server mode
status Display status information on checked out files
tag Add a symbolic tag to checked out version of files
unedit Undo an edit command
update Bring work tree in sync with repository
version Show current CVS version(s)
watch Set watches
watchers See who is watching a file
xdiff Show differences between revisions using an external diff program
(Specify the --help option for a list of other help options)
CVS commands are:
add Add a new file/directory to the repository
admin Administration front end for rcs
annotate Show last revision where each line was modified
chacl Change the Access Control List for a directory
checkout Checkout sources for editing
chown Change the owner of a directory
commit Check files into the repository
diff Show differences between revisions
edit Get ready to edit a watched file
editors See who is editing a watched file
export Export sources from CVS, similar to checkout
history Show repository access history
import Import sources into CVS, using vendor branches
init Create a CVS repository if it doesn't exist
info Display information about supported protocols
log Print out history information for files
login Prompt for password for authenticating server
logout Removes entry in .cvspass for remote repository
ls List files in the repository
lsacl List the directories Access Control List
passwd Set the user's password (Admin: Administer users)
authserver Authentication server mode
rannotate Show last revision where each line of module was modified
rdiff Create 'patch' format diffs between releases
release Indicate that a Module is no longer in use
remove Remove an entry from the repository
rename Rename a file or directory
rchacl Change the Access Control List for a directory
rchown Change the owner of a directory
rlsacl List the directories Access Control List
rlog Print out history information for a module
rtag Add a symbolic tag to a module
server Server mode
status Display status information on checked out files
tag Add a symbolic tag to checked out version of files
unedit Undo an edit command
update Bring work tree in sync with repository
version Show current CVS version(s)
watch Set watches
watchers See who is watching a file
xdiff Show differences between revisions using an external diff program
(Specify the --help option for a list of other help options)
======================================================
五、CVS命令缩写
D:\>cvs --help-synonyms
CVS command synonyms are:
add ad new
admin adm rcs
annotate ann
authserver pserver
chacl setacl setperm
checkout co get
chown setowner
commit ci com
diff di dif
export exp ex
history hi his
import im imp
info inf
log lo
login logon lgn
ls dir list
lsacl lsattr listperm
rlsacl rlsattr rlistperm
passwd password setpass
rannotate rann ra
rchacl rsetacl rsetperm
rchown rsetowner
rdiff patch pa
release re rel
remove rm delete
rename ren mv
rlog rl
rtag rt rfreeze
status st stat
tag ta freeze
update up upd
version ve ver
xdiff xd
(Specify the --help option for a list of other help options)
CVS command synonyms are:
add ad new
admin adm rcs
annotate ann
authserver pserver
chacl setacl setperm
checkout co get
chown setowner
commit ci com
diff di dif
export exp ex
history hi his
import im imp
info inf
log lo
login logon lgn
ls dir list
lsacl lsattr listperm
rlsacl rlsattr rlistperm
passwd password setpass
rannotate rann ra
rchacl rsetacl rsetperm
rchown rsetowner
rdiff patch pa
release re rel
remove rm delete
rename ren mv
rlog rl
rtag rt rfreeze
status st stat
tag ta freeze
update up upd
version ve ver
xdiff xd
(Specify the --help option for a list of other help options)
======================================================
六、CVS命令详解
六、CVS命令详解
------------------
D:\>cvs -H add
Usage: cvs add [-k rcs-kflag] [-m message] files...
-b <bugid> Set the bug identifier (repeat for multiple bugs).
-k Use "rcs-kflag" to add the file with the specified kflag.
-m Use "message" for the creation log.
-r <branch> Add onto a different branch.
-f Force replacement of deleted files.
(Specify the --help global option for a list of other help options)
Usage: cvs add [-k rcs-kflag] [-m message] files...
-b <bugid> Set the bug identifier (repeat for multiple bugs).
-k Use "rcs-kflag" to add the file with the specified kflag.
-m Use "message" for the creation log.
-r <branch> Add onto a different branch.
-f Force replacement of deleted files.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H admin
Usage: cvs admin [options] files...
-l[rev] Lock revision (latest revision on branch,
latest revision on trunk if omitted). (DEPRECIATED)
-m rev:msg Replace revision's log message.
-o range Physically delete (outdate) specified range of revisions:
rev1:rev2 Between rev1 and rev2, including rev1 and rev2.
rev1::rev2 Between rev1 and rev2, excluding rev1 and rev2.
rev: rev and following revisions on the same branch.
rev:: After rev on the same branch.
:rev rev and previous revisions on the same branch.
::rev Before rev on the same branch.
rev Just rev.
-p [rev:]prop=val Set global or versioned property.
-q Run quietly.
-t[file] Get descriptive text from file (stdin if omitted).
-t-string Set descriptive text.
-u[rev] Unlock the revision (latest revision on branch,
latest revision on trunk if omitted).
(Specify the --help global option for a list of other help options)
Usage: cvs admin [options] files...
-l[rev] Lock revision (latest revision on branch,
latest revision on trunk if omitted). (DEPRECIATED)
-m rev:msg Replace revision's log message.
-o range Physically delete (outdate) specified range of revisions:
rev1:rev2 Between rev1 and rev2, including rev1 and rev2.
rev1::rev2 Between rev1 and rev2, excluding rev1 and rev2.
rev: rev and following revisions on the same branch.
rev:: After rev on the same branch.
:rev rev and previous revisions on the same branch.
::rev Before rev on the same branch.
rev Just rev.
-p [rev:]prop=val Set global or versioned property.
-q Run quietly.
-t[file] Get descriptive text from file (stdin if omitted).
-t-string Set descriptive text.
-u[rev] Unlock the revision (latest revision on branch,
latest revision on trunk if omitted).
(Specify the --help global option for a list of other help options)
THIS COMMAND IS FOR CVS ADMINISTRATORS ONLY. DON'T USE IT UNLESS YOU
KNOW EXACTLY WHAT YOU ARE DOING, AND WHAT THE CONSEQUENCES ARE.
------------------
D:\>cvs -H annotate
Usage: cvs annotate [-lRf] [-r rev] [-D date] [files...]
-l Local directory only, no recursion.
-R Process directories recursively.
-f Use head revision if tag/date not found.
-r rev Annotate file as of specified revision/tag.
-D date Annotate file as of specified date.
-w width Modify width of username field (default 8).
(Specify the --help global option for a list of other help options)
Usage: cvs annotate [-lRf] [-r rev] [-D date] [files...]
-l Local directory only, no recursion.
-R Process directories recursively.
-f Use head revision if tag/date not found.
-r rev Annotate file as of specified revision/tag.
-D date Annotate file as of specified date.
-w width Modify width of username field (default 8).
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H authserver
Usage: cvs authserver
Normally invoked by a cvs client on a remote machine.
------------------
D:\>cvs -H chacl
Usage: cvs chacl [-R] [-r branch] [-u user] [-j branch] [-n] [-p priority] [-m message] [-a [no]{r
d|write|create|tag|control|all|none}[,...]] [-d] [file or directory...]
-a access Set access
-d Delete ACL
-j branch Apply when merging from branch
-m message Custom error message
-n Do not inherit ACL
-p priority Override ACL priority
-r branch Apply to single branch
-R Recursively change subdirectories
-u user Apply to single user
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H checkout
Usage:
cvs checkout [-ANPRcflnps] [-r rev] [-D date] [-d dir]
[-j rev1] [-j rev2] [-k kopt] modules...
-A Reset any sticky tags/date/kopts.
-N Don't shorten module paths if -d specified.
-P Prune empty directories.
-R Process directories recursively.
-c "cat" the module database.
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive
-n Do not run module program (if any).
-p Check out files to standard output (avoids stickiness).
-s Like -c, but include module status.
-r rev Check out revision or tag. (implies -P) (is sticky)
-D date Check out revisions as of date. (implies -P) (is sticky)
-d dir Check out into dir instead of module name.
-k kopt Use RCS kopt -k option on checkout. (is sticky)
-j rev Merge in changes made between current revision and rev.
-b Perform -j merge from branch point.
-m Perform -j merge from last merge point (default).
-3 Produce 3-way conflicts.
-S Select between conflicting case sensitive names.
-t Update using last checkin time.
(Specify the --help global option for a list of other help options)
Usage:
cvs checkout [-ANPRcflnps] [-r rev] [-D date] [-d dir]
[-j rev1] [-j rev2] [-k kopt] modules...
-A Reset any sticky tags/date/kopts.
-N Don't shorten module paths if -d specified.
-P Prune empty directories.
-R Process directories recursively.
-c "cat" the module database.
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive
-n Do not run module program (if any).
-p Check out files to standard output (avoids stickiness).
-s Like -c, but include module status.
-r rev Check out revision or tag. (implies -P) (is sticky)
-D date Check out revisions as of date. (implies -P) (is sticky)
-d dir Check out into dir instead of module name.
-k kopt Use RCS kopt -k option on checkout. (is sticky)
-j rev Merge in changes made between current revision and rev.
-b Perform -j merge from branch point.
-m Perform -j merge from last merge point (default).
-3 Produce 3-way conflicts.
-S Select between conflicting case sensitive names.
-t Update using last checkin time.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H chown
Usage: cvs chown [-R] user directory...
-R Change owner recursively
Usage: cvs chown [-R] user directory...
-R Change owner recursively
------------------
D:\>cvs -H commit
Usage: cvs commit [DnRlf] [-B bug | -b bug ] [-m msg | -F logfile] files...
-b bugid Only commit files related to bug.
-B bugid Mark files with bug.
-c Check for valid edits before committing.
-D Assume all files are modified.
-F logfile Read the log message from file.
-e Keep edited files.
-f Force the file to be committed; disables recursion.
-n Do not run the module program (if any).
-l Local directory only (not recursive).
-m message Log message.
-R Process directories recursively.
-T Move empty branches (where possible).
(Specify the --help global option for a list of other help options)
Usage: cvs commit [DnRlf] [-B bug | -b bug ] [-m msg | -F logfile] files...
-b bugid Only commit files related to bug.
-B bugid Mark files with bug.
-c Check for valid edits before committing.
-D Assume all files are modified.
-F logfile Read the log message from file.
-e Keep edited files.
-f Force the file to be committed; disables recursion.
-n Do not run the module program (if any).
-l Local directory only (not recursive).
-m message Log message.
-R Process directories recursively.
-T Move empty branches (where possible).
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H diff
Usage: cvs diff [-lNR] [rcsdiff-options]
[[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...]
-l Local directory only, not recursive
-R Process directories recursively.
-D d1 Diff revision for date against working file.
-D d2 Diff rev1/date1 against date2.
-N include diffs for added and removed files.
-r rev1 Diff revision for rev1 against working file.
-r rev2 Diff rev1/date1 against rev2.
--ifdef=arg Output diffs in ifdef format.
(consult the documentation for your diff program for rcsdiff-options.
The most popular is -c for context diffs but there are many more).
(Specify the --help global option for a list of other help options)
Usage: cvs diff [-lNR] [rcsdiff-options]
[[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...]
-l Local directory only, not recursive
-R Process directories recursively.
-D d1 Diff revision for date against working file.
-D d2 Diff rev1/date1 against date2.
-N include diffs for added and removed files.
-r rev1 Diff revision for rev1 against working file.
-r rev2 Diff rev1/date1 against rev2.
--ifdef=arg Output diffs in ifdef format.
(consult the documentation for your diff program for rcsdiff-options.
The most popular is -c for context diffs but there are many more).
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H export
Usage: cvs export [-NRfln] [-r rev] [-D date] [-d dir] [-k kopt] module...
-N Don't shorten module paths if -d specified.
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive
-R Process directories recursively (default).
-n Do not run module program (if any).
-r rev Export revision or tag.
-D date Export revisions as of date.
-d dir Export into dir instead of module name.
-k kopt Use RCS kopt -k option on checkout.
(Specify the --help global option for a list of other help options)
Usage: cvs export [-NRfln] [-r rev] [-D date] [-d dir] [-k kopt] module...
-N Don't shorten module paths if -d specified.
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive
-R Process directories recursively (default).
-n Do not run module program (if any).
-r rev Export revision or tag.
-D date Export revisions as of date.
-d dir Export into dir instead of module name.
-k kopt Use RCS kopt -k option on checkout.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H history
Usage: cvs history [-report] [-flags] [-options args] [files...]
Usage: cvs history [-report] [-flags] [-options args] [files...]
Reports:
-T Produce report on all TAGs
-c Committed (Modified) files
-o Checked out modules
-m <module> Look for specified module (repeatable)
-x [TOEFWUCGMAReu] Extract by record type
-e Everything (same as -x, but all record types)
Flags:
-a All users (Default is self)
-l Last modified (committed or modified report)
-w Working directory must match
Options:
-D <date> Since date (Many formats)
-b <str> Back to record with str in module/file/repos field
-f <file> Specified file (same as command line) (repeatable)
-n <modulename> In module (repeatable)
-p <repos> In repository (repeatable)
-r <rev/tag> Since rev or tag (looks inside RCS files!)
-t <tag> Since tag record placed in history file (by anyone).
-u <user> For user name (repeatable)
-z <tz> Output for time zone <tz> (e.g. -z -0700)
-B <bugid> Containing bug <bugid>
-T Produce report on all TAGs
-c Committed (Modified) files
-o Checked out modules
-m <module> Look for specified module (repeatable)
-x [TOEFWUCGMAReu] Extract by record type
-e Everything (same as -x, but all record types)
Flags:
-a All users (Default is self)
-l Last modified (committed or modified report)
-w Working directory must match
Options:
-D <date> Since date (Many formats)
-b <str> Back to record with str in module/file/repos field
-f <file> Specified file (same as command line) (repeatable)
-n <modulename> In module (repeatable)
-p <repos> In repository (repeatable)
-r <rev/tag> Since rev or tag (looks inside RCS files!)
-t <tag> Since tag record placed in history file (by anyone).
-u <user> For user name (repeatable)
-z <tz> Output for time zone <tz> (e.g. -z -0700)
-B <bugid> Containing bug <bugid>
------------------
D:\>cvs -H import
Usage: cvs import [-C] [-d] [-f] [-h] [-k subst] [-I ign] [-m msg] [-b branch]
[-W spec] [-n] [-F] repository [vendor-tag] [release-tags...]
-C Create CVS directories while importing.
-d Use the file's modification time as the time of import.
-f Overwrite existing release tags.
-k sub Set RCS keyword substitution mode.
-I ign More files to ignore (! to reset, @ to skip .cvsignore).
-b bra Vendor branch id.
-m msg Log message.
-h Include hidden files.
-W spec Wrappers specification line (! to reset).
-n Don't create vendor branch or release tags.
(Specify the --help global option for a list of other help options)
Usage: cvs import [-C] [-d] [-f] [-h] [-k subst] [-I ign] [-m msg] [-b branch]
[-W spec] [-n] [-F] repository [vendor-tag] [release-tags...]
-C Create CVS directories while importing.
-d Use the file's modification time as the time of import.
-f Overwrite existing release tags.
-k sub Set RCS keyword substitution mode.
-I ign More files to ignore (! to reset, @ to skip .cvsignore).
-b bra Vendor branch id.
-m msg Log message.
-h Include hidden files.
-W spec Wrappers specification line (! to reset).
-n Don't create vendor branch or release tags.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H info
Usage: cvs info [-c|-s|-b|-r server] [cvswrappers|cvsignore|config|<protocol>]
-c Describe client (default)
-s Describe server
-b Browse local servers
-r server Examine public information from remote server
-v More verbose output
(Specify the --help global option for a list of other help options)
Usage: cvs info [-c|-s|-b|-r server] [cvswrappers|cvsignore|config|<protocol>]
-c Describe client (default)
-s Describe server
-b Browse local servers
-r server Examine public information from remote server
-v More verbose output
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H log
Usage: cvs log [-lRhtNbT] [-r[revisions]] [-B bugid] [-d dates] [-s states]
[-w[logins]] [files...]
-B bugid Only list revisions related to bug.
-b Only list revisions on the default branch.
-d dates Specify dates (D1<D2 for range, D for latest before).
-h Only print header.
-l Local directory only, no recursion.
-R Only print name of RCS file.
-r[revisions] Specify revision(s)s to list.
rev1:rev2 Between rev1 and rev2, including rev1 and rev2.
rev1::rev2 Between rev1 and rev2, excluding rev1 and rev2.
rev1:::rev2 Between rev1 and rev2, excluding rev1.
rev: rev and following revisions on the same branch.
rev:: After rev on the same branch.
:rev rev and previous revisions on the same branch.
::rev Before rev on the same branch.
rev Just rev.
branch All revisions on the branch.
branch. The last revision on the branch.
-S Supress information when no revisions are selected.
-T Use local time not GMT.
-t Only print header and descriptive text.
-N Do not list tags.
-w[logins] Only list revisions checked in by specified logins.
-X cvs 1.x/RCS 5.7 compatible output.
-x cvsnt 2.x compatible output (default).
(Specify the --help global option for a list of other help options)
Usage: cvs log [-lRhtNbT] [-r[revisions]] [-B bugid] [-d dates] [-s states]
[-w[logins]] [files...]
-B bugid Only list revisions related to bug.
-b Only list revisions on the default branch.
-d dates Specify dates (D1<D2 for range, D for latest before).
-h Only print header.
-l Local directory only, no recursion.
-R Only print name of RCS file.
-r[revisions] Specify revision(s)s to list.
rev1:rev2 Between rev1 and rev2, including rev1 and rev2.
rev1::rev2 Between rev1 and rev2, excluding rev1 and rev2.
rev1:::rev2 Between rev1 and rev2, excluding rev1.
rev: rev and following revisions on the same branch.
rev:: After rev on the same branch.
:rev rev and previous revisions on the same branch.
::rev Before rev on the same branch.
rev Just rev.
branch All revisions on the branch.
branch. The last revision on the branch.
-S Supress information when no revisions are selected.
-T Use local time not GMT.
-t Only print header and descriptive text.
-N Do not list tags.
-w[logins] Only list revisions checked in by specified logins.
-X cvs 1.x/RCS 5.7 compatible output.
-x cvsnt 2.x compatible output (default).
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H login
Usage: cvs login [-p password]
-p password Specify password to use (default is to prompt)
(Specify the --help global option for a list of other help options)
Usage: cvs login [-p password]
-p password Specify password to use (default is to prompt)
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H ls
Usage: cvs ls [-q] [-e] [-l] [-R] [-r rev] [-D date] [-t] [modules...]
-D date Show files from date.
-e Display in CVS/Entries format.
-l Display all details.
-P Ignore empty directories.
-q Quieter output.
-R List recursively.
-r rev Show files with revision or tag.
-T Show time in local time instead of GMT.
(Specify the --help global option for a list of other help options)
Usage: cvs ls [-q] [-e] [-l] [-R] [-r rev] [-D date] [-t] [modules...]
-D date Show files from date.
-e Display in CVS/Entries format.
-l Display all details.
-P Ignore empty directories.
-q Quieter output.
-R List recursively.
-r rev Show files with revision or tag.
-T Show time in local time instead of GMT.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H lsacl
Usage: cvs lsacl [-d] [-R] [file or directory...]
-d Show directories only
-R Recurse unto subdirectories
Usage: cvs lsacl [-d] [-R] [file or directory...]
-d Show directories only
-R Recurse unto subdirectories
------------------
D:\>cvs -H rlsacl
Usage: cvs rlsacl [-d] [-R] [module...]
-d Show directories only
-R Recurse unto subdirectories
Usage: cvs rlsacl [-d] [-R] [module...]
-d Show directories only
-R Recurse unto subdirectories
------------------
D:\>cvs -H passwd
Usage: cvs passwd [-a] [-x] [-X] [-r real_user] [-R] [-D domain] [username]
-a Add user
-x Disable user
-X Delete user
-r Alias username to real system user
-R Remove alias to real system user
-D Use domain password
Usage: cvs passwd [-a] [-x] [-X] [-r real_user] [-R] [-D domain] [username]
-a Add user
-x Disable user
-X Delete user
-r Alias username to real system user
-R Remove alias to real system user
-D Use domain password
------------------
D:\>cvs -H rannotate
Usage: cvs rannotate [-lRf] [-r rev] [-D date] [files...]
-l Local directory only, no recursion.
-R Process directories recursively.
-f Use head revision if tag/date not found.
-r rev Annotate file as of specified revision/tag.
-D date Annotate file as of specified date.
-w width Modify width of username field (default 8).
(Specify the --help global option for a list of other help options)
Usage: cvs rannotate [-lRf] [-r rev] [-D date] [files...]
-l Local directory only, no recursion.
-R Process directories recursively.
-f Use head revision if tag/date not found.
-r rev Annotate file as of specified revision/tag.
-D date Annotate file as of specified date.
-w width Modify width of username field (default 8).
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H rchacl
Usage: cvs rchacl [-R] [-r branch] [-u user] [-j branch] [-n] [-p priority] [-m message] [-a [no]{
ad|write|create|tag|control|all|none}[,...]] [-d] [module...]
-a access Set access
-d Delete ACL
-j branch Apply when merging from branch
-m message Custom error message
-n Do not inherit ACL
-p priority Override ACL priority
-r branch Apply to single branch
-R Recursively change subdirectories
-u user Apply to single user
(Specify the --help global option for a list of other help options)
Usage: cvs rchacl [-R] [-r branch] [-u user] [-j branch] [-n] [-p priority] [-m message] [-a [no]{
ad|write|create|tag|control|all|none}[,...]] [-d] [module...]
-a access Set access
-d Delete ACL
-j branch Apply when merging from branch
-m message Custom error message
-n Do not inherit ACL
-p priority Override ACL priority
-r branch Apply to single branch
-R Recursively change subdirectories
-u user Apply to single user
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H rchown
Usage: cvs rchown [-R] user module...
-R Change owner recursively
Usage: cvs rchown [-R] user module...
-R Change owner recursively
------------------
D:\>cvs -H rdiff
Usage: cvs rdiff [-flR] [-c|-u] [-s|-t] [-V %d]
-r rev|-D date [-r rev2 | -D date2] modules...
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive
-R Process directories recursively.
-c Context diffs (default)
-u Unidiff format.
-s Short patch - one liner per file.
-t Top two diffs - last change made to the file.
-D date Date.
-r rev Revision - symbolic or numeric.
(Specify the --help global option for a list of other help options)
Usage: cvs rdiff [-flR] [-c|-u] [-s|-t] [-V %d]
-r rev|-D date [-r rev2 | -D date2] modules...
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive
-R Process directories recursively.
-c Context diffs (default)
-u Unidiff format.
-s Short patch - one liner per file.
-t Top two diffs - last change made to the file.
-D date Date.
-r rev Revision - symbolic or numeric.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H release
Usage: cvs release [-d [-f]] [-e] [-y] directories...
-d Delete the given directory.
-f Delete contents of directories including non-cvs files.
-e Delete CVS control files in the given directory (export).
-y Assume answer yes to all questions.
(Specify the --help global option for a list of other help options)
Usage: cvs release [-d [-f]] [-e] [-y] directories...
-d Delete the given directory.
-f Delete contents of directories including non-cvs files.
-e Delete CVS control files in the given directory (export).
-y Assume answer yes to all questions.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H remove
Usage: cvs remove [-flR] [files...]
-f Delete the file before removing it.
-l Process this directory only (not recursive).
-R Process directories recursively.
(Specify the --help global option for a list of other help options)
Usage: cvs remove [-flR] [files...]
-f Delete the file before removing it.
-l Process this directory only (not recursive).
-R Process directories recursively.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H rename
Usage: cvs rename [-q] <source> <target>
-q Quieter output.
(Specify the --help global option for a list of other help options)
Usage: cvs rename [-q] <source> <target>
-q Quieter output.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H rlog
Usage: cvs rlog [-lRhtNbT] [-r[revisions]] [-B bugid] [-d dates] [-s states]
[-w[logins]] [files...]
-B bugid Only list revisions related to bug.
-b Only list revisions on the default branch.
-d dates Specify dates (D1<D2 for range, D for latest before).
-h Only print header.
-l Local directory only, no recursion.
-R Only print name of RCS file.
-r[revisions] Specify revision(s)s to list.
rev1:rev2 Between rev1 and rev2, including rev1 and rev2.
rev1::rev2 Between rev1 and rev2, excluding rev1 and rev2.
rev1:::rev2 Between rev1 and rev2, excluding rev1.
rev: rev and following revisions on the same branch.
rev:: After rev on the same branch.
:rev rev and previous revisions on the same branch.
::rev Before rev on the same branch.
rev Just rev.
branch All revisions on the branch.
branch. The last revision on the branch.
-S Supress information when no revisions are selected.
-T Use local time not GMT.
-t Only print header and descriptive text.
-N Do not list tags.
-w[logins] Only list revisions checked in by specified logins.
-X cvs 1.x/RCS 5.7 compatible output.
-x cvsnt 2.x compatible output (default).
(Specify the --help global option for a list of other help options)
Usage: cvs rlog [-lRhtNbT] [-r[revisions]] [-B bugid] [-d dates] [-s states]
[-w[logins]] [files...]
-B bugid Only list revisions related to bug.
-b Only list revisions on the default branch.
-d dates Specify dates (D1<D2 for range, D for latest before).
-h Only print header.
-l Local directory only, no recursion.
-R Only print name of RCS file.
-r[revisions] Specify revision(s)s to list.
rev1:rev2 Between rev1 and rev2, including rev1 and rev2.
rev1::rev2 Between rev1 and rev2, excluding rev1 and rev2.
rev1:::rev2 Between rev1 and rev2, excluding rev1.
rev: rev and following revisions on the same branch.
rev:: After rev on the same branch.
:rev rev and previous revisions on the same branch.
::rev Before rev on the same branch.
rev Just rev.
branch All revisions on the branch.
branch. The last revision on the branch.
-S Supress information when no revisions are selected.
-T Use local time not GMT.
-t Only print header and descriptive text.
-N Do not list tags.
-w[logins] Only list revisions checked in by specified logins.
-X cvs 1.x/RCS 5.7 compatible output.
-x cvsnt 2.x compatible output (default).
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H rtag
Usage: cvs rtag [-abdFflnR] [-r rev|-D date] tag modules...
-A Make alias of existing branch (requires -r).
-b Make the tag a "branch" tag, allowing concurrent development.
-d Delete the given tag.
-F Move tag if it already exists.
-B Allow move/delete of branch tag (not recommended).
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive.
-n No execution of 'tag program'.
-m message Specify message for logs.
-M Create floating branch.
-R Process directories recursively.
-r rev Existing revision/tag.
-D Existing date.
(Specify the --help global option for a list of other help options)
Usage: cvs rtag [-abdFflnR] [-r rev|-D date] tag modules...
-A Make alias of existing branch (requires -r).
-b Make the tag a "branch" tag, allowing concurrent development.
-d Delete the given tag.
-F Move tag if it already exists.
-B Allow move/delete of branch tag (not recommended).
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive.
-n No execution of 'tag program'.
-m message Specify message for logs.
-M Create floating branch.
-R Process directories recursively.
-r rev Existing revision/tag.
-D Existing date.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H status
Usage: cvs status [-vlR] [files...]
-v Verbose format; includes tag information for the file
-l Process this directory only (not recursive).
-R Process directories recursively.
-q Display a quick summary of each file (send more increased terseness).
-x cvsnt 2.x compatible output (default).
-X cvs 1.x compatible output.
(Specify the --help global option for a list of other help options)
Usage: cvs status [-vlR] [files...]
-v Verbose format; includes tag information for the file
-l Process this directory only (not recursive).
-R Process directories recursively.
-q Display a quick summary of each file (send more increased terseness).
-x cvsnt 2.x compatible output (default).
-X cvs 1.x compatible output.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H tag
Usage: cvs tag [-bcdFflR] [-r rev|-D date] tag [files...]
-A Make alias of existing branch (requires -r).
-b Make the tag a "branch" tag, allowing concurrent development.
-c Check that working files are unmodified.
-d Delete the given tag.
-F Move tag if it already exists.
-B Allow move/delete of branch tag (not recommended).
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive.
-m message Specify message for logs.
-M Create floating branch.
-R Process directories recursively.
-r rev Existing revision/tag.
-D Existing date.
(Specify the --help global option for a list of other help options)
Usage: cvs tag [-bcdFflR] [-r rev|-D date] tag [files...]
-A Make alias of existing branch (requires -r).
-b Make the tag a "branch" tag, allowing concurrent development.
-c Check that working files are unmodified.
-d Delete the given tag.
-F Move tag if it already exists.
-B Allow move/delete of branch tag (not recommended).
-f Force a head revision match if tag/date not found.
-l Local directory only, not recursive.
-m message Specify message for logs.
-M Create floating branch.
-R Process directories recursively.
-r rev Existing revision/tag.
-D Existing date.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H update
Usage: cvs update [-ACPdflRpbmt] [-k kopt] [-r rev] [-D date] [-j rev]
[-B bugid] [-I ign] [-W spec] [files...]
-3 Produce 3-way conflicts.
-A Reset any sticky tags/date/kopts.
-B bugid Perform -j Merge bounded by bug.
-b Perform -j merge from branch point.
-C Overwrite locally modified files with clean repository copies.
-c Update base revision copies.
-D date Set date to update from (is sticky).
-d Build directories, like checkout does.
-e[bugid] Automatically edit modified/merged files.
-f Force a head revision match if tag/date not found.
-I ign More files to ignore (! to reset).
-j rev Merge in changes made between current revision and rev.
-k kopt Use RCS kopt -k option on checkout. (is sticky)
-l Local directory only, no recursion.
-m Perform -j merge from last merge point (default).
-P Prune empty directories.
-p Send updates to standard output (avoids stickiness).
-R Process directories recursively.
-r rev Update using specified revision/tag (is sticky).
-S Select between conflicting case sensitive names.
-t Update using last checkin time.
-W spec Wrappers specification line (! to reset).
(Specify the --help global option for a list of other help options)
Usage: cvs update [-ACPdflRpbmt] [-k kopt] [-r rev] [-D date] [-j rev]
[-B bugid] [-I ign] [-W spec] [files...]
-3 Produce 3-way conflicts.
-A Reset any sticky tags/date/kopts.
-B bugid Perform -j Merge bounded by bug.
-b Perform -j merge from branch point.
-C Overwrite locally modified files with clean repository copies.
-c Update base revision copies.
-D date Set date to update from (is sticky).
-d Build directories, like checkout does.
-e[bugid] Automatically edit modified/merged files.
-f Force a head revision match if tag/date not found.
-I ign More files to ignore (! to reset).
-j rev Merge in changes made between current revision and rev.
-k kopt Use RCS kopt -k option on checkout. (is sticky)
-l Local directory only, no recursion.
-m Perform -j merge from last merge point (default).
-P Prune empty directories.
-p Send updates to standard output (avoids stickiness).
-R Process directories recursively.
-r rev Update using specified revision/tag (is sticky).
-S Select between conflicting case sensitive names.
-t Update using last checkin time.
-W spec Wrappers specification line (! to reset).
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H version
Usage: cvs version
-q Just display version number.
(Specify the --help global option for a list of other help options)
Usage: cvs version
-q Just display version number.
(Specify the --help global option for a list of other help options)
------------------
D:\>cvs -H xdiff
Usage: cvs xdiff [-lNR] [-o xdiff-options]
[[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...]
-D d1 Diff revision for date against working file.
-D d2 Diff rev1/date1 against date2.
-N include diffs for added and removed files.
-R Process directories recursively.
-l Local directory only, not recursive
-o Pass extra options to xdiff
-r rev1 Diff revision for rev1 against working file.
-r rev2 Diff rev1/date1 against rev2.
(consult the documentation for your xdiff extension for xdiff-options.
(Specify the --help global option for a list of other help options)
Usage: cvs xdiff [-lNR] [-o xdiff-options]
[[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...]
-D d1 Diff revision for date against working file.
-D d2 Diff rev1/date1 against date2.
-N include diffs for added and removed files.
-R Process directories recursively.
-l Local directory only, not recursive
-o Pass extra options to xdiff
-r rev1 Diff revision for rev1 against working file.
-r rev2 Diff rev1/date1 against rev2.
(consult the documentation for your xdiff extension for xdiff-options.
(Specify the --help global option for a list of other help options)
------------------
======================================================
七、CVS实践
------------------
1.添加二进制jar文件.
D:\Projects\TopUBP\lib\hibernate3>cvs add -kb *.jar
cvs server: scheduling file `hibernate3.jar' for addition
cvs server: scheduling file `ehcache-1.1.jar' for addition
cvs server: scheduling file `cglib-2.1.jar' for addition
cvs server: scheduling file `asm-attrs.jar' for addition
cvs server: scheduling file `asm.jar' for addition
cvs server: scheduling file `antlr-2.7.5H3.jar' for addition
cvs server: scheduling file `commons-lang-2.0.jar' for addition
cvs server: use 'cvs commit' to add these files permanently
D:\Projects\TopUBP\lib\hibernate3>cvs commit
CVS是一个C/S系统,多个开发人员通过一个中心版本控制系统来记录文件版本,从而达到保证文件同步的目的。工作模式如下:
CVS服务器(文件版本库)
开发人员入门可以主要挑选2,6看就可以了,CVS的管理员则更需要懂的更多一些,最后还简单介绍了一些Windows下的cvs客户端使用,远程用户认证的选择,及与BUG跟踪系统等开发环境的集成问题。
CVS环境初始化:CVS环境的搭建 管理员
CVS的日常使用:日常开发中最常用的CVS命令, 开发人员 管理员
CVS的分支开发:项目按照不同进度和目标并发进行 管理员
CVS的用户认证:通过SSH的远程用户认证,安全,简单 管理员
CVSWEB:CVS的WEB访问界面大大提高代码版本比较的效率 管理员
CVS TAG:将$Header$加入代码注释中,方便开发过程的跟踪 开发人员
CVS vs VSS: CVS和Virsual SourceSafe的比较 开发人员 管理员
WinCVS: 通过SSH认证的WinCVS认证设置
基于CVSTrac的小组开发环境搭建:通过CVSTrac实现web界面的CVS用户管理及集成的BUG跟踪和WIKI交流。
一个系统20%的功能往往能够满足80%的需求,CVS也不例外,以下是CVS最常用的功能,可能还不到它全部命令选项的20%,更多的功能在实际应用过程中体会,你想用多少就学多少,不时回头看看经常有意外的收获。
CVS环境初始化
环境设置:指定CVS库的路径CVSROOT
tcsh
setenv CVSROOT /path/to/cvsroot
bash
CVSROOT=/path/to/cvsroot
export CVSROOT
后面还提到远程CVS服务器的设置:
CVSROOT=:ext:$USER@test.server.address#port:/path/to/cvsroot CVS_RSH=ssh; export CVSROOT CVS_RSH
初始化:CVS版本库的初始化。
cvs init
一个项目的首次导入
cvs import -m "write some comments here" project_name vendor_tag release_tag
执行后:会将所有源文件及目录导入到/path/to/cvsroot/project_name目录下
vender_tag: 开发商标记
release_tag: 版本发布标记
项目导出:将代码从CVS库里导出
cvs checkout project_name
cvs 将创建project_name目录,并将最新版本的源代码导出到相应目录中。这个checkout和Virvual SourceSafe中的check out不是一个概念,相对于Virvual SourceSafe的check out是cvs update, check in是cvs commit。
CVS的日常使用
注意:第一次导出以后,就不是通过cvs checkout来同步文件了,而是要进入刚才cvs checkout project_name导出的project_name目录下进行具体文件的版本同步(添加,修改,删除)操作。
将文件同步到最新的版本
cvs update
不制定文件名,cvs将同步所有子目录下的文件,也可以制定某个文件名/目录进行同步
cvs update file_name
最好每天开始工作前或将自己的工作导入到CVS库里前都要做一次,并养成“先同步 后修改”的习惯,和Virvual SourceSafe不同,CVS里没有文件锁定的概念,所有的冲突是在commit之前解决,如果你修改过程中,有其他人修改并commit到了CVS库中,CVS会通知你文件冲突,并自动将冲突部分用
>>>>>>
content on cvs server
<<<<<<
content in your file
>>>>>>
标记出来,由你确认冲突内容的取舍。
版本冲突一般是在多个人修改一个文件造成的,但这种项目管理上的问题不应该指望由CVS来解决。
确认修改写入到CVS库里
cvs commit -m "write some comments here" file_name
注意:CVS的很多动作都是通过cvs commit进行最后确认并修改的,最好每次只修改一个文件。在确认的前,还需要用户填写修改注释,以帮助其他开发人员了解修改的原因。如果不用写-m "comments"而直接确认`cvs commit file_name` 的话,cvs会自动调用系统缺省的文字编辑器(一般是vi)要求你写入注释。
注释的质量很重要:所以不仅必须要写,而且必须写一些比较有意义的内容:以方便其他开发人员能够很好的理解
不好的注释,很难让其他的开发人员快速的理解:比如: -m "bug fixed" 甚至 -m ""
好的注释,甚至可以用中文: -m "在用户注册过程中加入了Email地址校验"
修改某个版本注释:每次只确认一个文件到CVS库里是一个很好的习惯,但难免有时候忘了指定文件名,把多个文件以同样注释commit到CVS库里了,以下命令可以允许你修改某个文件某个版本的注释:
cvs admin -m 1.3:"write some comments here" file_name
添加文件
创建好新文件后,比如:touch new_file
cvs add new_file
注意:对于图片,Word文档等非纯文本的项目,需要使用cvs add -kb选项按2进制文件方式导入(k表示扩展选项,b表示binary),否则有可能出现文件被破坏的情况
比如:
cvs add -kb new_file.gif
cvs add -kb readme.doc
然后确认修改并注释
cvs ci -m "write some comments here"
删除文件
将某个源文件物理删除后,比如:rm file_name
cvs rm file_name
然后确认修改并注释
cvs ci -m "write some comments here"
以上面前2步合并的方法为:
cvs rm -f file_name
cvs ci -m "why delete file"
注意:很多cvs命令都有缩写形式:commit=>ci; update=>up; checkout=>co/get; remove=>rm;
添加目录
cvs add dir_name
查看修改历史
cvs log file_name
cvs history file_name
查看当前文件不同版本的区别
cvs diff -r1.3 -r1.5 file_name
查看当前文件(可能已经修改了)和库中相应文件的区别
cvs diff file_name
cvs的web界面提供了更方便的定位文件修改和比较版本区别的方法,具体安装设置请看后面的cvsweb使用
正确的通过CVS恢复旧版本的方法:
如果用cvs update -r1.2 file.name
这个命令是给file.name加一个STICK TAG: "1.2" ,虽然你的本意只是想将它恢复到1.2版本
正确的恢复版本的方法是:cvs update -p -r1.2 file_name >file_name
如果不小心已经加成STICK TAG的话:用cvs update -A 解决
移动文件/文件重命名
cvs里没有cvs move或cvs rename,因为这两个操作是可以由先cvs remove old_file_name,然后cvs add new_file_name实现的。
删除/移动目录
最方便的方法是让管理员直接移动,删除CVSROOT里相应目录(因为CVS一个项目下的子目录都是独立的,移动到$CVSROOT目录下都可以作为新的独立项目:好比一颗树,其实砍下任意一枝都能独立存活),对目录进行了修改后,要求其开发人员重新导出项目cvs checkout project_name 或者用cvs update -dP同步。
项目发布导出不带CVS目录的源文件
做开发的时候你可能注意到了,每个开发目录下,CVS都创建了一个CVS/目录。里面有文件用于记录当前目录和CVS库之间的对应信息。但项目发布的时候你一般不希望把文件目录还带着含有CVS信息的CVS目录吧,这个一次性的导出过程使用cvs export命令,不过export只能针对一个TAG或者日期导出,比如:
cvs export -r release1 project_name
cvs export -D 20021023 project_name
cvs export -D now project_name
CVS Branch:项目多分支同步开发
=============================
确认版本里程碑:多个文件各自版本号不一样,项目到一定阶段,可以给所有文件统一指定一个阶段里程碑版本号,方便以后按照这个阶段里程碑版本号导出项目,同时也是项目的多个分支开发的基础。
cvs tag release_1_0
开始一个新的里程碑:
cvs commit -r 2 标记所有文件开始进入2.x的开发
注意:CVS里的revsion和软件包的发布版本可以没有直接的关系。但所有文件使用和发布版本一致的版本号比较有助于维护。
版本分支的建立
在开发项目的2.x版本的时候发现1.x有问题,但2.x又不敢用,则从先前标记的里程碑:release_1_0导出一个分支release_1_0_patch
cvs rtag -b -r release_1_0 release_1_0_patch proj_dir
一些人先在另外一个目录下导出release_1_0_patch这个分支:解决1.0中的紧急问题,
cvs checkout -r release_1_0_patch
而其他人员仍旧在项目的主干分支2.x上开发
在release_1_0_patch上修正错误后,标记一个1.0的错误修正版本号
cvs tag release_1_0_patch_1
如果2.0认为这些错误修改在2.0里也需要,也可以在2.0的开发目录下合并release_1_0_patch_1中的修改到当前代码中:
cvs update -j release_1_0_patch_1
CVS的远程认证:通过SSH远程访问CVS
使用cvs本身基于pserver的远程认证很麻烦,需要定义服务器和用户组,用户名,设置密码等,
常见的登陆格式如下:
cvs -d :pserver:cvs_user_name@cvs.server.address:/path/to/cvsroot login
例子:
cvs -d :pserver:cvs@samba.org:/cvsroot login
不是很安全,因此一般是作为匿名只读CVS访问的方式。从安全考虑,通过系统本地帐号认证并通过SSH传输是比较好的办法,通过在客户机的/etc/profile里设置一下内容:
CVSROOT=:ext:$USER@cvs.ser
CVS服务器(文件版本库)
开发人员入门可以主要挑选2,6看就可以了,CVS的管理员则更需要懂的更多一些,最后还简单介绍了一些Windows下的cvs客户端使用,远程用户认证的选择,及与BUG跟踪系统等开发环境的集成问题。
CVS环境初始化:CVS环境的搭建 管理员
CVS的日常使用:日常开发中最常用的CVS命令, 开发人员 管理员
CVS的分支开发:项目按照不同进度和目标并发进行 管理员
CVS的用户认证:通过SSH的远程用户认证,安全,简单 管理员
CVSWEB:CVS的WEB访问界面大大提高代码版本比较的效率 管理员
CVS TAG:将$Header$加入代码注释中,方便开发过程的跟踪 开发人员
CVS vs VSS: CVS和Virsual SourceSafe的比较 开发人员 管理员
WinCVS: 通过SSH认证的WinCVS认证设置
基于CVSTrac的小组开发环境搭建:通过CVSTrac实现web界面的CVS用户管理及集成的BUG跟踪和WIKI交流。
一个系统20%的功能往往能够满足80%的需求,CVS也不例外,以下是CVS最常用的功能,可能还不到它全部命令选项的20%,更多的功能在实际应用过程中体会,你想用多少就学多少,不时回头看看经常有意外的收获。
CVS环境初始化
环境设置:指定CVS库的路径CVSROOT
tcsh
setenv CVSROOT /path/to/cvsroot
bash
CVSROOT=/path/to/cvsroot
export CVSROOT
后面还提到远程CVS服务器的设置:
CVSROOT=:ext:$USER@test.server.address#port:/path/to/cvsroot CVS_RSH=ssh; export CVSROOT CVS_RSH
初始化:CVS版本库的初始化。
cvs init
一个项目的首次导入
cvs import -m "write some comments here" project_name vendor_tag release_tag
执行后:会将所有源文件及目录导入到/path/to/cvsroot/project_name目录下
vender_tag: 开发商标记
release_tag: 版本发布标记
项目导出:将代码从CVS库里导出
cvs checkout project_name
cvs 将创建project_name目录,并将最新版本的源代码导出到相应目录中。这个checkout和Virvual SourceSafe中的check out不是一个概念,相对于Virvual SourceSafe的check out是cvs update, check in是cvs commit。
CVS的日常使用
注意:第一次导出以后,就不是通过cvs checkout来同步文件了,而是要进入刚才cvs checkout project_name导出的project_name目录下进行具体文件的版本同步(添加,修改,删除)操作。
将文件同步到最新的版本
cvs update
不制定文件名,cvs将同步所有子目录下的文件,也可以制定某个文件名/目录进行同步
cvs update file_name
最好每天开始工作前或将自己的工作导入到CVS库里前都要做一次,并养成“先同步 后修改”的习惯,和Virvual SourceSafe不同,CVS里没有文件锁定的概念,所有的冲突是在commit之前解决,如果你修改过程中,有其他人修改并commit到了CVS库中,CVS会通知你文件冲突,并自动将冲突部分用
>>>>>>
content on cvs server
<<<<<<
content in your file
>>>>>>
标记出来,由你确认冲突内容的取舍。
版本冲突一般是在多个人修改一个文件造成的,但这种项目管理上的问题不应该指望由CVS来解决。
确认修改写入到CVS库里
cvs commit -m "write some comments here" file_name
注意:CVS的很多动作都是通过cvs commit进行最后确认并修改的,最好每次只修改一个文件。在确认的前,还需要用户填写修改注释,以帮助其他开发人员了解修改的原因。如果不用写-m "comments"而直接确认`cvs commit file_name` 的话,cvs会自动调用系统缺省的文字编辑器(一般是vi)要求你写入注释。
注释的质量很重要:所以不仅必须要写,而且必须写一些比较有意义的内容:以方便其他开发人员能够很好的理解
不好的注释,很难让其他的开发人员快速的理解:比如: -m "bug fixed" 甚至 -m ""
好的注释,甚至可以用中文: -m "在用户注册过程中加入了Email地址校验"
修改某个版本注释:每次只确认一个文件到CVS库里是一个很好的习惯,但难免有时候忘了指定文件名,把多个文件以同样注释commit到CVS库里了,以下命令可以允许你修改某个文件某个版本的注释:
cvs admin -m 1.3:"write some comments here" file_name
添加文件
创建好新文件后,比如:touch new_file
cvs add new_file
注意:对于图片,Word文档等非纯文本的项目,需要使用cvs add -kb选项按2进制文件方式导入(k表示扩展选项,b表示binary),否则有可能出现文件被破坏的情况
比如:
cvs add -kb new_file.gif
cvs add -kb readme.doc
然后确认修改并注释
cvs ci -m "write some comments here"
删除文件
将某个源文件物理删除后,比如:rm file_name
cvs rm file_name
然后确认修改并注释
cvs ci -m "write some comments here"
以上面前2步合并的方法为:
cvs rm -f file_name
cvs ci -m "why delete file"
注意:很多cvs命令都有缩写形式:commit=>ci; update=>up; checkout=>co/get; remove=>rm;
添加目录
cvs add dir_name
查看修改历史
cvs log file_name
cvs history file_name
查看当前文件不同版本的区别
cvs diff -r1.3 -r1.5 file_name
查看当前文件(可能已经修改了)和库中相应文件的区别
cvs diff file_name
cvs的web界面提供了更方便的定位文件修改和比较版本区别的方法,具体安装设置请看后面的cvsweb使用
正确的通过CVS恢复旧版本的方法:
如果用cvs update -r1.2 file.name
这个命令是给file.name加一个STICK TAG: "1.2" ,虽然你的本意只是想将它恢复到1.2版本
正确的恢复版本的方法是:cvs update -p -r1.2 file_name >file_name
如果不小心已经加成STICK TAG的话:用cvs update -A 解决
移动文件/文件重命名
cvs里没有cvs move或cvs rename,因为这两个操作是可以由先cvs remove old_file_name,然后cvs add new_file_name实现的。
删除/移动目录
最方便的方法是让管理员直接移动,删除CVSROOT里相应目录(因为CVS一个项目下的子目录都是独立的,移动到$CVSROOT目录下都可以作为新的独立项目:好比一颗树,其实砍下任意一枝都能独立存活),对目录进行了修改后,要求其开发人员重新导出项目cvs checkout project_name 或者用cvs update -dP同步。
项目发布导出不带CVS目录的源文件
做开发的时候你可能注意到了,每个开发目录下,CVS都创建了一个CVS/目录。里面有文件用于记录当前目录和CVS库之间的对应信息。但项目发布的时候你一般不希望把文件目录还带着含有CVS信息的CVS目录吧,这个一次性的导出过程使用cvs export命令,不过export只能针对一个TAG或者日期导出,比如:
cvs export -r release1 project_name
cvs export -D 20021023 project_name
cvs export -D now project_name
CVS Branch:项目多分支同步开发
=============================
确认版本里程碑:多个文件各自版本号不一样,项目到一定阶段,可以给所有文件统一指定一个阶段里程碑版本号,方便以后按照这个阶段里程碑版本号导出项目,同时也是项目的多个分支开发的基础。
cvs tag release_1_0
开始一个新的里程碑:
cvs commit -r 2 标记所有文件开始进入2.x的开发
注意:CVS里的revsion和软件包的发布版本可以没有直接的关系。但所有文件使用和发布版本一致的版本号比较有助于维护。
版本分支的建立
在开发项目的2.x版本的时候发现1.x有问题,但2.x又不敢用,则从先前标记的里程碑:release_1_0导出一个分支release_1_0_patch
cvs rtag -b -r release_1_0 release_1_0_patch proj_dir
一些人先在另外一个目录下导出release_1_0_patch这个分支:解决1.0中的紧急问题,
cvs checkout -r release_1_0_patch
而其他人员仍旧在项目的主干分支2.x上开发
在release_1_0_patch上修正错误后,标记一个1.0的错误修正版本号
cvs tag release_1_0_patch_1
如果2.0认为这些错误修改在2.0里也需要,也可以在2.0的开发目录下合并release_1_0_patch_1中的修改到当前代码中:
cvs update -j release_1_0_patch_1
CVS的远程认证:通过SSH远程访问CVS
使用cvs本身基于pserver的远程认证很麻烦,需要定义服务器和用户组,用户名,设置密码等,
常见的登陆格式如下:
cvs -d :pserver:cvs_user_name@cvs.server.address:/path/to/cvsroot login
例子:
cvs -d :pserver:cvs@samba.org:/cvsroot login
不是很安全,因此一般是作为匿名只读CVS访问的方式。从安全考虑,通过系统本地帐号认证并通过SSH传输是比较好的办法,通过在客户机的/etc/profile里设置一下内容:
CVSROOT=:ext:$USER@cvs.ser