Store a newly created directory "test" with sources into the repository.
Note: You must execute the cvs import command WITHIN the test directory.
|
mkdir test
cd test
create file test/demo1.txt
cvs import -C -n -m "comment" test
|
Retrieve directory "test" from the repository.
|
cvs co test
|
Add a new subdirectory "test/level2" in the repository.
Directory "test" is already in the repository.
|
cvs co test
cd test
mkdir level2
cd level2
cvs import -C -n -m "comment" test/level2
|
Add a file text1.txt in directory "test/level2" in the repository.
|
cvs co test/level2
cd test/level2
create file text1.txt
cvs add text1.txt
cvs commit -m "comment" text1.txt
|
Update file text1.txt in directory "test/level2" in the repository.
|
cvs co test/level2
cd test/level2
update file text1.txt
cvs update text1.txt
cvs commit -m "comment" text1.txt
|
Add multiple files in directory "test/level2" in the repository.
|
cvs co test/level2
cd test/level2
create files text2.txt, text3.txt, text4.txt
cvs add *.txt
cvs commit -m "comment" (All added files get the same comment)
|
Checkout file "test/level2/text1.txt" from repository.
|
cvs co test/level2/text1.txt
|
Show difference between working file "test/level2/text1.txt"
and a revision from repository.
|
cvs co test/level2/text1.txt
cd test/level2
edit file text1.txt
cvs diff -r1.1 text1.txt
You will see something like this:
RCS file: /CVSRepository/test/level2/text1.txt,v
retrieving revision 1.1
diff -r1.1 text1.txt
1c1
< this is a line
\ No newline at end of file
---
> this line is updated
\ No newline at end of file
|
To show all revions and logs of a file use the log command.
|
cvs co test/level2/text1.txt
cd test/level2
cvs log text1.txt
You will see something like this:
RCS file: C:\CVSRepository/test/level2/text1.txt,v
Working file: text1.txt
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
----------------------------
revision 1.2
date: 2004/07/31 08:43:09; author: Mainuser; state: Exp; lines: +1 -0; kopt:
kv; commitid: ddc410b5b96541a; filename: text1.txt;
Update
----------------------------
revision 1.1
date: 2004/07/31 08:38:00; author: Mainuser; state: Exp; kopt: kv; commitid:
338410b5a5e501f; filename: text1.txt;
comment
|
Show difference of file "test/level2/text1.txt"
between 2 existing revisions from repository.
|
cvs co test/level2/text1.txt
cvs diff -r1.1 -r1.3 test/level2/text1.txt
|
Synchronize your checked out tree with the repository.
Check which files are newly created and/or modified.
Here below an overview of the file status:
?
the file is not maintained by CVS.
M
your checked-out version differs from the original (i.e., you edited it).
U
your checked-out version is out-of-date and needs updating.
C
potential conflict. You have changed this file and the source in the repository has also changed.
File not listed
your source is the same as that in the repository.
|
cvs co test/level2
cd test/level2
update file text4.txt
add file text5.txt
create directory test/level2/level3
add file test/level2/level3/fly1.txt
cvs update (execute this command in test/level2)
You will see something like this:
? level3
? text5.txt
cvs server: Updating .
M text4.txt
To commit all files in the repository, you should
execute the following commands from within directory "test/level2":
== file text4.txt ==
cvs commit -m "comment" text4.txt
== file text5.txt ==
cvs add text5.txt
cvs commit -m "comment" text5.txt
== directory level3 ==
cd level3
cvs import -C -n -m "comment" test/level2/level3
|
Add binary file "test/demo.jpg" in the repository.
A binary file won't have CVS keyword expansion performed on it.
Note: if you have updated the cvswrappers file, see
quick guide Setup cvswrappers file
you do not have to use the -kb option.
|
cvs co test
cd test
cvs add -kb demo.jpg
cvs commit -m "comment" demo.jpg
|
Change a file to be treated as a binary file after it's been added in the repository.
A binary file won't have CVS keyword expansion performed on it.
Note: if you have updated the cvswrappers file, see
quick guide Setup cvswrappers file
you do not have to use the admin command.
|
cvs co test
cd test
cvs add demo2.jpg
cvs commit -m "comment" demo2.jpg
cvs admin -kb demo2.jpg
|
How to verify if a file is treated as a binary file.
A binary file won't have CVS keyword expansion performed on it.
|
cvs co test/demo.jpg
cd test
cvs log demo.jpg
You will see something like this:
keyword substitution: b
|
Revert updated file "test/level2/text1.txt" to its last checked-in revision.
|
cvs co test/level2
cd test/level2
edit file text1.txt
cvs update -C text1.txt
The last checked in version of text1.txt is restored and
the updated file is renamed into: .#text1.txt.<new_revision_number>
|
Display history of file "test/level2/text1.txt" starting from yesterday.
Note: The "-D" option is available with the annotate, checkout, diff,
export, history, log, ls, rannotate, rdiff, rlog, rtag, tag and
update commands. Examples of valid date specifications include:
1 month ago
2 hours ago
400000 seconds ago
last year
last Monday
yesterday
a fortnight ago
3/31/92 10:00:07 PST
January 23, 1987 10:05pm
22:00 GMT
|
cvs co test/level2
cd test/level2
cvs history -m test -D "yesterday" text1.txt
You will see something like this:
U 2006-07-06 11:07 +0000 Mainuser 1.6 text1.txt test/level2 == C:\test\level2
|
What to do when a conflict occurs?
|
cvs co test
cd test
edit file demo1.txt
cvs update demo1.txt
If another user commited an updated version of this file in the repository,
you will see something like this:
RCS file: /CVSRepository/test/demo1.txt,v
retrieving revision 1.3
retrieving revision 1.4
Merging differences between 1.3 and 1.4 into demo1.txt
rcsmerge: warning: conflicts during merge
cvs server: conflicts found in demo1.txt
C demo1.txt
Your working file has been renamed into: .#demo1.txt.1.3
for backup purpose.
The created file demo1.txt contains special markers:
<<<<<<<< demo1.txt
The plane has 4 wings.
=======
The plane has 2 wongs.
>>>>>>>> 1.4
What you should do is the following:
The line between
"<<<<<<<< demo1.txt" and "=======" contains
YOUR modification.
The line between
"=======" and "<<<<<<<< 1.4" contains
the modification already in the repository.
You must decide which is correct and edit THIS file.
Remove all the markers "<<<<<<<< demo1.txt"
"=======", and "<<<<<<<< 1.4"
For example: The plane has 2 wings.
cvs commit -m "comment" demo1.txt
Note: You can leave or remove file .#demo1.txt.1.3
|
If you want to update the current directory and all existing subdirectories, type:
|
cvs co test/level2/text1.txt
cd test/level2
edit file text1.txt
cvs update -d
You will see something like this:
cvs update: Updating .
M text1.txt
U text2.txt
U text3.txt
U text4.txt
U text5.txt
cvs update: Updating level3
U level3/fly1.txt
The files text2.txt, text3.txt, text4.txt and text5.txt are checked out.
The folder level3 is created and file fly1.txt is checked out.
The modified file text1.txt is not replaced with the last checked-in version.
To checkin text1.txt in the repository:
cvs commit -m "comment" text1.txt
|
Checkout module "test" from the repository without CVS directories and
administrative files.
|
cvs export -D "today" test
|
Tag test/level2/level3/fly1.txt with "myfirst" tag.
|
cvs co test/level2/level3
cvs tag myfirst
You will see something like this:
cvs tag: Tagging test
cvs tag: Tagging test/level2
cvs tag: Tagging test/level2/level3
T test/level2/level3/fly1.txt
To verify if the tag is applied:
cvs log test/level2/level3/fly1.txt
You will see something like this:
RCS file: C:\CVSRepository/test/level2/level3/fly1.txt,v
Working file: test/level2/level3/fly1.txt
head: 1.2
branch:
locks: strict
access list:
symbolic names:
myfirst: 1.2
keyword substitution: kv
:
|
Checkout module test with tag myfirst.
|
cvs co -r myfirst test
You will see something like this:
cvs checkout: Updating test
cvs checkout: Updating test/level2
cvs checkout: Updating test/level2/level3
U test/level2/level3/fly1.txt
|
Move an existing tag myfirst on file fly1.txt (revision 1.2) to another
revision 1.3.
|
cvs co test/level2/level3/fly1.txt
cd test/level2/level3
edit fly1.txt
cvs commit -m "comment" fly1.txt
You will see something like this:
Checking in fly1.txt;
C:\CVSRepository/test/level2/level3/fly1.txt,v <-- fly1.txt
new revision: 1.3; previous revision: 1.2
done
To move the tag:
cvs tag -F -r 1.3 myfirst fly1.txt
You will see something like this:
T fly1.txt
To verify if the tag is moved:
cvs log fly1.txt
You will see something like this:
RCS file: C:\CVSRepository/test/level2/level3/fly1.txt,v
Working file: fly1.txt
head: 1.3
branch:
locks: strict
access list:
symbolic names:
myfirst: 1.3
keyword substitution: kv
:
|