In Perforce, how do I find the local path for files in a pending changelist?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 01:24:47
Peter G.

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}'
Sven Erik Knop

You could of course also use

p4 -ztag opened -c changelist

This will report both the depotFile and the clientFile for each opened file. To list only client files:

p4 -ztag opened -c changelist | grep clientFile | awk '{print $3}'

Replacing //client/ with the client's root is left as an exercise for the reader.

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.

Based on Peter G's answer, translated into powershell 2.0:

p4 opened -c changelist 
    | Where-Object{$_ -match "add"}
    | ForEach-Object{p4 where ($_.split('#')[0])}
    | ForEach-Object{$_.split()[2]}
p4 opened -s -c <changelist#> | awk -F " " '{print $1}' | p4 -x - where | awk -F " " '{print $3}'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!