Jump to content

Disable create child branch manual


Kevin Swanson

Recommended Posts

We are looking to integrate plastic with one of the supported issue trackers. We notice that bugzilla has a nice feature called Enforcing Task Exsistence. I think it may be possible to enforce task existence another way, by disabling the manual button behind create child branch, leaving from task as the only and default option. Is it possible to disable the create child branch from manual option via configuration? I think that having this be a configuration item would give the rest of the issue tracker integrations more functionality as they would be able to enforce task existence for branch creation by toggling create child branch from manual off.

Link to comment
Share on other sites

Hey @Kevin Swanson

Why don't you go for a before-mkbranch trigger? https://www.plasticscm.com/documentation/triggers/plastic-scm-version-control-triggers-guide.shtml#Createbranch You can customize whatever check you need in your code, like making sure the associated task exists, or it is assigned, or whatever.

Yes, we could add *another* setting to hide the option to show the regular branch creation and force users to go for "task branch creation" but ... well, it means even another setting that will be hard to find for almost everyone... and you will like to skip it anyway to create release branches and the like that won't stick to the task naming convention anyway. In case we go down this path we should also make it globally configurable (so you configure the setting globally and pushed to all clients consistently - https://www.plasticscm.com/documentation/administration/plastic-scm-version-control-administrator-guide.shtml#Globalfileconfiguration).

 

Hope it works with the trigger, let me know what you think :-)

 

pablo

Link to comment
Share on other sites

Hey @psantosl

I followed the links and made a small ruby script to print out the ENV variable, as it is the only thing passed to the script for before_mkbranch trigger. Inside there I found no data linking to a issue_number, i did find these variable though.

"plastic_branch_name"=>"scm007"
"plastic_clientmachine"=>"COMP84"
"plastic_comment"=>"test for branch"
"plastic_full_branch_name"=>"/main/test/scm007"
"plastic_repository_name"=>"test"
"plastic_server"=>"COMP84:8087"
"plastic_user"=>"paul"

So how would I go about making this script, it doesn't seem possible?

Also don't you already have this functionality for BugZilla, as your documentation states.

Why wouldn't you include this for all trackers, and not just one? Is that trigger just running a ruby script, what is that script?

Link to comment
Share on other sites

Hi,

 

The branch name is what you are looking for: the "scm007" thing is exactly how we link things. As easy as it gets :-)

 

You know when we link to an issue tracker we stick to a very simple convention: prefix + task number. In your case it seems it is scm + 007=> so 007 is your number.

 

Bugzilla: we have this for bugzilla because it IMPLEMENTS it, and the ruby script thing is something they define, not something on our side. We provided the code as a way to create the integration, but Ruby is not something Plastic uses internally at all if that's what you are asking :-)

 

Other issue trackers don't have such a thing and that's why we don't provide it.

 

What you would like to have is some sort of setting in the issue trackers configuration saying "only show branch creation from tasks" at the same level as "apply binding to".

image.png.2ef218fad827884557b4ffa9745f510f.png

 

We'll try to do it. Looks good but don't sure if others will really need it.

If you don't mind, it would be really useful if you add this request to our UserVoice: https://plasticscm.uservoice.com/forums/15467-general

 

Thanks!

 

pablo

 

Link to comment
Share on other sites

Okay so the REAL issue here is that Plastic arbitrarily changes the TaskID from "7" to "007" for no reason, meaning taskID: 7 -> branch: scm007.

But when using TaskID: 89237 then branch: scm89237.

So for everyone else lost on this, strip all leading 0's from taskID in the branch name, then search for the task in your task manager.

tldr; Strip leading 0's off of taskId then search for it.

Link to comment
Share on other sites

29 minutes ago, psantosl said:

Ouch! No, no.

 

I mean, if you create branch SCM1213 it means this is task 1213. That's all. Not sure where the stripping comes from :-)

But branch scm007 means task 7, not task 007, not task 10007, task 7, without the leading 0's.

This is important and should be stated in the documentation.

"All numbers under 1000 will be changed" - Plastic

 

Also this is ridiculous, wouldn't it make a lot more sense to include a global setting that can be pushed to all clients to disable the manual setting for Plastic?

I mean plastic is already interacting with the branch and the Issue Tracker and Plastic is the one assigning the branch name based off the task, seems like a really really really easy thing to do on YOUR side. Like, just a setting that disables the manual button, like   if(setting) { manualBranchCreation = false; }

Link to comment
Share on other sites

Tasks under 1000 will be changed?? Not sure what you mean.

scm007 is task 7, yes. You can strip the branch prefix part, and the rest is a number. In c# int.parse() will do, and depending on the language there will be a bunch of options.

Can we disable manual branch creation? Yes, we can. Let's see if this request gets more traction/interest from others too and then we can decide to go ahead and code it.

Link to comment
Share on other sites

  • 3 months later...

Recently started seeing this problem crop up with one of our devs.

our prefix is "JIRA_"

But, because we allow manual branch creation, the dev will manually create the branch as JIRA-PRJ-###  because there is a dash between the project prefix and the issue number, or because of the missed shift key (I'm not sure which) when pressing the dash.

so the changes/comments end up not getting pushed into jira, as the prefix is wrong. :(

But, I can see both sides - sometimes, we don't have a Jira item to associate a fix with, and do some dev "on the side" for a service request.  In those cases, we have to create the branch manually.  Having a "global" setting to universally disable the manual branch means that nobody could create a branch manually - not even a scm/build master.  That means that the client would need some way to override the global setting, perhaps only on the build machine.

I didn't see a user voice item created for this - did I just miss it? - it does seem like a pretty good feature to make sure that code fix branches are really linked to Jira items.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...