Friday 26 December 2014

CVS commands - create repository, add project, checkout source code, cvs diff, commit, tag, create and merge branch. CVS codes - ?, A, C, M, P, U, R


Create a repository with name ‘cvsRepository’:

                cvs -d path_to_repository init
                Eg: cvs -d /usr/local/cvsRepository init

Tell CVS where your repository is:

                setenv CVSROOT path_to_repository
                Eg: setenv CVSROOT /usr/local/cvsRepository
                                (or)
                export CVSROOT=path_to_repository
                Eg: export CVSROOT=/usr/local/cvsRepository

Add project 'proj' to repository:
                
Somewhere in your home directory execute the below commands:
               1.       mkdir proj
               2.       cd proj
               3.       cvs import proj vendor_tag release_tag
               4.       cvs co proj
               5.       Create file and folders that need to be in project
               6.       cvs add subfolders/files (need to commit if files)
                      [
                       To add all the folders recursively: 
                                find . -type d -print | grep -v CVS | xargs cvs add
                       To add all the files recursively:
                                find . -type f -print | grep -v CVS | xargs cvs add
                      ]
                                    
Getting the source:
           
                if CVSROOT is set:
                                cvs checkout proj
                if CVSROOT is not set:
                                cvs -d path_to_repository checkout proj

Viewing differences:

                Diff one or more files:
                                cvs diff file1 file2 file3
                Diff entire directory:
                                cvs diff
               
Committing your changes:

                Commit one or more files:
                                cvs commit file1 file2 file3
                Commit along with log message:
                                cvs commit -m "Fixed so and so bug" file1 file2 file3
                Commit the changes in the entire directory:
                                cvs commit

Tagging:
                Tag one or more files:
                                cvs tag tag_name file1 file2 file3
                Tag entire directory:
                                cvs tag tag_name
               
Creating branch:

                Mark base point for the branch in Trunk:
                                cvs tag base_tag_name
                Create branch:
                                cvs tag -r base_tag_name -b branch_name 
                Mark the start point of the branch in branch:
                                cvs tag branch_start_tag_name

Merging branch:

                1. cvs tag branch_end_tag_name
                2. cvs co -r HEAD proj
                3. cvs -d up -j branch_start_tag_name -j branch_end_tag_name
                4. cvs up -d
                5. cvs diff -r branch_start_tag_name -r branch_end_tag_name > branch_diff
                6. cvs diff > cvs_diff

                7. If branch_diff & cvs_diff are same
                                cvs commit


Code (Meaning) - Description

? (what?) - It's not a file in CVS. CVS knows nothing about this file

A (Added) - This is a file you just added to CVS but not yet committed. You have to commit it before others can see it.

C (Conflicted) - A Conflict occurred when you did CVS update. The conflicted lines are marked with special characters and you need to manually resolve the conflicts.

M (Modified) - You have modified this file. It's different from what's in CVS and you need to commit (check in) the file to persist your changes in CVS

P (Patched) - This file was patched when you did CVS update. The effect is the same as U (update), but the changes were so small that CVS decided to send a patch (P) instead of a whole file (U).

U (Updated) - This file was updated when you ran CVS update. It could be a file that already existed on the local drive, or a new file brought down from the CVS repository.

R (Removed) - You asked CVS to remove this file but you haven't committed the removal.




No comments:

Post a Comment