Jump to content

change checkin comment from trigger


hypotheticalEric

Recommended Posts

I'm looking for a way to change the comment attached to a checkin via triggers. Here's the use-case of what I want to do:

  1. We use an online image review site called ProofHQ where clients can leave comments on our work as we go. These comments are essentially to-do items like "make this car less red", etc.
  2. When they go to check in files to Plastic, rather than have them rewrite or copy / paste all the done items (which we know nobody will do when they are busy, so we get checkin comments like "updates" :) ), I'd like to allow them to just put in the ProofHQ serial number in the changeset comments, something like "proof:800282"
  3. Create a Plastic before-checkin trigger that will look for that serial number string and pull in the comments through the ProofHQ API.
  4. add these comments to the changeset comments

I tried a really simple example using the before-checkin trigger and changing the PLASTIC_COMMENT environment variable, but it doesn't seem to work. ( I assume Plastic doesn't read this variable back in, just as a publishing mechanism?)

Is there a way to either change the comment through the before-checkin trigger or via "cm" commands and after-checkin?

thanks!

Link to comment
Share on other sites

Hi!

unfortunately there's not a pretty way to update a changeset comment. We don't provide a CLI command or a trigger mechanism :( You can ask for it in our user voice page: https://plasticscm.uservoice.com/forums/15467-general

But....

If you are going to be doing this from a secure machine then I think you can use the "cm q" command to do it.

You'll need to setup a Plastic SCM client config (clconfigureclient) for the user running the Plastic SCM daemon/service, use the Plastic SCM admin user, only the Plastic SCM admin user (repository server owner) is able to run queries with the "cm q" command.

Once everything is ready you'll be able to create a "before-checkin" trigger and change the changeset comment by running something like:

(MySQL example)

cm q "execquery update object as o inner join changeset as c on o.iobjid=c.iobjid set o.scomment='Test' where c.ichangesetid=1"

'Test' and "1" are fixed values for the example, change it to be variables and use it in your trigger script.

Hope it helps!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...