Can't get metadata for newly added files
From internal case 00228248
1. Add a file to a depot (e.g. p4.exe add //depot/file.txt)
2. Get a list of opened files (IList<p4.File> p4Files = this.p4Repo.GetOpenedFiles(null, null);)
3. Get metadata for the newly opened file (foreach (p4.File p4File in p4Files) { IList<p4.FileMetaData> metaList = this.p4Repo.GetFileMetaData(null, p4File); }
Result:
The metadata for that file will be null
This is caused by two things:
1. The FileSpec object that is returned by GetOpenedFiles has a revision number of 1 (see below.) Since this is a newly added file it doesn't actually have a revision number yet.
2. Internal to GetFileMetaData in Repository.cs the revision number is added to the file. So in the example above it would run fstat on //depot/file.txt#1. That returns "no such files"
As a workaround I'm setting the revision number to null for anything that is an add. By doing that it will successfully run p4 fstat and return the proper metadata. You can reproduce this behavior on the command line: