Perforce current revision from script

How can I get the current revision of the code being used from a script?

One solution is to run a command
“p4 changes -m1 #have
But I do not see a way to run a command from script.

All I can use is the Provider class? I don’t see anything there.
Does anyone have any ideas?

Something else I tried was:

AssetList assets = new AssetList();
assets.Add(Provider.GetAssetByPath("Assets"));
Task t = Provider.Status(assets);
 t.Wait();
 t.assetList.ForEach(asset => Debug.Log(asset.name + " " + asset.state.ToString()));

But I do not see any version information there.
What am I missing?

Are you looking for RCS keywords that P4 can modify when you check the file out?

https://babbage.cs.qc.cuny.edu/courses/cs701/Handouts/rcs_keywords.html

No not that. But thank you Kurt.
I think I am looking for a Perforce Plugin/API that I can use to get the latest revision on my project.
Or an API to send a command line to Perforce.

1 Like

@fwalker same needs. did you find any solution? :slight_smile: