[p4] how to make labelsync label deleted files
Michael Van Hoff
perforce-user-forum at forums.perforce.com
Tue Jul 23 07:50:01 PDT 2013
Posted on behalf of forum user 'Michael Van Hoff'.
OK, now I DO see your issue. I apologize for not reading deeper the
first time. I played with a number of the switches with integrate,
most notably the –D switches, but to no avail.
What did work was using 'p4 copy', which is essentially "integrate
with a hammer"! It does whatever it takes to make the destination look
identical to the source.
p4 copy //depot/path/test-dev/…@TEST_LABEL //depot/path/test-int/… That
command DID do the deletion of the file, but read up on it. It really
does take a hammer to the target branch and makes it look just like the source
by branching as it can, replacing as it needs to, and deleting if it doesn't
think the file should be there. If there are changes in test-int,
you'll want to integrate them into test-dev before running 'p4 copy'
or it'll overwrite them without asking permission…
If 'p4 copy' is too dangerous for you implementation, the only work
around I can think of is to create second label,
LAST_SUCCESS_BUILD. Use that label to capture the last time you
integrated SUCCESS_BUILD to main-int. To use this, first, in
main-dev, apply SUCCESS_BUILD to the new files to capture what just gave you the
successful build. Next, sync main-dev to
LAST_SUCCESS_BUILD. Then sync back to SUCCESS_BUILD , but this time,
capture the output and parse for deleted files, capturing both their depot path
and revision. Then one-by-one integrate that path and revision to
main-int. Finally, labelsync LAST_SUCCESS_BUILD to main-dev (since we
just integrated to SUCCESS_BUILD) to be prepared for the next build.
But easier yet, what I use with great success, and what has previously been
suggested, is to forget labels and capture the changelist. I use
CruiseControl.Net and I wrote my own labeler to use the changelist as the build
label, which gets handed to my script as a variable. From one of your
previous replies it sounds like you are already grabbing the CL in your Get
Latest Revision, just not tracking it. Changelist is the most
resilient method of tracking changes, so I suggest using them to associate to
I took a look at the Jenkins Perforce plugin and it makes a variable,
$P4_CHANGELIST, available to the scripting. See "Advanced
Configuration" heading's "Sync multiple builds to the same
changeset" subheading on Plugin
https://wiki.jenkins-ci.org/display/JENKINS/Perforce+Plugin for more
information. There are also some tutorials out there on how to write
your own Jenkins plugins if you can't find one that fits the bill.
Sorry I couldn't be more help, it sounds like an "unintended
feature" when 'p4 sync' respects the deleted files, but 'p4
integrate' and 'p4 changes' don't see them. I even
tried the older integration engines (-1 and -2, see 'p4 help undoc' for
more info), but to no success.
Good luck! And remember to have fun with it, whatever you choose
Please click here to see the post in its original format:
More information about the perforce-user