首页 > 解决方案 > 如何从 tfs 中提取链接到 python 中工作项的变更集?

问题描述

我想使用 Microsoft TFS Python 库在 python 中提取变更集和受变更集影响的类的名称。https://devopshq.github.io/tfs/index.html

我已经使用 python 连接到 TFS 并且能够检索所有必需的工作项。我想提取与工作项关联的变更集。

我已使用以下代码进行连接。

from tfs import TFSAPI  
user="xxxxxxxxxxxxx"  
password="xxxxxxxxxxxxxx"  
from requests_ntlm import HttpNtlmAuth  
client = TFSAPI("https://xyzjds.com", project="abc", user=user,password=password, auth_type=HttpNtlmAuth)    
query = client.run_query('xxxxxxxxxxxxxxx')    
workitems = query.workitems  

现在我所有的工作项都不知道如何访问工作项的变更集。

标签: pythonpython-3.xpython-2.7dictionarytfs

解决方案


变更集存在于relationstype的属性中ArtifactLink,因此您应该迭代工作项并检查是否relations存在,如果是,请检查类型的关系是否ArtifactLink存在,然后在 url 中获得变更集 ID:

在此处输入图像描述

在此处输入图像描述


推荐阅读