I used the Perforce Repository.GetDepotFiles() and noticed that the function returns files that match the search pattern but also returns files that have been deleted in the Perforce Depot. How do I filter out the search to exclude deleted files?
My code to do file search in Depot:
IList<FileSpec> filesToFind = new List<FileSpec>();
FileSpec fileToFind = new FileSpec(new DepotPath("//depot/....cpp"), null, null, VersionSpec.Head);
filesToFind.Add(fileToFind);
IList<FileSpec> filesFound = pRep.GetDepotFiles(filesToFind, null);
Using the command-line p4.exe you can get a list of non-deleted files like this:
The command
p4 files
supports a couple of different flags, like '-a' and '-A'. These are supported by p4api.net.dll:FilesCmdFlags.AllRevisions
corresponds to the '-a' flag (andFilesCmdFlags.IncludeArchives
is '-A'). Unfortunately it seems that '-e' is not supported by p4api.net.dll.There is however a workaround using P4Command:
I'm using p4net.api.dll version 2013.3.78.1524.