[p4] Adding a Changelist # to C++ code...?

Robert Cowham robert at vaccaperna.co.uk
Fri Feb 22 00:22:50 PST 2008

Right click > Change filetype when the file is in the pending changelist.

Note that a drawback of this technique is that if the header file is not
changed and checked in as part of the final build then the values reported
are for *this header file only* and not for all the source in the

This is why I suggested using #define or similar as part of the compilation

There are pros and cons to each approach.

> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of 
> Veronica Merryfield
> Sent: 22 February 2008 01:46
> To: perforce-user at perforce.com
> Subject: Re: [p4] Adding a Changelist # to C++ code...?
> Is it possible to do this with P4V? I can't see an obvious 
> way to prepend the k to the file type within P4V.
> Thanks
> On 21-Feb-08, at 11:42 AM, Peter Prymmer wrote:
> > perforce-user-bounces at perforce.com wrote on 02/21/2008 03:18:52 AM:
> >
> >> Does anyone know of a way to integrate the last synced 
> version number 
> >> from Perforce into C++ code, such that it can be displayed 
> on screen?
> >
> > One approach with perforce could exploit keywords within the files 
> > (example shown below).
> >
> > Before using this approach do note that keyword expansion 
> by the SCM 
> > tool is not universally appreciated (it can lead to odd 
> diff and merge 
> > problems).  You might consider confining it to one single 
> header file 
> > if you choose to adopt it instead of adding it to a large number of 
> > files.
> > #define ID "$Id$"

More information about the perforce-user mailing list