是否可以使用 TFSAPI 获取在特定日期之间创建的变更集?

Is it possible to get changesets created between a specific date using TFSAPI?

我正在编写一个程序,使用 Microsoft TFS Python 库(TFS API Python 客户端)根据创建日期查找变更集。

我通读了文档,发现 get_changesets() 方法可以用于此目的。但是没有参数可以帮助过滤掉基于日期的变更集。

进一步阅读后,我发现 get_tfs_resource() 可以使用,但作为使用 APIs 的新手,我无法弄清楚如何为方法调用设置有效负载,那会帮我过滤掉使用日期的变更集。

谁能帮我找出正确的使用方法,或者可以按指定发送的有效负载?

您可以查看下面的代码:

from azure.devops.connection import Connection
from msrest.authentication import BasicAuthentication
import pprint

# Fill in with your personal access token and org URL
personal_access_token = 'YOURPAT'
organization_url = 'https://dev.azure.com/YOURORG'

# Create a connection to the org
credentials = BasicAuthentication('', personal_access_token)
connection = Connection(base_url=organization_url, creds=credentials)

tfsv_client = connection.clients.get_tfvc_client()
project_name="myprojname"
search_criteria = type('',(object,),{"item_path":'$/myprojname/Trunk/Main',"fromDate":'01-01-2019', "toDate":'11-13-2019-2:00PM'})

changeset_info = tfvcclient.get_changesets(project=project_name,search_criteria=search_criteria)

参考自:

您可以使用 TFS Rest API 获取 get changeset 并执行此操作

https://{instance}/{collection}/{project}/_apis/tfvc/changesets?searchCriteria.fromDate=2020-03-11&searchCriteria.toDate=2020-03-12&api-version=4.1