- Home /
How to determine whether a file has changed through the VersionControl.Provider?
Hello, I am writing an editor script and one of the things I need to assess is whether or not a particular file has changed.
Not sure if it matters but our version control system is Perforce.
I did some testing using the Provider.RevertIsValid() API and here are the results (where at least one or two of these cases seem incorrect):
Here is what the p4 command line app reports when I try to revert the files where again the .meta is not changed but the .h was changed.
λ p4 revert -n -a .\Wwise_IDs.h.meta
//depot/DemoV2/Assets/StreamingAssets/Audio/GeneratedSoundBanks/Wwise_IDs.h.meta#1 - was edit, reverted D:\src\P4ROOT\PlutoP4\DemoV2\Assets\StreamingAssets\Audio\GeneratedSoundBanks
λ p4 revert -n -a .\Wwise_IDs.h
D:\src\P4ROOT\PlutoP4\DemoV2\Assets\StreamingAssets\Audio\GeneratedSoundBanks
If it helps here is the code I was using to generate the above results and I would just change which enum and asset path I passed in,
if (!Provider.enabled || !Provider.isActive) { return false; }
var asset = Provider.GetAssetByPath(assetPath);
if (asset != null)
{
var revert$$anonymous$$ode = Revert$$anonymous$$ode.Normal;
var revertStatus = Provider.RevertIsValid(asset, revert$$anonymous$$ode);
return revertStatus;
}
I also tried to experiment with using DiffIsValid() using an AssetList I constructed from this single asset and it returns true for either the modified or unmodified file.
Hey, did you ever figure out a solution for this problem?
Its happening for more than just the IsRevertValid function.
I'm also trying to know if a file has a newer version through IsGetLatestValid but its always false.