0

when attempting to get the line changes for a very large file (10K+ lines), not all changes are returned. is there a way to paginate the return result? or a different query parameter that can be sent so as to not truncate the response?

url = https://{account}.visualstudio.com/{project}/_api/_versioncontrol/fileDiff?__v=5&diffParameters={params}&repositoryId={repositoryId}

params (removing spaces) =

{
     "originalPath": commit path,
     "originalVersion": parent commit_id,
     "modifiedPath": commit path,
     "modifiedVersion": commit_id,
     "partialDiff": True
}

(Expected) sample response (based on this answer):

{
     "changeType": 2,
     "mLine": 9,
     "mLines": [],
     "mLinesCount": 0,
     "oLine": 9,
     "oLines": [
       "    <!-- Polyfill(s) for older browsers -->"
     ],
     "oLinesCount": 1
},
{
      "changeType": 1,
      "mLine": 22,
      "mLines": [
        "      <div>2</div>"
      ],
      "mLinesCount": 1,
      "oLine": 23,
      "oLines": [],
      "oLinesCount": 0
}

I am able to get a response. But the response does not include line changes that are found far down the file; this is usually denoted when reviewing the commit via the UI with this warning: "The file is too large to be included in the change summary view. Navigate to the file to view the full diff."

1 Answers1

0

I'm afraid there is no way to get all lines in your scenario. As the top and skip parameter don't work in this api. You may check whether there is continuationToken in the response hearder, if there is continuationToken, then try to add continuationToken={continuationToken} in the api to see whether it works. If there is no continuationToken, then there is no way to get all lines in your file as it too large.

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • Thanks for the response Cece! Unfortunately, I'm not receiving a `continuationToken` in the response headers. – BlakeTheriot Jul 21 '20 at 23:48
  • Then we are not able to get all lines in your file which is too large :-(. If my reply helps you, you could [Accept it as an Answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work), this can be beneficial to other community members reading this thread. – Cece Dong - MSFT Jul 22 '20 at 01:43