Keyword Expansion is similar to how a compiler literally replaces a macro name with its corresponding code in all instances it was used: once keyword expansion is enabled in Source Safe's administrative mode, whenever a file is checked in, Source Safe will parse it and literally paste into the html file the information the keyword requests. The only reason I decided to this was worthy of discussing in the tutorial was because of the "$$Date" keyword. You know how most CS pages always say when they were last editted. Well, I'm not sure exactly how they do that, but we could accomplish the same effect by using the "$$Date" keyword: whenever we checked in a file, Source Safe would fill in the time and date is was last editted. The only problem is that having to parse our files will slow Source Safe down, and personally I never really cared when a page was last editted anyways, so I've left keyword expansion disabled. Nevertheless, I have copied and pasted information from Source Safe's online help regarding use of keyword expansion:
Keyword expansion refers to Visual SourceSafe's ability to place certain information directly from the Visual SourceSafe database into your file for you. This can be handy, for example, if you want to place the string "Last modified on: date" in your web pages. To do this, you place certain keywords, in comments so that they do not affect your HTML code, into the text of your file. When you add or check in the file, Visual SourceSafe looks for these keywords, and places the relevant information after them.
SourceSafe Keywords
The following table is a list of all the Visual SourceSafe HTML keywords. Note that these HTML keywords are identical to traditional SourceSafe keywords except that they have an extra dollar sign in front of them. Keywords are case-sensitive, so be sure to capitalize them properly:
Keyword Description
$$Archive: $ Visual SourceSafe 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, Visual SourceSafe format
$$Log: $ File history, RCS format
$$Logfile: $ Same as Archive
$$Modtime: $ Date and time of last modification
$$Revision: $ Visual SourceSafe version number
$$Workfile: $ Filename
$$NoKeywords: $ No keyword expansion for all keywords that follow. (The
colon is optional.)
$$JustDate: $ Date, without the time addendum.
A SourceSafe HTML keyword has the following syntax:
$$keyword: $
For example, you could place the following in a file:
Last updated <!--$$JustDate:--!> <!--$-->
Upon check in, Visual SourceSafe could replace it with
Last updated <!--$$JustDate:-->5/16/96<!--$-->
The next time you check in the file, the 5/16/96 is replaced by the current
date, and so on. This automates the process of updating your HTML pages
each time you modify them.
Enabling Keyword Expansion
Because keyword expansion requires Visual SourceSafe to scan each file for keywords, it can considerably slow the Check In and Add Files commands. For this reason, keyword expansion is by default disabled for all files; you must indicate which files Visual SourceSafe should scan for keywords.
To enable and view keyword expansion
· Set the Copy Keyword-Expanded Files Into Working Folder option on the Local Files tab of the Options dialog box (Tools menu) to view the effects of keyword expansion.
After a Check In or Add command, Visual SourceSafe copies the keyword-expanded versions of the files to your working folder.
Effect of Keyword Expansion
When you check in a file with keyword expansion enabled, Visual SourceSafe places a modified copy of your file directly into the current project. It then immediately gets the file, which refreshes your working folder with the checked-in file. The Get Latest Version command slows down the updating process. You can avoid it by not setting the Copy Keyword Expanded-Files Into Working Folder option on the Local Files tab of the Options dialog box. When you clear this option, Visual SourceSafe still expands keywords, and places the modified file into the project. However, it does not copy the file into your working folder.
Copyright© 1992-1996 Microsoft Corp. All rights reserved.