[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:
    ./progname   --version
    "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
    Sinai."
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
several
problems already: (1) ascertaining exactly what was retrieved ("p4 have"
helps
you, there; (2) making sure that it was built in a repeatable way, which
means that
any incremental compiles can be exactly recreated, step-by-step; (3) you're
betting
that there's no workspace view-shenanighans or gremlins like that sneaking
around.

So, it's fair to assume that whoever retrieved the files to make a
repeatable build
probably did a single "p4 sync (to head)" (p4v 'get latest revision')
operation or
a single "p4 sync (to label, maybe a date)" (p4v 'get...' with label / date
specified).
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
suited
for the day-to-day developer and occasional administrator, and certain
things like
reports --- this *is* a report --- are really command-line or scripting
tasks.)

The suggestion to use the $Change$ (I think that's it, see "p4 help
revisions")
strategy seems good  *if* you submit/check-in the file containing that
$Change$
modifier each time something happens in the code tree. I wouldn't care to
enforce
that particular strategy.

   -Jeff Bowles
   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.
>
> dave
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>



-- 
---
Jeff Bowles - jeff.a.bowles at gmail.com



More information about the perforce-user mailing list