如何获得对 TFS 的评论

How to get comments on TFS

场景是:

  1. 我在我的 Jira 上打开了一个名为 我的选项卡 的选项卡——它就像其他选项卡一样工作。

  2. 我有 TFS 2015,我写了一个 TFS 服务器端插件来检查用户是否在他们的签到中使用了像 [Example] 我的评论 [/Example] 这样的标签,否则评论得到被拒绝。

  3. 这一步是我卡住的地方:
    我想联系 TFS 获取 [Example][/Example] 标签之间的注释。当我单击 我的选项卡 时,我想查看所有 这些标签之间与此问题相关的评论(其子任务是 包括)。

示例:

username submitted changeset #1 to http://localhost:8080/tfs

11/1/2016 5.35 PM

[Example] My first comment [/Example]

issue ID: 124


username2 submitted changeset #2 to http://localhost:8080/tfs

11/2/2016 10.30 AM

[Example] My comment is the second one [/Example]

issue ID: 124


username3 submitted changeset #65 to http://localhost:8080/tfs

11/2/2016 5.30 PM

[Example] My comment is under the subtask, issue ID is different [/Example]

issue ID: 125


如何使用 Java SDK 执行此操作?我想实现我自己的,我不想使用任何插件。

您可以使用TFS REST API获取变更集,然后您可以在响应中获取注释值:

GET http://({server:port})/DefaultCollection/_apis/tfvc/changesets/{id}?api-version=1.0