Keyword Expansion Support

Visual SourceSafe supports keyword expansion, a process that enhances with version-specific information certain keywords that you place in your text and HTML files. When you add or check in a file that contains these keywords, in comments, Visual SourceSafe looks for the keywords and automatically places relevant version-specific information after them. For example, the string $Revision: $ tells Visual SourceSafe to expand the Revision keyword automatically with the current file version number.

Note

By default, keyword expansion is disabled for all files. Your Visual SourceSafe Administrator must enable keyword expansion. For more information, see How to: Enable Keyword Expansion.

Standard Visual SourceSafe Keywords

The following table lists all Visual SourceSafe keywords. Some of the keywords are redundant, either for convenience or for backward compatibility with other version control systems, such as the UNIX utility RCS. For more information about setting up a text file for keyword expansion, see How to: Use Keyword Expansion in a Text or HTML File.

Note

Keywords are case-sensitive. Use the capitalization exactly as shown.

  • $Archive: $
    Specifies the Visual SourceSafe archive file location.
  • $Author: $
    Specifies the user who last changed the file.
  • $Date: $
    Specifies the date and time of the last check-in.
  • $Header: $
    Specifies a header in the form: Logfile, Revision, Date, Author.
  • $History: $
    Specifies file history in Visual SourceSafe format.
  • $JustDate: $
    Specifies a simple date, without a time.
  • $Log: $
    Specifies a file history in RCS format.
  • $Logfile: $
    Same as Archive keyword.
  • $Modtime: $
    Specifies the date and time of the last modification.
  • $Revision: $
    Specifies a Visual SourceSafe version number.
  • $Workfile: $
    Specifies the file name.
  • $NoKeywords: $
    Specifies that there is no keyword expansion for all keywords that follow.

For example, you might place the following in a file:

$Revision: $

When you check in the file, Visual SourceSafe replaces the revision specification with:

$Revision: 23 $

The next time that you check in the file, the 23 is replaced by a 24, and so on. Without running Visual SourceSafe, you can always look at the top of your file to see the version of your copy of the file.

Visual SourceSafe Keywords for HTML Files

Visual SourceSafe keywords for HTML are identical to standard Visual SourceSafe keywords, except that they have an additional dollar sign in front of them. An example is $$JustDate: $ for HTML, instead of $JustDate: $. These keywords are intended for use only in HTML files, and should not be used in non-HTML files. For more information about setting up an HTML file for keyword expansion, see How to: Use Keyword Expansion in a Text or HTML File.

Spacing for Keywords

By default, Visual SourceSafe replaces the space between a keyword and the subsequent dollar sign with the value you have specified. However, this can make it difficult to create an attractive columnar display.

To fix this, you can place two colons instead of one after the keyword and then add the amount of space that you want displayed. This tells Visual SourceSafe that the dollar sign after the keyword is exactly where you want it. Visual SourceSafe either adds space or truncates the value to ensure that the columns stay intact. Here is an example of specifying a keyword to fix the spacing:

$Revision::     $

Visual SourceSafe expands the keyword with the version number of the file, and keeps the additional space you add inside the dollar sign character so that the revision number column maintains its width.

Note

The keyword spacing feature is useful when you want to embed keyword information in binary files in which the exact length of the data is important.

Use of the Expand_Keywords_Locally Initialization Variable

Visual SourceSafe uses an Expand_Keywords_Locally initialization variable that controls automatic replacement of keyword-expanded files in your working folder. For more information, see Expand_Keywords_Locally Initialization Variable.

Use of Comment Characters for Keywords

If you are working with source code, or other compilable files, you want to make sure that Visual SourceSafe reads version information as comments. Your database administrator can define comment characters that Visual SourceSafe places before and after the History and Log keywords. See How to: Enable Keyword Expansion.

Visual SourceSafe associates each file name extension defined for keyword expansion with a string that is placed before every line, optionally followed by a string to be placed after every line. Both strings are provided in quotation marks, separated by commas. If no keyword comments are specified, the following comments are assumed:

*.asm = " | "

*.vb = "rem "

*.bat = "rem "

*.s = " | "

<All others> = "* "

See Also

Tasks

How to: Enable Keyword Expansion
How to: Use Keyword Expansion in a Text or HTML File

Reference

Expand_Keywords_Locally Initialization Variable