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

Chenini, Mohamed MChenini at geico.com
Wed May 9 10:40:00 PDT 2007


After doing a p4 -c <workspace> sync

 

u1c332 at plbc0111:~> p4 files '#have' | sed 's/.*change \([0-9]*\).*/\1/'
| sort -un | tail -1

#have - file(s) not on client.

 

________________________________

From: Stephen Vance [mailto:steve at vance.com] 
Sent: Wednesday, May 09, 2007 1:25 PM
To: Chenini, Mohamed 
Cc: matt at starnix.com; perforce-user at perforce.com
Subject: Re: [p4] Is there a command in Perforce that could tell me
which changelists were included in the last sync I did?

 

You missed a pipe ('|') before sort. Matt had it at the and of the line.
And it may not work if you haven't synced anything as your message would
indicate.

Steve

Chenini, Mohamed wrote: 

When trying the command I got this:

u1c332 at plbc0111:~> p4 files '#have' | sed 's/.*change \([0-9]*\).*/\1/'
sort -un | tail -1

sed: can't read sort: No such file or directory

And when I try 

u1c332 at plbc0111:~> p4 files '#have'

#have - file(s) not on client.

-----Original Message-----
From: matt at starnix.com [mailto:matt at starnix.com]
Sent: Wednesday, May 09, 2007 12:51 PM
To: Stephen Vance
Cc: Chenini, Mohamed ; perforce-user at perforce.com
Subject: Re: [p4] Is there a command in Perforce that could tell me
which changelists were included in the last sync I did?

Stephen Vance <steve at vance.com> <mailto: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> <mailto: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

====================
This email/fax message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution of this
email/fax is prohibited. If you are not the intended recipient, please
destroy all paper and electronic copies of the original message.
  
====================
This email/fax message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution of this
email/fax is prohibited. If you are not the intended recipient, please
destroy all paper and electronic copies of the original message.


More information about the perforce-user mailing list