TFS GIT REST API 获取提交相关的工作项

5
我希望查询GIT提交以获取与特定提交相关的工作项ID。 (https://www.visualstudio.com/en-us/docs/integrate/api/git/commits)

请求:

http://{server}/tfs/{collection}/{git repository}/_apis/git/repositories/{repository name}/commits?api-version=1.0

很不幸,它返回被截断的评论,因此有时不能看到工作项ID(#{Work Item ID})。

{
    "count": 100,
    "value": [{
            "commitId": "commit hash",
            "author": {
                "name": "some name",
                "email": "some email",
                "date": "2016-12-12T14:29:28Z"
            },
            "committer": {
                "name": "some name",
                "email": "some email",
                "date": "2016-12-12T14:29:28Z"
            },
            "comment": "Merge branch 'someBranch' of something.",
            "commentTruncated": true,
            "changeCounts": {
                "Add": 5,
                "Edit": 34
            },
            "url": "url",
            "remoteUrl": "remoteUrl"
        }]
}

在上面的响应中,属性“commentTruncated”被设置为true。我已经阅读了文档,但没有找到获取完整评论或相关工作项的解决方案。
1个回答

4

询问每个提交的详细信息,例如:

GET https://fabrikam-fiber-inc.visualstudio.com/DefaultCollection/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/commits/be67f8871a4d2c75f13a51c1d3c30ac0d74d4ef4?api-version=1.0

请参阅文档中的Just the commit部分。


注意:请勿修改或删除HTML标记。

谢谢!这不是我预期的,但如果这是唯一的方法,那我就接受了。 - Viktors Telle

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接