【问题标题】:TFS GIT REST API get related work items of commitTFS GIT REST API 获取提交的相关工作项
【发布时间】:2016-12-13 17:33:46
【问题描述】:

我想查询 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

不幸的是,它返回截断的 cmets,因此并不总是可以看到工作项 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。 我已阅读文档,但没有找到单独获取完整评论或相关工作项的解决方案。

【问题讨论】:

    标签: git tfs


    【解决方案1】:

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

    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 部分。

    【讨论】:

    • 谢谢!这并不是我所期待的,但如果这是唯一的方法,那么我会采用它。
    猜你喜欢
    • 2018-04-08
    • 1970-01-01
    • 2018-03-06
    • 1970-01-01
    • 2019-03-11
    • 1970-01-01
    • 2017-05-07
    • 2020-04-04
    • 2018-07-17
    相关资源
    最近更新 更多