Reverting all files in a shelf if they are identical to headrevert shelf
Posted 02 September 2020 - 02:12 PM
I am looking for a command line method to prune ALL files in a shelf that matches head. (which means that these files have already been checked in and can be pruned)
Currently I am selecting each in a shelf individually in P4V and diffing w.r.t to head and "IF" identical reverting it..
What would be the method to do this across all files in a shelf on the command line?
- Thanks in advance
Posted 02 September 2020 - 02:14 PM
Posted 02 September 2020 - 02:44 PM
p4 unshelve -s SHELF p4 sync ... p4 resolve -as p4 revert -a (or p4 diff -sr | p4 -x- revert) p4 shelve -r -s SHELF
You could also do this by some scripting to directly remove the identical files in the shelf, but it feels more straightforward to me to just use your workspace to do the work of "rebasing" the shelf to the head revision and then using "p4 shelve -r" to replace the shelf with the result.
Posted 02 September 2020 - 06:05 PM
I do not want to touch the files in my WA. p4 sync does that...
Is there a way I can pull this off without modifying unrelated files
Posted 02 September 2020 - 08:41 PM
p4 -F %depotFile% files @=CHANGE | p4 -x - tag -a -l to-revert p4 -F "diff2 -q %depotFile%@=CHANGE %depotFile%#head" files @=CHANGE | p4 -F %depotFile% -x - run | p4 -x - labelsync -l to-revert -d p4 -F %depotFile% files @to-revert | p4 -x - shelve -d -c CHANGE p4 label -d to-revert?
Be nice if "p4 diff2" had an -Oi flag that made it only output identical files; then this'd be a one-liner!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users