如何在*.CS文件中加入版本跟踪信息?

说起来很惭愧,一直以来竟然不知道VSS的这个功能。在 博客园 看到一个随笔提到了这个功能,但是描述的不尽详细,我也是询问了一个同事才知道如何正确的配置VSS来实现这个功能,这里面简要的分享给大家,希望能有所帮助。

以前使用CVS知道里面有几个宏参数可以使用,比如:$Header$等等,但并不知道VSS中也可以使用,Google了一下,发现在VSS中可以使用如下:

** Type this keyword **

|

** To add the following **

---|---

$Archive: $

|

VSS archive file location

$Author: $

|

User who last changed the file

$Date: $

|

Date and time of last check in

$ Header : $

|

Logfile, Revision, Date, Author

$History: $

|

File history, VSS format

$JustDate: $

|

Date, without the time addendum.

$Log: $

|

File history, RCS format

$Logfile: $

|

Same as Archive

$Modtime: $

|

Date and time of last modification

$Revision: $

|

VSS version number

$Workfile: $

|

File name

$NoKeywords: $

|

No keyword expansion for all keywords that follow

首先用 Admin 登录 VSS 的系统管理界面,选择“Options”:

做如下设置:

接着每个开发者的 VSS 都必须是 **VSS6.0 d ** , 如果不是,就需要更新!VSS6.0c不可以。

最后需要在每一个 .CS 文件的 ** 最开头 ** 加入如下代码:

/*

$Header$
$Author$
$Date$
$Revision$

$History$

*/

这样,每次更改之后就会自动出现如下历史信息( ** 请不要手动去更改 ** ):

/*

$Header: /Development/DailyReport/frmMain.cs 13 05-01-14 10:27 Uestc95 $

$Author: Uestc95 $

$Date: 05-01-14 10:27 $

$Revision: 13 $

$History: frmMain.cs $

  • ***************** Version 13 *****************

  • User: Uestc95 Date: 05-01-14 Time: 10:27

  • Updated in $/Development/DailyReport

  • ***************** Version 12 *****************

  • User: Uestc95 Date: 05-01-14 Time: 10:25

  • Updated in $/Development/DailyReport

  • ***************** Version 11 *****************

  • User: Uestc95 Date: 05-01-14 Time: 10:06

  • Updated in $/Development/DailyReport

*/


Published At
Categories with Web编程
Tagged with
comments powered by Disqus