Given a Perforce changelist number, I want to find the local path of all files in that pending changelist.
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?
Find files in a depot or workspaceGo to Search > Find File. The Find File tab opens in the right pane. On the Find File tab in the right pane, under Search in, enter the directory path you want to search. You can drag and drop the file path from the Depot or Workspace Tree in the Tree pane.
To open the files in a specified changelist, use the -c option. To move files from the default changelist to a numbered changelist, use the p4 change command.
Perforce maintains a default pending changelist in the system metadata for every workspace. When you check out a file, you can add it to the default pending changelist for your workspace or create a new numbered pending changelist for your work.
Put any files in the Unversioned Files changelist under version control by pressing Ctrl+Alt+A or selecting Add to VCS from the context menu. You can either add the entire changelist, or select separate files.
Local path for all files in a pending changelist without any external or platform-specific tools:
p4 -F %clientFile% fstat -Ro -F action=add [-e CHANGE] //...
Remove the '-F action=add' if you want to get files opened for all actions.
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}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With