Kingkong Jnr
Kingkong Jnr

Reputation: 1158

How to find (grep) text for files in a perforce changelist?

How to grep/find for a particular text in all files within a pending changelist?

My use case: I have a debug_flag in my code and would want to make sure I do not check-in any code with the debug_flag which will cause a compiler error for all others. (Not for me since I have the debug_flag declared locally)

Upvotes: 1

Views: 760

Answers (1)

Ari
Ari

Reputation: 7556

p4 describe changelist# gives you the list of the files in a changelist, but it has some extra information, and the paths are with respect to the depo. Example:

p4 describe 12334

output:

Change 12334 by me on 2014/01/04 00:57:08 pending

Some test changelist

Affected files ...

... //depot/path/to/my/files/file1#15 edit

... //depot/path/to/my/files/file2#12 edit

With a few search/replace or a simple perls script, you can change this text output to a list of files with actual path and then run grep on them:

xargs grep "debug_flag" < file_list.txt

Upvotes: 2

Related Questions