// mergerules.conf
// You can restrict merges to certain branches so that:
//  * They only allow to merge some branches if they are reviewed
//  * They only allow merges from certain branches
//  * They only allow to merge from parent or child branches
// 
// Each "merge rule" defines:
//  * The affected repositories
//  * If they are enabled or not
//  * A restriction
//
// Restrictions can be:
// * only_allow_merges_if_reviewed
// * restrict_merges_to_branch
// * only_allow_merges_from_parent
// * only_allow_merges_from_children
// 
// 
// =============================================================================
// == only_allow_merges_if_reviewed ==
// =============================================================================
// Merges to "main" from "scm*" branches will be rejected if the "scm*" are
// not reviewed.
// The "review rule" is not enforced for branches with names different than
// "scm*". For instance "main/release-21" won't be restricted.
// 
// [{
//     "enabled": true,
//     "repositories": "game*",
// 
//     "rule": "only_allow_merges_if_reviewed",
//     "to":
//     {
//         "branchNames": ["main"]
//     },
//     "from":
//     {
//         "branchNames": ["scm*"]
//     }
// }]
// 
// Same as before but enforcing that any branch with the attribute
// "merge_only_reviewed" set to "enabled" must be reviewed
//
// [{
//     "enabled": true,
//     "repositories": "game*",
// 
//     "rule": "only_allow_merges_if_reviewed",
//     "to":
//     {
//         "branchesWithAttribute":
//         [
//             {
//                 "attribute": "merge_only_reviewed",
//                 "value": "enabled"
//             }
//         ]
//     },
//     "from":
//     {
//         "branchNames": ["scm*"]
//     }
// }]
// 
// A new example showing how the "branchesWithAttribute" filter can be used
// without a "value".
// 
// All branches with an attribute "merge_only_reviewed" (whatever value it has)
// will need to be reviewed to be merged to "main".
// 
// [{
//     "enabled": true,
//     "repositories": "game*",
// 
//     "rule": "only_allow_merges_if_reviewed",
//     "to":
//     {
//         "branchesWithAttribute":
//         [
//             {
//                 "attribute": "merge_only_reviewed"
//             }
//         ]
//     },
//     "from":
//     {
//         "branchNames": ["scm*"]
//     }
// }]
//
//
// =============================================================================
// == restrict_merges_to_branch ==
// =============================================================================
// Restricts merges to a given branch to happen only from certain branches.
// It is a way to enforce certain hierarchies.
// 
// Sample: for the repo "codice", merges to "fix-3.0" are only allowed from
// branches named "fix3-*".
//
// [{
//     "enabled": true,
//     "repositories": "codice",
// 
//     "rule": "restrict_merges_to_branch",
//     "to":
//     {
//         "branchNames": ["/fix3.0"]
//     },
//     "from":
//     {
//         "branchNames": ["fix3-*"]
//     }
// }]
//
//
// =============================================================================
// == only_allow_merges_from_parent ==
// =============================================================================
// Only allows merges from the parent branch for certain branches.
// It can be useful to force certain branches to only get merges from the
// branch they contribute to, and avoid merges between tasks.
//
// Sample: "task*" branches only receive merges from parent.
// It means "/main/task0123" can receive merges from "/main" but not from
// "/main/task0124".
// 
// [{
//     "enabled": true,
//     "repositories": "game*",
// 
//     "rule": "only_allow_merges_from_parent",
//     "to":
//     {
//         "branchNames": ["task*"]
//     }
// }]
//
//
// =============================================================================
// == only_allow_merges_from_children ==
// =============================================================================
// Force certain branches to allow merges from child branches only.
// This can be useful to enforce certain flows.
//
// Sample: "interation*" branches can only get merges from their child branches.
//
// [{
//     "enabled": true,
//     "repositories": "game*",
// 
//     "rule": "only_allow_merges_from_children",
//     "to":
//     {
//         "branchNames": ["iteration*"]
//     }
// }]
// 
// 
// =============================================================================
// Uncomment the following rules and modify them to define your own
// Remember to place them inside an array []
// [{
//     "enabled": true,
//     "repositories": "*",
//
//     "rule": "only_allow_merges_if_reviewed",
//     "to":
//     {   
//         "branchNames": ["main"],
//         "branchesWithAttribute":
//         [
//             {
//                 "attribute": "merge_only_reviewed",
//                 "value": "enabled"
//             }
//         ]
//     },
//     "from": 
//     {
//         "branchNames": ["task*"],
//         "branchesWithAttribute":
//         [
//             {
//                 "attribute": "task"
//             }
//         ]
//     }
// },
// {
//    "enabled": true,
//    "repositories": "*",
//
//    "rule": "restrict_merges_to_branch",
//    "to":
//    {
//        "branchNames": ["/fix3.0"],
//    },
//    "from":
//    {
//        "branchNames": ["/fix3.0/*"],
//        "branchesWithAttribute":
//        [
//            {
//                "attribute": "fix-3"
//            }
//        ]
//    }
// },
// {
//    "enabled": true,
//    "repositories": "game*",
//
//    "rule": "only_allow_merges_from_parent",
//    "to":
//    {
//        "branchNames": ["scm*"],
//        "branchesWithAttribute":
//        [
//            {
//                "attribute": "restricted_rebases",
//                "value": "yes"
//            }
//        ]
//    }
// },
// {
//    "enabled": true,
//    "repositories": "game*",
//
//    "rule": "only_allow_merges_from_children",
//    "to":
//    {
//        "branchNames": ["iteration*"]
//    }
// }]
