JakubH Posted December 4, 2013 Report Share Posted December 4, 2013 I want to add an attribute to a newly created object (branch, changeset,...). I set up an after-mkbranch trigger which should add the attribute to the new branch. However, it fails with a message saying that the branch cannot be located. It is probably because of the "relative" name of the branch – the environment variable PLASTIC_BRANCH_NAME is set to XYZ instead of /main/XYZ. How can I find out the full branch name within the trigger? Link to comment Share on other sites More sharing options...
calbzam Posted December 5, 2013 Report Share Posted December 5, 2013 Hi, You could use: cm find branches where name='task001' --format={name} --nototal This way you get as result the complete branch name "main/task001" Regards, Carlos Link to comment Share on other sites More sharing options...
JakubH Posted December 6, 2013 Author Report Share Posted December 6, 2013 I can do that, but there can be multiple branches with the same name (and different full name). Then I need to find out which is the last added branch or which branch of that name has not set the attribute. Then I have a decent level of certainty that I found the branch I've just created because probability of someone else creating a branch of the same name at the same time is very low. Still, all these are workarounds. The trigger should give a unique identification directly. Link to comment Share on other sites More sharing options...
JakubH Posted December 10, 2013 Author Report Share Posted December 10, 2013 I have another very similar problem now: how I can find out whether a specific branch has set an attribute to a specific value? I thought I can use the find command, but there is the same problem – even though I have the full name of the branch, the find command supports the short name only. So I cannot distinguish among branches with the same name. As a workaround, I think it would be better to disallow using the same name of a branch more times. I can make a before-mkbranch trigger for that. Still, I don't understand why you allow non-unique names while don't support search by a full name. Link to comment Share on other sites More sharing options...
gweronimo Posted November 18, 2015 Report Share Posted November 18, 2015 Even worse, [find branch where name = 'main'] returns 1 branch, but [find branch where name = '/main'] returns none! Link to comment Share on other sites More sharing options...
manu Posted November 20, 2015 Report Share Posted November 20, 2015 Hi! Still, I don't understand why you allow non-unique names while don't support search by a full name. Well there's not a reason behind it, It's just not supported, a missing feature. Even worse, [find branch where name = 'main'] returns 1 branch, but [find branch where name = '/main'] returns none! Yes, this is how it currently works, right now "main" is a valid branch name, "/main" is not. So the find system behaves as it's currently defined. Once we support full branch name then "/main" will start working. A dirty workaround, I have a lot of "scm111" branches, and I do know the full branch name, so... cm find "branch where name='scm111' and attribute ='test' and attrvalue = 'passed'" | grep "/main/scm001/scm111 " Link to comment Share on other sites More sharing options...
gweronimo Posted March 22, 2016 Report Share Posted March 22, 2016 I added the request for branch namespace support in "find branch" as a new uservoice here:https://plasticscm.uservoice.com/forums/15467-general/suggestions/13071435-add-support-for-namespace-in-find-branch-command Link to comment Share on other sites More sharing options...
gweronimo Posted April 1, 2016 Report Share Posted April 1, 2016 Hi! To answer the original question regarding after-mkbranch: "... the environment variable PLASTIC_BRANCH_NAME is set to XYZ instead of /main/XYZ. How can I find out the full branch name within the trigger?" According to documentation ( at https://www.plasticscm.com/documentation/triggers/plastic-scm-version-control-triggers-guide.shtml#Createbranch ) there is now a variable PLASTIC_FULL_BRANCH_NAME, which is supposed to contain the full branch name specification. Link to comment Share on other sites More sharing options...
manu Posted April 1, 2016 Report Share Posted April 1, 2016 Thanks Goran for pointing out the new environment variable Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.