So that all clients are consistent in how they preview the final commit message to the user, Lando API should provide an endpoint that when queried with a revision ID and author information, returns the standardized commit message as it would be when landed.
Summary: Add API endpoint to generate a the final commit message for a revision → Add field to revision API endpoint that includes a preview of the final commit message for a revision
After thinking about this bug for a while, I realized that there is no value in creating an entire API endpoint that just gets the commit message preview - instead it would be better to include it in the revision payload itself. The original thought process was: - Create the API endpoint that generates the default commit message and can have parameters which change the output. - e.g. parameters such as commit author, reviewers, bug, etc. This is not necessary because the commit author is separate from the actual line of the commit message - thus it need not be a parameter to this method. In addition the reviewers and bug would never change since the default commit message would include them already, assuming the bug and reviewers are properly set on the Phabricator Revision. In the cases where custom change to commit message are needed, we allow the user to edit it in their client as freeform text using the default commit message as a starter. Upon requesting for landing we will validate the commit message format and fail if it is improper. So basically the new change I'm making is: no dedicated api endpoint for this, just adding it as a field to the revision payload (this also has an advantage of clients not needing to make an extra network request).
Investigate the mozautomation.commit parser and reuse the regex/functions for validating the bug id and reviewer list in the commit message
Actually I will move using the commitparser library into a new bug.
Comment on attachment 8908125 [details] Bug 1399219 - Add commit_message_preview field to GET /revisions endpoint Piotr Zalewa [:zalun] has approved the revision. https://phabricator.services.mozilla.com/D57#1418
Attachment #8908125 - Flags: review+
Status: NEW → RESOLVED
Last Resolved: 7 months ago
Resolution: --- → FIXED
Attachment #8908125 - Attachment description: WIP: Add commit_message_preview field to GET /revisions endpoint → Bug 1399219 - Add commit_message_preview field to GET /revisions endpoint
You need to log in before you can comment on or make changes to this bug.