Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 349
engtech Avatar asked Apr 21 '11 21:04

engtech


People also ask

How do I search for a file in P4V?

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.

How do I open a Changelist file?

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.

What is Perforce default Changelist?

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.

How do you add a file to a Changelist?

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.


2 Answers

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.

like image 198
Samwise Avatar answered Oct 13 '22 02:10

Samwise


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}'
like image 20
Peter G. Avatar answered Oct 13 '22 02:10

Peter G.