Introducing Plastic SCM's external tools actions
External tool actions have been around since release 6.0.16.1486, thanks to some of you asking for them.
You can create custom actions to run on selected objects such as labels, changesets, branches, and items, and invoke those custom actions directly from Plastic SCM.
Add custom actions to branches and files
Okay, this is a little bit difficult to understand without an example, so I'm going to teach you how to implement two different actions: one for branches, and one for items. I'll let you tinker around with action for labels and changesets on your own, but it is just as easy. Remember, this feature is available on Windows, macOS, and GNU/Linux, but only in the regular Plastic SCM client, and not in Gluon.
For the action to a branch, I'm going to add a custom action to directly apply an attribute to the branch. This is instead of the alternative of having to navigate to attributes, then selecting the attribute I want to apply, and then looking for the value, which is a real hassle if you do this a lot, like we do.
For the action to an item, I'm going to add a custom action to directly open that item in Visual Studio Code.
Ready? Ok, let's go.
First, let me tell you about the configuration file we need to add. It is named externaltools.conf
, and you can create it in two different places (or both!): in your local configuration directory, or in the global configuration repository. I'll use the local configuration for the example.
$HOME/.plastic4
if you are using macOS or GNU/Linux, or in %LOCALAPPDATA%\plastic4
if you are using Windows.
externaltools.conf
file must be located in /global-config/externaltools/
.
The file has the following format:
<objectType>[:<objectType>]+ | name | exec path | args
<objectType>
can either be "item", "label", "changeset" or "branch". You can specify more than one type using a ":" as a separator, for example, label:changeset:branch.name
is the name of the action in the External Tools menu.exec path
is the path of the executable.args
are the arguments. You have the keywords@object
,@repository
and@wkpath
available to you. They will be replaced for the object or repository spec, and for the workspace path, before executing the action.
I'm going to add two lines to my externaltools.conf
file. You should now be ready to understand them!
branch | Mark this branch as RESOLVED | "C:\Program Files\PlasticSCM5\client\cm.exe" | setattribute "att:status" "@object" RESOLVED -path="@wkpath" item | Open in VS Code | "C:\Program Files\Microsoft VS Code\Code.exe" | @object
You guessed it right. The first line adds the menu item that you can see at the top of this post, while the second line adds this to my items view:
From this point on, the ball is in your court! Let your imagination run wild. What are you going to use this feature for? Maybe close the task related to your branch in your issue tracking system? Or, automatically add the object spec to an email so you can tell your colleagues about a specific cset? Maybe, launch a build on a branch, just in one click? Let us know how you use this feature!
If you have any suggestions, doubts, or problems, please, don't hesitate to write us at support@codicesoftware.com, or ping us on Twitter at @plasticscm, and we will answer ASAP.
Enjoy!
0 comentarios: