[p4] Adding a Changelist # to C++ code...?
Jeff A. Bowles
jab at pobox.com
Sun Feb 24 16:31:38 PST 2008
I read through this thread - am a bit behind - and want to comment on it...
First, if you need the ability to execute something like:
"I was built from the tree //depot/shermy/MAIN/... up to change 12397
on Jan 21, 2008 at 0901 UTC by Moses-the-lawgiver on build machine
Then you are probably talking about a formally built release that probably
retrieved the files in a repeatable way.
Because, let's face it, if you have coders / developers popping out releases
form their workspace to hand over for someone else to support, you have
problems already: (1) ascertaining exactly what was retrieved ("p4 have"
you, there; (2) making sure that it was built in a repeatable way, which
any incremental compiles can be exactly recreated, step-by-step; (3) you're
that there's no workspace view-shenanighans or gremlins like that sneaking
So, it's fair to assume that whoever retrieved the files to make a
probably did a single "p4 sync (to head)" (p4v 'get latest revision')
a single "p4 sync (to label, maybe a date)" (p4v 'get...' with label / date
Making that into a changelist (plus directory name) of the form
//depot/myproduct/... at 1235
is pretty easy from the command-line.
The thread's rife with that solution:
"Run 'p4 changes -m1 -s submitted //depot/myproduct/...' and your
changenum is right there."
Of course, "P4V users, pay cash." (You'll find that the P4V experience is
for the day-to-day developer and occasional administrator, and certain
reports --- this *is* a report --- are really command-line or scripting
The suggestion to use the $Change$ (I think that's it, see "p4 help
strategy seems good *if* you submit/check-in the file containing that
modifier each time something happens in the code tree. I wouldn't care to
that particular strategy.
Perforce Consulting Partner and Certified Trainer
On Sat, Feb 23, 2008 at 10:43 AM, Dave Lewis <dlewis78731 at gmail.com> wrote:
> > e.g. with a submit trigger. At submit time, you know (1) the
> > changelist number, and (2) that you are "cleanly synced". I have a
> > feeling, though, that it's not possible to edit a file in a trigger
> > and "p4 submit" it. Or is it?
> neither 1 nor 2 is true. Changelists can be renumbered upon submit,
> and submitting a new change opens up the possibility that someone
> submitted a change after your sync and before your submit.
> perforce-user mailing list - perforce-user at perforce.com
Jeff Bowles - jeff.a.bowles at gmail.com
More information about the perforce-user