Opened 4 years ago
Last modified 2 months ago
#3674 closed change
Add a hg hook that references commits in issues — at Version 8
Reported by: | fhd | Assignee: | fhd |
---|---|---|---|
Priority: | P4 | Milestone: | |
Module: | Sitescripts | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #3676 | Platform: | Unknown / Cross platform |
Ready: | yes | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description (last modified by fhd)
Background
Whenever we currently commit something linked to a specific issue, we manually add a comment pointing to that commit. That's fairly easy to automate, since commit messages always have the same format.
We can extend this further in the future:
- We could reject commits that don't specify either an issue or Noissue in the canonical format.
- We could automatically close issues once they've been mentioned in a commit.
But all that is follow-up issue material, we should keep it simple at first.
What to change
Write a changegroup hook that inspects the changeset descriptions (i.e. commit messages) and checks if an issue was referenced. The canonical format for that is: Issue [number] - [message].
If an issue was referenced, the hook should post a comment to the respective issue, posting the changeset URL. The message should be the following if a single commit referencing an issue was found:
A commit referencing this issue has landed:
CHANGESET_URL
And the following if multiple commits referencing an issue were found:
Some commits referencing this issue have landed:
- CHANGESET_URL_1
- CHANGESET_URL_2
Change History (8)
comment:1 Changed 4 years ago by fhd
- Component changed from Sitescripts to Infrastructure
comment:2 Changed 4 years ago by fhd
- Description modified (diff)
comment:3 Changed 4 years ago by fhd
- Component changed from Infrastructure to Sitescripts
- Description modified (diff)
Silly me, internal hooks are just modules somewhere on the PYTHONPATH, sitescripts it is.
Also updating the description a bit, I want to keep it simple for now.
comment:4 Changed 4 years ago by fhd
- Description modified (diff)
comment:5 Changed 4 years ago by fhd
- Description modified (diff)
comment:6 Changed 4 years ago by fhd
- Summary changed from Write a hg hook that adds a comment on the relevant issue for each commit to Add a hg hook that references commits in issues
comment:7 Changed 4 years ago by fhd
- Blocking 3676 added
comment:8 Changed 4 years ago by fhd
- Review URL(s) modified (diff)
- Status changed from new to reviewing
Will probably end up in infrastructure rather than sitescripts because an internal hook makes more sense. But the jury is still out I suppose.