[p4] Convert static to automatic labels
gb.perforce at googlemail.com
Thu Aug 20 07:10:44 PDT 2009
On Thu, Aug 20, 2009 at 11:20 AM, <Jamie.Echlin at barclayscapital.com> wrote:
> I'm looking at converting the static to auto labels where possible.
> If s1 is entirely a subset of s2, this can be converted to an automatic
> label. s1 and s2 are not always the same - s2 may incorporate more
> revisions than s1, the labelled set. That is one of the drawbacks of
> this approach. It will often include deleted files which sometimes seem
> not to be labelled, and may include other files too.
I'd be interested to know how you intersect those sets.
When you are in the situation where s2 incorporates more revisions
than s1, then it's time to restrict the scope of the View of the
automatic label. The major difficulty in this exercise is of course
not to just use a huge list of files, or the point of the automatic
label gets somewhat lost, but the optimum label view instead, possibly
with exclusion rules if adequate.
But ignoring this difficulty, a method I use is this:
1- Setup a temporary client
p4 client tmprp
2- Populate that client's have table exclusively with files labelled by STATIC
p4 sync -k //depot/project/... at STATIC
3- What's the contender changelist for our automatic label?
p4 changes -m1 -s submitted //depot/project/... at tmprp
Change 123456 on 2009/08/20 by me at client 'Blah'
4- Now what would happen if I sync'ed the client with that change ?
p4 sync -nk //depot/project/... at 123456
//depot/project/... at 123456 - file(s) up-to-date.
That's good. Here STATIC can be replaced by an automatic label with
View set to //depot/project/... and Revision set to 123456 (although
to be fair, here we are assuming that STATIC doesn't scope out of
//depot/project/... and that we could try and determine if a deeper
path would do... I assume that those are the cases that your script
Now if you had any files returned by the last sync, there are 2 scenarios:
a- the files labelled by STATIC are not contemporaneous. The label
shall remain STATIC, that's what they are for.
b- we are in the case where the set labelled by STATIC is smaller than
that of its contemporaneous changelist 123456. That's when we need to
restrict the View of the automatic label to exclude (or not include)
the files returned by the last sync. For me, that last operation is
still a manual process but it could be scripted(*)
(*) What would be great would be a Perforce sub-command that, given a
list of file revisions would return the optimal pair of (View,
Changelist) that would pick up those revisions, with the option of
using exclusion rules or not.
More information about the perforce-user