[p4] RE: Perforce keyword expansion

Todd Short tshort at cisco.com
Wed Dec 5 08:18:28 PST 2001


I am sure there will be others that respond to this, but in 2001.1:

filetype:

text+ko: Old style keyword expansion: $Id$ and $Header$. 
text+k: Keyword expansion: $Id$, $Header$, $Date$, $DateTime$, $Change$,
$File$, $Revision$, $Author$

In versions prior to 2001.1, text+k only did $Id$ and $Header$. There was no
text+ko type.

--
-Todd Short
//tshort at cisco.com
//"One if my land, two if by sea, three if by the Internet."


-----Original Message-----
From: perforce-user-admin at perforce.com
[mailto:perforce-user-admin at perforce.com]On Behalf Of Simon Morton
Sent: Wednesday, December 05, 2001 11:06 AM
To: 'Schlueter, Michael'; 'perforce-user at perforce.com'
Subject: [p4] RE: Perforce keyword expansion


> I just found out that the perforce keyword expansion even 
> replaces the keywords normal c++ constant strings.
[snip]
> Is this a bug or feature?

It is absolutely a feature.  Embedding keywords in string constants
means you can access them programmatically and print/display them from
within the application, say in a title bar or in response to a -v 
option.  It also means that they persist in the binary forms of the
application so that you can use strings or ident to extract them and
find out which version(s) you are really dealing with.

static const char rcsid[] = "$Id$"; is the oldest trick in the book.

On this subject, though, does anyone know why perforce only expands
$Id and $Header to give file and version?  In RCS they give much more
information.

  From man RCS:

$Header$
      A standard header containing the full  pathname  of
      the  RCSfile,  the  revision number, the date and
      time, the author, the state,  and  the  locker  (if
      locked).

$Id$  Same  as $Header$, except that the RCS filename is
      without a path.

Simon 
_______________________________________________
perforce-user mailing list  -  perforce-user at perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user



More information about the perforce-user mailing list