Setting up your environment for CVS:
* Set environment variables: (add to your .bashrc file)
Environment variables:
export CVSROOT='/home/Project/CVS_root' - directory for CVS source code repository
export CVSEDITOR=/bin/vi
* Set environment variables: (add to your .cshrc file) (for csh users)
Environment variables:
setenv CVSROOT '/home/Project/CVS_root'
setenv CVSEDITOR /bin/vi
* CVSROOT: Location of CV source code repository.
----------
Checkout:
cvs co ProgABC
In this case, module "ProgABC" is a directory which will be created in your current directory with all the appropriate sub-directories and files.
The files/directories to checkout can be refered to by module name or relative path name from $CVSROOT.
To checkout a particular (previous) release or build:
cvs co -r Rel-1A ProgABC
This will checkout the files necessary for the previous build for Rel-1A. The release or "tag" name in this example is "Rel-1A".
cvs edit ProgABC/file.c
This pulls out a single file for editing without getting the whole project.
cvs unedit ProgABC/file.c
Abandon work on file.
--------------
History/Status:
Status of checked out working repository.
cvs status [-v] ProgABC/file.c
OR
cvs status [-v] ProgABC
Option "-v": Print tag information.
--------------
Check-in / Commit:
When done editing the files check-in (commit) your changes:
Check in files from within the directory. i.e. file.c must be in your current working directory.
cvs ci file.c
OR
cvs ci -m "Put text description here" file.c
OR
cvs ci -m "Put text description here" ProgABC
The second check-in example will commit the entire module. (Files, directory structure and all)
Cleanup and get rid of all the files:
cvs release -d ProgABC
The flag -d will delete all of your working sub-directories. Cvs will let you know if files have changed and prompt you for a [y/n] reply.
Add a new file to your project:
cvs add file.c
Delete a file/directory from your project:
cvs delete file.c
The additions/deletions only fully take place after a check-in (commit) of the repository is performed.
-------------
Modules:
The term "ProgABC" in our example is the name of a module as defined by the modules file found in CVSROOT/modules. To add a new module:
cvs co CVSROOT/modules
cd CVSROOT
vi modules - Add module name and path to file
Then update changes:
cvs ci -m "Add comments here" modules
cd ..
cvs release -d CVSROOT
The module "ProgABC" is a short name for "$CVSROOT/Prog/TypeA/ProgABC"
--------------
Tagging a build/revision
Tag a revision such that the current build is known to be made up of particular releases of various files.
cvs tag Rel-1A ProgABC
Where Rel-1A is the tag name for the build of module "ProgABC"
Tag a repository (directory/module) to add the symbolic name to the "snapshot" of the current sources. Tag the repository before check-in.
If bug fixes are added afterwards, only those files which have been changed need be re-tagged.
To relocate a tag that already exists to a newer set of code:
cvs tag -F Rel-1A ProgABC
to get source of a branch:
cvs -r co -r <branch_or_tag_name> <modulename>
ex: cvs -r co -r BRANCH_VERSION_1_14 nuport
--
Check Out Tagged Version of ProjectX
Now let's move up a directory and remove the entire ProjectX sandbox
environment:
% cd ..
% ls
ProjectX/
% rm -rf ProjectX
After removing our sandbox, let's see how to check out only those files
(actually, there is only one file in our example named TestDocument.doc) into
a sandbox area. To checkout files that belong to a tag, use the -r option of
the cvs tag command:
% cvs co -r Prod1 ProjectX
cvs checkout: Updating ProjectX
cvs checkout: Updating ProjectX/documents
U ProjectX/documents/TestDocument.doc
cvs checkout: Updating ProjectX/new_stuff
cvs checkout: Updating ProjectX/new_stuff2
% cd ProjectX
If you were to take a look at the sandbox that you checked out, there is only
one file and that is documents/TestDocument.doc as this is the only file in
our module that is contained within the Prod1 tag.
--
The easiest way to determine which tags exist on a file, is to use the cvs
status -v command. Let's give an example of that:
% cvs status -v documents/TestDocument.doc
===================================================================
File: TestDocument.doc Status: Up-to-date
Working revision: 1.4 Tue Jun 1 22:27:14 2004
Repository revision: 1.4
c:/var/lib/cvsrepos/ProjectX/documents/TestDocument.doc,v
Expansion option: b
Commit Identifier: 92840bd02c10000
Sticky Tag: Prod1 (revision: 1.4)
Sticky Date: (none)
Sticky Options: -kb
Merge From: (none)
Existing Tags:
Prod1 (revision: 1.4)
As you can see, the cvs status command provides a wealth of information about
files in CVS. In particular, we were looking for which tags where made on this
file. (Keep in mind that a single revision of a file can be marked by many
different tag names. For example, The same revision of the file (1.4 in our
example above), can contain tag names like Prod1, QA1, Dev1. All of these tags
would refer to the same file and revision.)
--
View Tag Information using cvs log
We can also use the cvs log command to determine which tags are marked on this
file. Let's give an example of that:
% cvs log -h documents/TestDocument.doc
RCS file: c:/var/lib/cvsrepos/ProjectX/documents/TestDocument.doc,v
Working file: documents/TestDocument.doc
head: 1.4
branch:
locks: strict
access list:
symbolic names:
Prod1: 1.4
keyword substitution: b
total revisions: 4
=============================================================================
As you can see, the cvs log command provides a wealth of information about
files in CVS. In particular, we were looking for which tags where made on this
file. (Keep in mind that a single revision of a file can be marked by many
different tag names. For example, The same revision of the file (1.4 in our
example above), can contain tag names like Prod1, QA1, Dev1. All of these tags
would refer to the same file and revision.)
--
Remove the Prod1 Tag
Now that we have played around with this one file, let's see how we would
remove a tag from a file (or group of files). For this example, I want to
remove the Prod1 tag name from documents/TestDocument.doc. To do this, we
would use the -d option of the cvs tag command:
% cvs tag -d Prod1 documents/TestDocument.doc
D documents/TestDocument.doc
--
-------------
Diff:
cvs diff file.c
This will compare the version of the file in your working directory with that of the original you checked out.
The following will compare the two revisions of the file.
cvs diff -r 1.1 -r 1.2 file.c
----------------
Starting a new project:
To put your project under cvs control:
Check in files from within the directory. Files must be in your current working directory. The directory referenced is the tree structure for CVS not your current path.
cvs import -m "Put text description here" cv/Working_Dir CSC start
This will place the files in your current working directory and recursively the directory structure below the current, under cvs control. CSC is a "vendor tag". start is a "release tag". The directory structure will be $CVSROOT/Proj/Working_Dir
------------------
Export:
This is to get a copy of the sources and directories with the intent that the files will not be altered but shipped off site. Code extracted from cvs with export cannot be checked-in because export does not create any administrative entries.
A tag must be specified. Thus an original release would be extracted by:
cvs export -r start ProgABC
Start is the name of the first entry into cvs. See import.
--------------
Creating CVS repository for the first time:
cvs -d /home/Project/CVS_root init
-d: Directory used for repository
------------------
The options for the cvs log command are available here. Specifically, to get
all the commits since a specific tag (lets call it VERSION_1_0)
cvs log -rVERSION_1_0:
If your goal is to have a command that works without having to know the name
of the last tag I believe you will need to write a script that grabs the log
for the current branch, parses through to find the tag, then issues the log
command against that tag, but I migrated everything off of CVS quite a while
ago, so my memory might be a bit rusty.
-----------
To determine what tags apply to a particular file use:
cvs log <filename>
This will output all the versions of the file and what tags have been applied
to the version.
To determine what files are included in a single tag, the only thing I can
think of is to check out using the tag and see what files come back. The
command for that is any of:
cvs update -r <tagname>
cvs co <modulename> -r <tagname>
cvs export <modulename> -r <tagname>
---
To list tags on a file one can also do:
cvs status -v <file>
----
The following command gives a list of files that are in that tag
"yourTagName". The files are all marked as new, the revision info in
"yourTagName".
This command does a diff between 2000-01-01 and your tag, feel free to use
another date that is earlier.
cvs -q rdiff -s -D 2000-01-01 -r yourTagName
---
the method quoted above didn't work for me
cvs -q rdiff -s -D 2000-01-01 -r yourTagName
however after a lot of messing around I've realised that
cvs -q rdiff -s -D 2000-01-01 -r yourTagName ModuleName
works
------------------
removing a file is similar to adding one, except there's an extra step: You
have to remove the file from the working copy first:
floss$ rm newfile.c
floss$ cvs remove newfile.c
cvs remove: scheduling 'newfile.c' for removal
cvs remove: use 'cvs commit' to remove this file permanently
floss$ cvs ci -m "removed newfile.c" newfile.c
Removing newfile.c;
/usr/local/cvs/myproj/newfile.c,v <- newfile.c
new revision: delete; previous revision: 1.1
done
floss$
--
--------
remove directory/folder
cvs remove -Rf custom_releases
cvs commit custom_releases
cvs update -dP
=> the directory cannot be deleted, but doing this,
in your checked out files, the directory will not be visible.
for the next time, you only need to do,
cvs update -dP
=====================================================
# List of generic CVS commands are useful while checking in/out project
# Date: 16-07-10 by ravikanthg@moschip.com
CVS access commands
-----------------------
1. mkdir /cvs
2. cd /cvs
3. export CVSROOT=:pserver:<username>@192.168.200.231:/data/safe/cvs/soc
4. cvs login
5. cvs co <project name> (ex: nuport)
6. copy the required change files to corresponding directory.
or
7. Adding a new text file to cvs project
cvs add <filename> (ex: newfile.c)
Adding a new binary file to cvs project
cvs add -kb <filename> (ex: newfile.doc)
or
8. cvs remove <filename> (ex: newfile.c)
9. cvs update <filename>
10. cvs commit <filename> (ex: mos7830.c)
11. Tag a directory
Go to directory contains tag directory which need to be tagged.
cvs tag <Name of the tag> <directory name>
12. cvs release -d <project name> (ex: nuport)
Note: some of link explains about CVS commands
1.http://www-e815.fnal.gov/webspace/cvs/commands.html
2.http://glast-ground.slac.stanford.edu/workbook/pages/softwareoverview/commoncvscommands.htm
3.http://www.badgertronics.com/writings/cvs/command-line.html
4.http://www.idevelopment.info/data/Programming/change_management/unix_cvs/PROGRAMMING_CVS_Commands.shtml#Tagging%20Files%20in%20CVS
* Set environment variables: (add to your .bashrc file)
Environment variables:
export CVSROOT='/home/Project/CVS_root' - directory for CVS source code repository
export CVSEDITOR=/bin/vi
* Set environment variables: (add to your .cshrc file) (for csh users)
Environment variables:
setenv CVSROOT '/home/Project/CVS_root'
setenv CVSEDITOR /bin/vi
* CVSROOT: Location of CV source code repository.
----------
Checkout:
cvs co ProgABC
In this case, module "ProgABC" is a directory which will be created in your current directory with all the appropriate sub-directories and files.
The files/directories to checkout can be refered to by module name or relative path name from $CVSROOT.
To checkout a particular (previous) release or build:
cvs co -r Rel-1A ProgABC
This will checkout the files necessary for the previous build for Rel-1A. The release or "tag" name in this example is "Rel-1A".
cvs edit ProgABC/file.c
This pulls out a single file for editing without getting the whole project.
cvs unedit ProgABC/file.c
Abandon work on file.
--------------
History/Status:
Status of checked out working repository.
cvs status [-v] ProgABC/file.c
OR
cvs status [-v] ProgABC
Option "-v": Print tag information.
--------------
Check-in / Commit:
When done editing the files check-in (commit) your changes:
Check in files from within the directory. i.e. file.c must be in your current working directory.
cvs ci file.c
OR
cvs ci -m "Put text description here" file.c
OR
cvs ci -m "Put text description here" ProgABC
The second check-in example will commit the entire module. (Files, directory structure and all)
Cleanup and get rid of all the files:
cvs release -d ProgABC
The flag -d will delete all of your working sub-directories. Cvs will let you know if files have changed and prompt you for a [y/n] reply.
Add a new file to your project:
cvs add file.c
Delete a file/directory from your project:
cvs delete file.c
The additions/deletions only fully take place after a check-in (commit) of the repository is performed.
-------------
Modules:
The term "ProgABC" in our example is the name of a module as defined by the modules file found in CVSROOT/modules. To add a new module:
cvs co CVSROOT/modules
cd CVSROOT
vi modules - Add module name and path to file
Then update changes:
cvs ci -m "Add comments here" modules
cd ..
cvs release -d CVSROOT
The module "ProgABC" is a short name for "$CVSROOT/Prog/TypeA/ProgABC"
--------------
Tagging a build/revision
Tag a revision such that the current build is known to be made up of particular releases of various files.
cvs tag Rel-1A ProgABC
Where Rel-1A is the tag name for the build of module "ProgABC"
Tag a repository (directory/module) to add the symbolic name to the "snapshot" of the current sources. Tag the repository before check-in.
If bug fixes are added afterwards, only those files which have been changed need be re-tagged.
To relocate a tag that already exists to a newer set of code:
cvs tag -F Rel-1A ProgABC
to get source of a branch:
cvs -r co -r <branch_or_tag_name> <modulename>
ex: cvs -r co -r BRANCH_VERSION_1_14 nuport
--
Check Out Tagged Version of ProjectX
Now let's move up a directory and remove the entire ProjectX sandbox
environment:
% cd ..
% ls
ProjectX/
% rm -rf ProjectX
After removing our sandbox, let's see how to check out only those files
(actually, there is only one file in our example named TestDocument.doc) into
a sandbox area. To checkout files that belong to a tag, use the -r option of
the cvs tag command:
% cvs co -r Prod1 ProjectX
cvs checkout: Updating ProjectX
cvs checkout: Updating ProjectX/documents
U ProjectX/documents/TestDocument.doc
cvs checkout: Updating ProjectX/new_stuff
cvs checkout: Updating ProjectX/new_stuff2
% cd ProjectX
If you were to take a look at the sandbox that you checked out, there is only
one file and that is documents/TestDocument.doc as this is the only file in
our module that is contained within the Prod1 tag.
--
The easiest way to determine which tags exist on a file, is to use the cvs
status -v command. Let's give an example of that:
% cvs status -v documents/TestDocument.doc
===================================================================
File: TestDocument.doc Status: Up-to-date
Working revision: 1.4 Tue Jun 1 22:27:14 2004
Repository revision: 1.4
c:/var/lib/cvsrepos/ProjectX/documents/TestDocument.doc,v
Expansion option: b
Commit Identifier: 92840bd02c10000
Sticky Tag: Prod1 (revision: 1.4)
Sticky Date: (none)
Sticky Options: -kb
Merge From: (none)
Existing Tags:
Prod1 (revision: 1.4)
As you can see, the cvs status command provides a wealth of information about
files in CVS. In particular, we were looking for which tags where made on this
file. (Keep in mind that a single revision of a file can be marked by many
different tag names. For example, The same revision of the file (1.4 in our
example above), can contain tag names like Prod1, QA1, Dev1. All of these tags
would refer to the same file and revision.)
--
View Tag Information using cvs log
We can also use the cvs log command to determine which tags are marked on this
file. Let's give an example of that:
% cvs log -h documents/TestDocument.doc
RCS file: c:/var/lib/cvsrepos/ProjectX/documents/TestDocument.doc,v
Working file: documents/TestDocument.doc
head: 1.4
branch:
locks: strict
access list:
symbolic names:
Prod1: 1.4
keyword substitution: b
total revisions: 4
=============================================================================
As you can see, the cvs log command provides a wealth of information about
files in CVS. In particular, we were looking for which tags where made on this
file. (Keep in mind that a single revision of a file can be marked by many
different tag names. For example, The same revision of the file (1.4 in our
example above), can contain tag names like Prod1, QA1, Dev1. All of these tags
would refer to the same file and revision.)
--
Remove the Prod1 Tag
Now that we have played around with this one file, let's see how we would
remove a tag from a file (or group of files). For this example, I want to
remove the Prod1 tag name from documents/TestDocument.doc. To do this, we
would use the -d option of the cvs tag command:
% cvs tag -d Prod1 documents/TestDocument.doc
D documents/TestDocument.doc
--
-------------
Diff:
cvs diff file.c
This will compare the version of the file in your working directory with that of the original you checked out.
The following will compare the two revisions of the file.
cvs diff -r 1.1 -r 1.2 file.c
----------------
Starting a new project:
To put your project under cvs control:
Check in files from within the directory. Files must be in your current working directory. The directory referenced is the tree structure for CVS not your current path.
cvs import -m "Put text description here" cv/Working_Dir CSC start
This will place the files in your current working directory and recursively the directory structure below the current, under cvs control. CSC is a "vendor tag". start is a "release tag". The directory structure will be $CVSROOT/Proj/Working_Dir
------------------
Export:
This is to get a copy of the sources and directories with the intent that the files will not be altered but shipped off site. Code extracted from cvs with export cannot be checked-in because export does not create any administrative entries.
A tag must be specified. Thus an original release would be extracted by:
cvs export -r start ProgABC
Start is the name of the first entry into cvs. See import.
--------------
Creating CVS repository for the first time:
cvs -d /home/Project/CVS_root init
-d: Directory used for repository
------------------
The options for the cvs log command are available here. Specifically, to get
all the commits since a specific tag (lets call it VERSION_1_0)
cvs log -rVERSION_1_0:
If your goal is to have a command that works without having to know the name
of the last tag I believe you will need to write a script that grabs the log
for the current branch, parses through to find the tag, then issues the log
command against that tag, but I migrated everything off of CVS quite a while
ago, so my memory might be a bit rusty.
-----------
To determine what tags apply to a particular file use:
cvs log <filename>
This will output all the versions of the file and what tags have been applied
to the version.
To determine what files are included in a single tag, the only thing I can
think of is to check out using the tag and see what files come back. The
command for that is any of:
cvs update -r <tagname>
cvs co <modulename> -r <tagname>
cvs export <modulename> -r <tagname>
---
To list tags on a file one can also do:
cvs status -v <file>
----
The following command gives a list of files that are in that tag
"yourTagName". The files are all marked as new, the revision info in
"yourTagName".
This command does a diff between 2000-01-01 and your tag, feel free to use
another date that is earlier.
cvs -q rdiff -s -D 2000-01-01 -r yourTagName
---
the method quoted above didn't work for me
cvs -q rdiff -s -D 2000-01-01 -r yourTagName
however after a lot of messing around I've realised that
cvs -q rdiff -s -D 2000-01-01 -r yourTagName ModuleName
works
------------------
removing a file is similar to adding one, except there's an extra step: You
have to remove the file from the working copy first:
floss$ rm newfile.c
floss$ cvs remove newfile.c
cvs remove: scheduling 'newfile.c' for removal
cvs remove: use 'cvs commit' to remove this file permanently
floss$ cvs ci -m "removed newfile.c" newfile.c
Removing newfile.c;
/usr/local/cvs/myproj/newfile.c,v <- newfile.c
new revision: delete; previous revision: 1.1
done
floss$
--
--------
remove directory/folder
cvs remove -Rf custom_releases
cvs commit custom_releases
cvs update -dP
=> the directory cannot be deleted, but doing this,
in your checked out files, the directory will not be visible.
for the next time, you only need to do,
cvs update -dP
=====================================================
# List of generic CVS commands are useful while checking in/out project
# Date: 16-07-10 by ravikanthg@moschip.com
CVS access commands
-----------------------
1. mkdir /cvs
2. cd /cvs
3. export CVSROOT=:pserver:<username>@192.168.200.231:/data/safe/cvs/soc
4. cvs login
5. cvs co <project name> (ex: nuport)
6. copy the required change files to corresponding directory.
or
7. Adding a new text file to cvs project
cvs add <filename> (ex: newfile.c)
Adding a new binary file to cvs project
cvs add -kb <filename> (ex: newfile.doc)
or
8. cvs remove <filename> (ex: newfile.c)
9. cvs update <filename>
10. cvs commit <filename> (ex: mos7830.c)
11. Tag a directory
Go to directory contains tag directory which need to be tagged.
cvs tag <Name of the tag> <directory name>
12. cvs release -d <project name> (ex: nuport)
Note: some of link explains about CVS commands
1.http://www-e815.fnal.gov/webspace/cvs/commands.html
2.http://glast-ground.slac.stanford.edu/workbook/pages/softwareoverview/commoncvscommands.htm
3.http://www.badgertronics.com/writings/cvs/command-line.html
4.http://www.idevelopment.info/data/Programming/change_management/unix_cvs/PROGRAMMING_CVS_Commands.shtml#Tagging%20Files%20in%20CVS
No comments:
Post a Comment