CVSNT

 
 
CVS (Concurrent Versions System) is an open-source network-transparent version control system for individual developers to large, distributed teams.

CVSNT is made available under the terms of the GNU General Public License and can be installed on Windows (NT, 2000, XP) Linux and Unix installations.

The latest CVSNT version can be downloaded from: http://www.cvsnt.org

A GUI front-end for CVS can be downloaded from: http://www.wincvs.org/

rss feed






Using CVS keywords



Information
CVS can perform certain textual substitutions in files, allowing you to keep some kinds of information automatically up to date in your files. All of the substitutions are triggered by a certain keyword pattern, surrounded by dollar signs. CVS keywords are usually used as comments in the header of source code.

CVS keywords should NOT be expanded if these keywords coincidentally appears in binary files.

To add a binary file to the repository: cvs add -kb filename
To change the filetype in the repository: cvs admin -kb filename

Operating system used
Windows XP Home Edition Version 5.1 SP 2

Software prerequisites
CVSNT


Procedure
  1. An overview of all the CVS keywords:

    CVS keyword Description
    $Author$ The user who checked in the revision.

    $Author: Mainuser $
    $Date$ The date and time the revision was checked in.

    $Date: 2006/07/06 00:16:27 $
    $Header$ A standard header containing the full pathname of the RCS file, the revision number, the date/time of last change, the author, the state, and the locker (if locked).

    Note: Files will normally never be locked when you use CVS.

    $Header: C:/CVSRepository/Demo/src/com/mobilefish/demo/Hello.java,v 1.2 2006/07/06 00:16:27 Mainuser Exp $
    $Id$ Same as $Header$ but without the full pathname of the RCS file.

    $Id: Hello.java,v 1.2 2006/07/06 00:16:27 Mainuser Exp $
    $Log$ The header containing the RCS filename, the revision number, the date/time of last change, the author followed by the actual log message supplied during commit. Existing log messages are not replaced.

    $Log: Hello.java,v $
    Revision 1.2 2006/07/06 00:16:27 Mainuser
    Add two exclamation marks
    $Locker$ The user who locked the revision, otherwise blank.
    Locking a revision usually does not happen.

    $Locker: Mainuser $
    $Name$ If a tag name is used to check out this file, the name of that tag is displayed, otherwise blank.

    For example: cvs co -r 20060704_004

    $Name: 20060704_004 $
    $RCSfile$ The name of the RCS file.

    $RCSfile: Hello.java,v $
    $Revision$ The revision number.

    $Revision: 1.2 $
    $Source$ The full pathname of the RCS file.

    $Source: C:/CVSRepository/Demo/src/com/mobilefish/demo/Hello.java,v $
    $State$ The state assigned to the revision.

    $State: Exp $




  2. An example of how to use the keywords, add in the header of the java file the following comment block:

    /*
     * $Author$
     * $Date$
     * $Header$
     * $Id$
     * $Log$
     * $Locker$
     * $Name$
     * $RCSfile
     * $Revision
     * $Source
     * $State
     *
     */


    package com.mobilefish.demo;

    public class Hello {

          public static void main(String[] args) {
          System.out.println("Hello World!");
       }
    }


  3. After you committed the file into the repository:

    /*
     * $Author: Mainuser $
     * $Date: 2006/07/06 00:16:27 $
     * $Header: C:/CVSRepository/Demo/src/com/mobilefish/demo/Hello.java,v 1.2
       2006/07/06 00:16:27 Mainuser Exp $
     * $Id: Hello.java,v 1.2 2006/07/06 00:16:27 Mainuser Exp $
     * $Log: Hello.java,v $
     * Revision 1.2 2006/07/06 00:16:27 Mainuser
     * Add two exclamation marks
     *
     * Revision 1.1 2006/07/05 23:35:32 Mainuser
     * initial version
     *
     * $Locker$
     * $Name$
     * $RCSfile: Hello.java,v $
     * $Revision: 1.2 $
     * $Source: C:/CVSRepository/Demo/src/com/mobilefish/demo/Hello.java,v $
     * $State: Exp $
     *
     */


    package com.mobilefish.demo;

    public class Hello {

          public static void main(String[] args) {
          System.out.println("Hello World!!");
       }
    }


  4. Personally i like the following two headers.

    For proprietary code:

    /*
     * $Log$
     *
     * Copyright 2006 Mobilefish.com. All Rights Reserved.
     *
     * This software is the proprietary information of Mobilefish.com.
     * Use is subject to license terms.
     *
     */


    For open source code:

    /*
     * $Log$
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
     *
     */


  5. For more information see quick guide: "How to use CVS"