TWiki> Main Web>TechTips? >CvsTips (14 Aug 2004, MattWalsh)EditAttach
This great book got me started

Add a new directory Make the dir, then cvs add new_dir. No commit needed.
Add a new file cvs add new_file, cvs commit
Add a new binary file
(disable new line fixing and expansions)
cvs add -kb new_binary_file
Remove a file rm the_file
cvs remove the_file
cvs commit
Remove a directory delete files in dir
cvs update -P (prune)
Expansion tags Date, Revision, Id, Source, Log; all surrounded by '$'.
Move a file just delete and add it with a new name - but log info is lost!
Use the 'Log' expansion to preserve it - sort of - just within the file.
View the log cvs log
View diffs from 2 versions cvs diff -r 1.3 -r 1.4 the_file_name
View diff vs a tag cvs diff -r tag_name the_file_name
View status, dates and such for a file cvs status

Starting a new project

cvs import -m "log msg" project_name vendor_tag release_tag

This checks in the files in the current directory into $CVSROOT/project_name

Checking out a project

cvs checkout project_name

This checks out the project into ./project_name. Therefore, if you change directories and do this again, it checks out another entire set into that directory. The files are all writeable unless you do cvs -r checkout project_name.

If you've changed a file, it won't get clobbered.

Rolling back

cvs update -D "2004-08-14 21:39:21 GMT" - roll back to this time. The time is optional. Note, the timestamps shown in status and log are GMT, hence you need GMT in the command. Once you this, a 'sticky date' is set. You can't commit changes. To get back to normal, do cvs -q update -A

There are fancy ways to specify the date, such as ==-D "3 days ago"

Tags

cvs tag tag_name - attaches a tag for the current setup. So, if you've rolled back to an earlier date, you can tag this date

cvs update -r  tag_name - updates directory to the tag. You also have to do cvs update -A to get back to where you can check stuff in and out.

Getting the latest stuff

cvs update

This checks to see which files in . have changed. If you've changed them, it marks them with a M but does nothing with them. If you've deleted a file, it will replace it. If you have modified the file, it will not clobber it. But if someone else has, it will be clobbered.

cvs update -p -r 1.3 some_file - dump revision 1.3 of some_file to the stdout. The crufty preamble goes to stderr, so you can redirect safely (or you can use -Q). To do a rollback, simply redirect this to the file.

cvs update -d - get the latest, including any new directories that have been created.

How to move files and keep the history

In the repository, copy (don't move) the RCS files to the desired new location in the project. They must remain in their old locations as well. Then, in a working copy, do:

rm oldfile1 oldfile2
cvs remove oldfile1 oldfiles
cvs commit -m "removed from here" oldfile1 oldfile2

Default Options

Put stuff in .cvsrc. For example, if you have

diff -c
update -P
cvs -q

diff will always include context, update will prune blank directories, and cvs will be fairly quiet.

-- MattWalsh - 14 Aug 2004

Topic revision: r1 - 14 Aug 2004 - 22:25:00 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback