YACC settings can be fetched and modified via the Bitbucket REST API, as documented here. For example,

Fetching the YACC settings for a repository

Pre-receive hook settings:

curl -u admin -X GET -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/settings

Merge check settings:

curl -u admin -X GET -d "" -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccMergeCheck/settings

  • Replace “admin” with the username for a Bitbucket administrator

  • Replace “localhost:7990” with the hostname and port of your Bitbucket instance.

  • If your Bitbucket instance is served via HTTPS, update the command above to “https://” instead of “http://”.

  • Replace “PROJECT_1” and “rep_1” with the project and repository you’re interested in.

Updating the YACC settings for a repository

Pre-receive hook settings:

curl -u admin -X PUT -d @settings.json -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/settings

Merge check settings:

curl -u admin -X PUT -d @settings.json -H "Content-Type: application/json" http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccMergeCheck/settings

  • These commands are the same ones as for fetching the settings, except using PUT instead of GET, and specifying new the settings with the -d flag.

  • To generate settings.json, fetch the full YACC settings as described above and modify as needed.

Turning YACC on or off for a repository

To enable the YACC pre-receive hook for a specific repository:

curl -u admin -X PUT http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/enabled

To disable the YACC pre-receive hook for a specific repository:

curl -u admin -X DELETE http://localhost:7990/rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.isroot.stash.plugin.yacc:yaccHook/enabled

  • Replace “admin” with the username for a Bitbucket administrator

  • Replace “localhost:7990” with the hostname and port of your Bitbucket instance.

  • If your Bitbucket instance is served via HTTPS, update the command above to “https://” instead of “http://”.

  • Replace “PROJECT_1” and “rep_1” with the project and repository you’re interested in.