2

I'd like to create a branch restriction for a ClearCase preop merge trigger.

However, it should fire based not on the exact branch type, but rather based on whether the branch type follows a specific naming convention, like

.../my_special_branchname_prefix*

Can I do this, or do I have to list every branch separately?

I read in "cleartool man mktrtype" that a "branch-type-selector" can be used, but unfortunately I was not able to find comprehensive information on what it entails, i.e. if it can be a version selector pattern as used in a config spec (using e.g. the three-dot ellipsis), or even a globbing pattern, or if it can only be an exact branch type name.

Larry
  • 427
  • 2
  • 10

1 Answers1

1

One way to check what you can do is to write a dummy preop trigger script which will simply output the "trigger environment variables (EV)"

That way, you can check if one of those CLEARCASE_xxx environment variable has the name of the branch you want (do you mean the source or destination branch of that merge?).
Once you see the right variable, you can enforce your policy, by making sure the preop trigger script exits with -1 when the name of that branch does not start with the expected prefix.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Although it does not answer the question, this could be useful if the clients agree that it is worthwhile to call a script on every single merge, even if it exits almost immediately, and to add the risk of something going wrong in the script for every branch of the relevant files. Although if I remember correctly, a couple of months back it has been determined that no ClearCase variable actually holds the branch name, since what you wrote was my original idea as well. I'll have to look into this again. I am talking about the destination branches of the merge by the way. – Larry Jan 15 '18 at 09:04
  • @Larry Agreed. ClearCase has always been file-centric, as I documented in https://stackoverflow.com/a/645771/6309 – VonC Jan 15 '18 at 09:06
  • I'm taking the answer as "no, it is not possible, but you have this alternative" and accepting it now, as I haven't found a way to do this for a year now. – Larry Oct 25 '19 at 07:29