问题
Frequently I come across the following statements in C/C++ source code:
$Id: lzio.c,v 1.24 2003/03/20 16:00:56 roberto Exp $
$Id: file name, version, timestamp, creator Exp $
Have you got any idea which software produces those "signatures"?
回答1:
Version control systems such as CVS can produce such tags.
回答2:
Keyword substitution in subversion produces this sort of information, in particular Id:
Id
This keyword is a compressed combination of the other keywords. Its substitution looks something like $Id: calc.c 148 2006-07-28 21:30:43Z sally $, and is interpreted to mean that the file calc.c was last changed in revision 148 on the evening of July 28, 2006 by the user sally.
You can tell subversion to insert these values using svn:keywords
To tell Subversion whether or not to substitute keywords on a particular file, we again turn to the property-related subcommands. The svn:keywords property, when set on a versioned file, controls which keywords will be substituted on that file. The value is a space-delimited list of the keyword names or aliases found in the previous table
You can also make these substitutions automatic by editing your config:
Subversion also provides the auto-props feature, which allows you to create mappings of filename patterns to property names and values. These mappings are made in your runtime configuration area. They again affect adds and imports, and not only can override any default MIME type decision made by Subversion during those operations, they can also set additional Subversion or custom properties, too. For example, you might create a mapping that says that any time you add JPEG files—ones that match the pattern *.jpg—Subversion should automatically set the svn:mime-type property on those files to image/jpeg. Or perhaps any files that match *.cpp should have svn:eol-style set to native, and svn:keywords set to Id. Auto-prop support is perhaps the handiest property related tool in the Subversion toolbox. See the section called “Config” for more about configuring that support.
回答3:
Both RCS and CVS produce strings that look exactly like that.
回答4:
I've seen a few vim setups that will auto-magically populate these values. SVN can grab these values on pre and post commit hooks to fill default information in commit logs.
回答5:
Perforce supports some (not sure about all) of those key words.
来源:https://stackoverflow.com/questions/346301/id-name-of-file-date-time-creation-exp