Is there a way to get Perforce to revert unchanged files pending integration?

Phillip picture Phillip · Jun 19, 2014 · Viewed 10.9k times · Source

I'm getting ready to integrate our "Dev" branch into our "Testing" branch in preparation for an upcoming release.

For our last release, after the initial integration, we determined there were some changes we didn't want to release. I rolled back some files in the Testing branch, and commented out portions of other files. Many of these files haven't changed in the Dev branch, so as far as Perforce is concerned, they've already been integrated and are good-to-go.

Obviously, I could track down the changelists and un-rollback these files. I could also integrate the offending files with the "-f" option to disregard integration history.

But I was hoping to find a way to do this "automatically". I tried integrating the entire branch with "-f", resolving, and then reverting unchanged files, but this just gives the message: <filename> has pending integrations, not reverted.

Is there a way to get Perforce to revert unchanged files that are pending integration? Is there some other approach I should take?

Answer

P4Shimada picture P4Shimada · Jun 19, 2014

Have you tried the following steps under 'Pending integrations not reverted'?

http://answers.perforce.com/articles/KB_Article/Reverting-Unchanged-Files

Files that are integrated and resolved but have no content or type changes will still be submitted as new revisions, EVEN IF you have 'revertunchanged' selected in your client spec, or use 'submit -f revertunchanged'. This behavior is by design, but is not obvious.

Again, if a submit would change the integration history of a file, then that file is considered changed, even if there are no content changes. In other words, updates to integration history are considered a file change, just like content, type, and attribute changes.

The command line equivalent of the 'revertunchanged' option, p4 revert -a, offers some context. From p4 help revert:

The -a flag reverts only files that are open for edit or integrate and are unchanged or missing. Files with pending integration records are left open. The file arguments are optional when -a is specified.

For example:

$ p4 revert -a b
//depot/test/b#1 - has pending integrations, not reverted

Users concerned about integrating files with no content changes are advised to use 'p4 diff -sr | p4 -x- revert'. For example:

$ p4 diff -sr | p4 -x- revert 
//depot/test/b#1 - was integrate, reverted

Let me know if this helps.