Search Unity

Perforce current revision from script

Discussion in 'Scripting' started by fwalker, Mar 18, 2021.

  1. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    255
    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:

    Code (CSharp):
    1.  
    2. AssetList assets = new AssetList();
    3. assets.Add(Provider.GetAssetByPath("Assets"));
    4. Task t = Provider.Status(assets);
    5.  t.Wait();
    6.  t.assetList.ForEach(asset => Debug.Log(asset.name + " " + asset.state.ToString()));
    But I do not see any version information there.
    What am I missing?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
  3. fwalker

    fwalker

    Joined:
    Feb 5, 2013
    Posts:
    255
    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.
     
    sslee_subob likes this.
  4. sslee_subob

    sslee_subob

    Joined:
    Jul 24, 2020
    Posts:
    3
    @fwalker same needs. did you find any solution? :)