In Perforce, how to find the local path for files in a pending changelist

perforce

Given a Perforce changelist number, I want to find the local path of all files in that pending changelist.

  • p4 describe changelist — gets me the depot path for files in the changelist (method 1)
  • p4 opened -c changelist — gets me the depot path for files in the changelist (method 2)
  • p4 have — gets me the depot path and local path for all files that have previously been submitted

Using a combination of p4 describe and p4 have, I can find the local paths for all files in the changelist that have previously been submitted to Perforce (and are opened for delete or edit).

But what about files that are opened for add? p4 have does not know anything about files that are opened for add.

Given a pending Perforce changelist, how do I find the local path for files that are about to be added to Perforce?

Best Answer

To output the local path of all pending adds of a changelist you can use:

p4 opened -c changelist | grep -w add | sed 's/#.*//' \
| p4 -x - where | awk '/^\// {print $3}'

This does the same without grep but is a bit more obscure:

p4 opened -c changelist | sed -n 's/\(.*\)#.*- add .*/\1/p' \
| p4 -x - where | awk '/^\// {print $3}'
Related Topic