Search code examples
linuxfilegrepperforcedepot

Perforce, Linux - grep for content in deleted depot files


Would like to know how can I grep information in depot deleted files. At first, I found that perforce supports searching file contents like so:

p4 grep -i -n -e "infoSearch" //depot/alex/moreStuff/...

from testing it seems that with the command above it won't search the "deleted" files of the provided location above. P4 help page won't give me much info on how can I do it either. (p4 grep)

Wondering how can I do it then ? Maybe I've missed something or do not understand..

Environment used:

  • Linux OS, command line interface;
  • Perforce version used: Perforce Visual Client/LINUX26X86_64/2013.4/760166

Solution

  • Did you try the -a option?

            The -a flag searches all revisions within the specified range. By
            default only the highest revision in the range is searched.
    

    Remember that a deleted file is just a file with a deleted revision at #head; all the old revisions are still there! The only reason p4 grep doesn't search them by default is that by default it only operates on the head revision.