Jump to content

Before-Checkin trigger


kittik

Recommended Posts

I would like to make a server-side trigger to check that any new check-in is going to have a name exceeding a length of characters.

I am able to make a simple trigger that prevents people from pushing anything to Plastic, but I do not know the syntax to make the simple length check, nor do I know where to host such a file.

Could someone please suggest the syntax needed to enforce this rule?

Is there somewhere in Plastic Cloud config where I can store such a file?

Thank you

Link to comment
Share on other sites

Hi,

You can use the variable PLASTIC_COMMENT to check the length in a script and make the necessary decisions on this.

#lengthcheck.rb content example

if (ENV['PLASTIC_COMMENT'].length < 5 )
 then exit 0 
 else exit 1 end

You can watch the examples page and use the programming language of your preference.

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

Example:

cm trigger create before-checkin "Check comment Length" "ruby c:\triggers\lengthcheck.rb"

Regards,

Rafael.

Unity Plastic SCM Support

  • Like 1
Link to comment
Share on other sites

Hi,

About the hosting of that script: if you don't have a NAS or something in common for all your users, you can put it in the [plastic-global-config] repository. This will be automatically downloaded to "%localappdata%\plastic4\globalconfig\[the server name]" folder and you can make your trigger refers to that folder. When you update it, people needs to restart their plasticscm client. It's not perfect, but it can do the job maybe.

 

Thanks,

Pat

  • Like 1
Link to comment
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...