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

Stephen Vance steve at vance.com
Thu Feb 21 03:32:02 PST 2008


Robert --

The typical approach to this is to have your build system generate a 
header file with the information in it.

I don't understand your comment about the "hack." Changelist numbers are 
unique. As long as you craft your 'p4 changes -m1' command correctly, 
you will always get the correct answer. I don't understand what you mean 
by "an identical but different changelist."

Steve

Troughton, Robert wrote:
> 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?
>
>  
>
> I suspect that this is impossible... but it's worth asking.
>
>  
>
> Basically, if I sync to changelist X and make some changes, I'd like our
> app to display on screen that I'm running version X. I know that there's
> a commandline "hack" to find out the changelist that I last sync'ed to
> (it's a hack because it does a search across the depot so could,
> potentially, report an identical but different changelist). However, is
> there a good way to automagically put this changelist number into the
> sourcecode?
>
>  
>
> Has anyone attempted anything similar to this...?
>
>  
>
> Robert
>
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
>   

-- 
Stephen Vance
www.vance.com



More information about the perforce-user mailing list