[p4] Is there a command in Perforce that could tell me which changelists were included in the last sync I did?

G. Matthew Rice matt at starnix.com
Wed May 9 09:50:47 PDT 2007


Stephen Vance <steve at vance.com> writes:
> > Is there a command in Perforce that could tell me which changelists were
> > included in the last sync I did?
>
> History of your sync state is not kept by Perforce. The only way I can 
> think of to obtain this is to look at the logs if you are doing a high 
> enough level of server logging. Even that won't be foolproof if a 
> particular file had multiple revisions between your syncs. Another way 
> to infer it could be to use your logs to trace the time of your last two 
> syncs and use that to query what changes were submitted in the interim.

It could also be inferred by looking at your have list (I'm assuming that you
did a 'p4 sync' and didn't just sync a subdirectory).

Something along the lines of:

        p4 files '#have' |                      # list all the files in your ws
            sed 's/.*change \([0-9]*\).*/\1/' | # strip out all but cl numbers
            sort -un |                          # uniq/numeric sort
            tail -1                             # and the last value is it

If you need the changelist number regularly, it's easier to save it as part
of yout build (if automated) or just check it out beforehand with a command
like:

        p4 changes -s submitted -m 1

Then sync to that changelist number.  It removes any ambiguity.

PS - You may get slow responses this week.  A lot of us (especially the
        certified trainers and consulting partners) are at the Perforce 
        conference :)

HTH,
-- 
g. matthew rice <matt at starnix.com>      starnix care, toronto, ontario, ca
phone: 647.722.5301 x242                                  gpg id: EF9AAD20
http://www.starnix.com              professional linux services & products


More information about the perforce-user mailing list