Problem/Motivation
Commit notification comments are added for commits referencing issues in topic branches event when those commits are not intended as final/ready to integrate in main branch.
Proposed resolution
Add a new hook alter to let any module modify the issues to add a comment on.
Remaining tasks
Test code.
User interface changes
None.
API changes
New hook alter.
Original report by @drumm
The drupalorg module started using Feature branches, and the comments on commits have gotten quite chatty.
A couple rules I think could help:
- If a commit is on a standard branch name, like
7.x-3.x, keep notifying as we do today. (We can't look for branches being associated with releases, since the commits are still important if the dev release node hasn't been made.
- Otherwise, only comment if the issue's node ID is also in the branch name. This will notify for feature branches that follow the convention of including the ID.
This should keep good notifications for the popular always commit to HEAD workflow. When feature branches are used, we'll notify for commits with both the message and branch name that have the issue ID, and again when merged into a branch for releases.
Comments
Comment #1
marvil07 commentedThis sounds like a good idea, but I would say it is really specific to d.o, so let's create a hook to let modules, e.g. drupalorg_versioncontrol add extra logic when needed.
This issue could be about that, and we could create a related one for drupalorg.
Comment #2
jhodgdon+1 to the logic. Implementation, I have no opinion on but marvil07's idea sounds like a reasonable idea.
Comment #3
marvil07 commentedHere an initial try.
In the process I discovered some bugs, here related commits just for reference(I failed to create yet another issue for it):
Attached the patch which adds the new hook alter.
Also attached the drupalorg patch implementing the new hook alter(someone please create that issue in drupalorg project issue queue). Pending there the filter to remove issue if branch name does not contain the issue nid.
I did not yet tried the code, @drumm, any comments on the logic at the hook implementation? (mainly from drupalorg_versioncontrol/plugins/label_version_mapper/DrupalorgVersioncontrolLabelVersionMapperGit.class.php)
Comment #4
marvil07 commentedI found another kind-of-related little bug:
I have generalized a little to let pass the plugin name, so this hook can be call from both git_commits_as_comment and git_issue_mapper.
This time I could actually test/run the code and it seems to be working OK.
I created a ticket for drupalorg related code: #2363121: Restrict action into issues after versioncontrol_project_issue_git event processors
I think this part of the code is ready, @drumm, let me know if you want to review it before I add it.
Comment #6
marvil07 commentedAfter a quick chat with drumm in IRC, this is now added to upstream.
Comment #7
marvil07 commentedadding tag
Comment #8
drummNow deployed on Drupal.org.