[p4] RE: Perforce keyword expansion

Gordon Broom Gordon.Broom at pwrm.com
Wed Dec 5 10:59:43 PST 2001


Simon Morton wrote:
> I was just wondering why the content of the $Header and $Id tags in
perforce was not more similar to RCS.
> 
> I.e. In perforce (2001.1):
> 
>   $Header: //depot/web/apache/htdocs/index.html#5 $ 
> 
> In RCS:
> 
>   $Header: /home/simon/hello.c,v 1.2 2001/12/05 18:02:26 simon Exp simon $

OK, I think this might be a useful feature enhancement:  have $Header$
expansion work in a similar way to RCS when the file in question is open for
edit.  By this I only mean adding the username when the file is checked out,
not adding all the other information present in the RCS keyword.  Something
like this:

    $Header: //depot/path/to/file#1 $    <== file is not checked out for
edit
    $Header: //depot/path/to/file#1 gordonb $    <== file is checked out for
edit, by 'gordonb'.

This gives you the ability to see at a glance which files in your
end-product have not been submitted (and thus cannot be reproduced).  Right
now you can't tell if //depot/path/to/file#1 is the actual revision #1, or
an edit to revision #1 in a pending changelist. 

The drawback I see to this approach is that it involves transferring another
copy of the file down from the server upon "p4 edit", rather than just
twiddling a permission bit.

This is less of a concern when you use an automated build process, in which
all files are synched from the depot before building, and thus have been
submitted.  If you don't have the infrastructure, however, you can
occasionally slip up and forget to submit a file before rolling it out (e.g.
the automated build scripts themselves are stored in Perforce, and you end
up with a chicken/egg problem).

<Gordon.Broom at pwrm.com> 
CM Engineer -- Development Automation Team 
Power Measurement <http://www.pwrm.com/> 
+1 250 652-7100 x7608 



More information about the perforce-user mailing list