注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

骇客归来

ぁ枫あ

 
 
 

日志

 
 

Using CVS keywords  

2007-09-27 15:03:21|  分类: cvs |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

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

Related information:

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"
  评论这张
 
阅读(72)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017