[p4] How to get newest label matching a regexp?

Ivey, William william_ivey at bmc.com
Wed Mar 26 09:22:22 PDT 2008

If you use the -ztag option:

p4 -ztag labels

You'll get timestamps down the the second in easy to compare
epoch-seconds format:
... Update 1156897852
... Access 1156897851

You will have to process multiple lines of output per label.
Each line is nicely prefixed, though, so it's not too bad.


-----Original Message-----
From: perforce-user-bounces at perforce.com
[mailto:perforce-user-bounces at perforce.com] On Behalf Of Karr, David
Sent: Wednesday, March 26, 2008 10:44 AM
To: perforce-user at perforce.com
Subject: [p4] How to get newest label matching a regexp?

I need to write a procedure to get the newest label that matches a
regular expression.  I can see how to do this conceptually, but there's
a minor problem.

In P4Win, the list of labels lists the label creation time down to the
second.  However, running "p4 labels" from the command line only gets
this down to the day.  If two labels were created on the same day, I
don't know which one is newer.

Is the order of the output of "p4 labels" significant?  Are they in
creation order, or in alphabetical order?

perforce-user mailing list  -  perforce-user at perforce.com

More information about the perforce-user mailing list