atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.34k stars 659 forks source link

[Bitbucket] Support pull request comments on specific lines #1439

Open MarkRx opened 1 month ago

MarkRx commented 1 month ago

Currently comments can only be added to the overall section of a PR. The Bitbucket Data Center REST API supports adding comments to specific lines within a file by using the "anchor" field. The Bitbucket Cloud REST API uses an "inline" field.

Example Bitbucket Data Center: General file comment:

 {
     "text": "An insightful general comment on a file.",
     "anchor": {
         "diffType": "RANGE",
         "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd",
         "path": "path/to/file",
         "srcPath": "path/to/file",
         "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b"
     }
 }

File line comment:

{
    "text": "A pithy comment on a particular line within a file.",
    "anchor": {
        "diffType": "COMMIT",
        "line": 1,
        "lineType": "CONTEXT",
        "fileType": "FROM",
        "fromHash": "6df3858eeb9a53a911cd17e66a9174d44ffb02cd",
        "path": "path/to/file",
        "srcPath": "path/to/file",
        "toHash": "04c7c5c931b9418ca7b66f51fe934d0bd9b2ba4b"
    }
}

Example Bitbucket Data Center:

  "inline": {
    "from": 57,
    "to": 122,
    "path": "<string>"
  },
ZultanH commented 1 month ago

I second this, would be very helpful.