|
Continuing CVS: Tags, Branches, triggers and CVSWEB. Table of Contents
1. CVS
1.1 CVS?
1.2 Where can I get started with CVS?
2. Tagging
2.1 Tagging?
2.2 cvs tag
2.3 cvs rtag
2.4 Retrieving a tag later.
3. Branching
3.1 Branching?
3.2 cvs tag -b
3.3 cvs rtag -b
3.4 Obtaining a working copy of the branch
4. Merging
4.1 Merging?
4.2 What CVS doesn't do.
4.3 What you do.
5. Triggers
5.1 Triggers?
5.2 commitinfo checks
5.3 loginfo scripts.
5. CVSWEB
5.1 CVSWEB?
1. CVS 1.1 CVS? 1.2 Where can I get started with CVS? 2. Tagging 2.1 Tagging 2.2 cvs tag
~/ doc@flaherty $ cd cvswork/MyProject/
~/cvswork/MyProject/ doc@flaherty $ cvs tag v0_2beta1
cvs tag: Tagging .
cvs tag: Tagging doc
T doc/INSTALL
T doc/README
cvs tag: Tagging src
T src/main.c
T src/main.h
T src/something.c
T src/something.h
~/cvswork/MyProject/ doc@flaherty $
I cd into the base of the working directory, and issue the
tag command. This tags the MyProject module with the
v0_2beta1 identifier.
2.3 cvs rtag
~/ doc@flaherty $ cvs rtag v0_2beta1 MyProject
cvs rtag: Tagging MyProject
cvs rtag: Tagging MyProject/doc
cvs rtag: Tagging MyProject/src
The project is now tagged, in the exact same way as it would
have been if I had used 'cvs tag' as above.
That's as simple and as difficult as tagging gets. 2.4 Retrieving a tag later.
~/scratch/ doc@flaherty $ cvs checkout -rv0_2beta1 MyProject
cvs checkout: Updating MyProject
cvs checkout: Updating MyProject/doc
U MyProject/doc/INSTALL
U MyProject/doc/README
cvs checkout: Updating MyProject/src
U MyProject/src/main.c
U MyProject/src/main.h
U MyProject/src/something.c
U MyProject/src/something.h
You now have your code, as it was when it was tagged as
v0_2beta1.
3. Branching 3.1 Branching 3.2 cvs tag -b
~/ doc@flaherty $ cd cvswork/MyProject/
~/cvswork/MyProject/ doc@flaherty $ cvs tag -b v0_2_bugfix
cvs tag: Tagging .
cvs tag: Tagging doc
T doc/INSTALL
T doc/README
cvs tag: Tagging src
T src/main.c
T src/main.h
T src/something.c
T src/something.h
The code is now branched.
3.3 cvs rtag -b 3.4 Obtaining a working copy of the branch 4. Merging 4.1 Merging? 4.2 What CVS doesn't do 4.3 What you do.
~/mrgdir/ doc@flaherty $ cvs co MyProject
cvs checkout: Updating MyProject
cvs checkout: Updating MyProject/doc
U MyProject/doc/INSTALL
U MyProject/doc/README
cvs checkout: Updating MyProject/src
U MyProject/src/main.c
U MyProject/src/main.h
U MyProject/src/something.c
U MyProject/src/something.h
Now, we want to try to merge the two branches. This can be
done for individual files, but we'll do it for the entire
module here, since I know only one file will cause issues.
~/mrgdir/MyProject/ doc@flaherty $ cvs update -j v0_2_bugfix
cvs update: Updating .
cvs update: Updating doc
cvs update: Updating src
RCS file: /usr/local/cvsroot/MyProject/src/main.c,v
retrieving revision 1.1
retrieving revision 1.1.2.1
Merging differences between 1.1 and 1.1.2.1 into main.c
rcsmerge: warning: conflicts during merge
CVS is telling us that we need to merge some differences
manually. So, we look at the src directory:
~/mrgdir/MyProject/src/ doc@flaherty $ ls -al
total 10
drwx------ 3 doc 1002 512 Aug 27 21:50 .
-rw------- 1 doc 1002 83 Aug 27 21:40 .#main.c.1.2
drwx------ 5 doc 1002 512 Aug 27 21:50 ..
drwx------ 2 doc 1002 512 Aug 27 21:50 CVS
-rw-r--r-- 1 doc 1002 212 Aug 27 21:50 main.c
-rw-r--r-- 1 doc 1002 0 Aug 27 21:04 main.h
-rw-r--r-- 1 doc 1002 0 Aug 27 21:04 something.c
-rw-r--r-- 1 doc 1002 0 Aug 27 21:04 something.h
CVS saves our copy of main.c as '.#main.c.1.2' (1.2 is the
revision number of main.c in HEAD). main.c looks like this:
<<<<<<< main.c
#include <stdio.h>
int main(void)
{
printf("This is MyProject Version 0.3n");
}
=======
#include <stdio.h>
int main(void)
{
printf("This is MyProject Version 0.2-bugfixn");
}
>>>>>>> 1.1.2.1
So, it looks pretty basic (although manual merges can get
quite complex!). Merge the changes in the file. When you're
done, commit the merged code from this working directory.
It will be committed into HEAD.
Once all merges are taken care of, you've merged v0_2_bugfix
into HEAD. The branch tag is still there, but it can be
ignored, once nobody is committing to it.
5. Triggers 5.1 Triggers? 5.2 commitinfo checks
/file regex/ /path/to/program
If the name of the file being committed matches the regex
(relative to the CVSROOT directory on the server), then the
program is run. The full path to the directory the file is
in on the server, and the filename itself are appended to
any arguments you supply to the script. For example, I add
this to my $CVSROOT/commitino file:
^MyProject /root/scripts/blah.pl
Now, whenever I commit a file in MyProject, /root/scripts/blah.pl
is run, with arguments being the directory the files I'm
commiting are in on the server, and then a list of files
being committed. The contents of blah.pl are left as an
exercise to the reader.
5.3 loginfo scripts.
^MyProject cat | mail someguys@mycompany.com
In loginfo entries, the log entered for the commit is the
stdin of the program run. The following identifiers are
also expanded:
%s : The filename committed.
%V : The old version number of the file.
%v : The new version number of the file.
The above example will send an email on each successful commit.
6. CVSWEB 6.1 CVSWEB? | |