Add field to revision API endpoint that includes a preview of the final commit message for a revision

RESOLVED FIXED

Status

Conduit
Lando
RESOLVED FIXED
7 months ago
3 months ago

People

(Reporter: imadueme, Assigned: imadueme)

Tracking

Details

Attachments

(2 attachments)

(Assignee)

Description

7 months ago
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.
(Assignee)

Updated

7 months ago
Assignee: nobody → imadueme
(Assignee)

Updated

7 months ago
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
(Assignee)

Comment 1

7 months ago
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).
(Assignee)

Comment 2

7 months ago
Investigate the mozautomation.commit parser and reuse the regex/functions for validating the bug id and reviewer list in the commit message
(Assignee)

Comment 4

7 months ago
Actually I will move using the commitparser library into a new bug.
(Assignee)

Updated

7 months ago
Blocks: 1400306
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+
(Assignee)

Comment 6

7 months ago
Created attachment 8911904 [details]
commit-message-preview.PNG
(Assignee)

Updated

7 months ago
Status: NEW → RESOLVED
Last Resolved: 7 months ago
Resolution: --- → FIXED

Updated

3 months ago
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.