Jump to content
game4automation

Getting changeset numbers via Unity Script

Recommended Posts

For integration in our Build process we would like to get the changeset number of the current changeset via Unity script. Is there an easy way to get it via the Plastic SCM Unity Plugin?

Share this post


Link to post
Share on other sites

Hi,

- You could use the Plastic CLI client to get this information and  query for the changeset id (eg: "cm find changeset"):

https://www.plasticscm.com/documentation/cmfind/plastic-scm-version-control-query-system-guide

Or do you want to get the changeset id your local workspace is pointing?

- What build system are you using? Plastic has plugins for some CI tools (Jenkins, teamCity, Bamboo)...

- In Plastic, you can also create custom triggers to be run linked to Plastic operations (eg: after-checkinūüėě

https://www.plasticscm.com/documentation/triggers/plastic-scm-version-control-triggers-guide

Regards,

Carlos.

Share this post


Link to post
Share on other sites

Hi,

thanks a lot.

We are using teamcity. We would like to get the changeset id of our current local workspace to use it in a Unity script

Yes we could use "cm status --cset" and parse the result in a Unity Script.

Do you have an example for a trigger script where the latest changeset id is always written to a text file or an environment variable?

If would be perfect if the Plastic SCM Unity plugin will offer a simple api access for Unity scripts. For example to get the current changeset id or to subsribe a method which is called before the checkin and after the checkin.

Regards

Thomas

 

Share this post


Link to post
Share on other sites

Hi,

Our trigger trigger guide includes some examples. If you plan to use "after-checkin" trigger, one of the available  enviroment variables is:

PLASTIC_CHANGESET Only available in the after-checkin trigger.

The changeset or changesets that were created as a result of the checkin operation.

This variable contains the specifications for the changesets that were created, separated by semi-colons (';'). This is a sample of a variable value with changesets created on two different repositories:

cs:23@br:/main@rep:default@repserver:DARKTOWER:8084; cs:19@br:/main@rep:secondrep@repserver:DARKTOWER:8084

https://www.plasticscm.com/documentation/triggers/plastic-scm-version-control-triggers-guide#Checkin

You can use this enviroment variable in your script. In Windows for instance, this is my sample "trigger.bat":

echo %PLASTIC_CHANGESET% >> C:\tmp\changesets.txt

Regards,

Carlos.

 

Share this post


Link to post
Share on other sites

Hi, I would check the following:

1. Review the trigger permissions to be sure your user has enough privilege to run it.

2. Create a very simple trigger: eg: output a string to a file and check if it works.

3. Review the Plastic client log to check the if there is any error in the log when running the trigger.

Regards,

Carlos.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...