【问题标题】:Is it possible to get changesets created between a specific date using TFSAPI?是否可以使用 TFSAPI 在特定日期之间创建变更集?
【发布时间】:2020-03-11 05:43:06
【问题描述】:

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

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

在进一步阅读中,我发现可以使用 get_tfs_resource(),但是对于使用 API 的新手,我不知道如何为方法调用设置有效负载,这将有助于我使用日期过滤掉变更集。

有人可以帮助我使用正确的方法,或者可以按指定发送的有效负载吗?

【问题讨论】:

    标签: python tfs


    【解决方案1】:

    【讨论】:

    • 感谢您的回答。 python 中的 SSL 存在一些问题,但此调用在其他任何地方都运行良好
    • 你可能会忽略 python 环境变量的 ssl 问题,查看这篇文章可能会有所帮助medium.com/@moreless/…
    【解决方案2】:

    您可以查看以下代码:

    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)
    

    参考来源:

    【讨论】:

    • 这应该适用于 api-version 4.1 吗?我无法运行 get_tfvc_client() 方法。
    猜你喜欢
    • 1970-01-01
    • 2012-05-27
    • 2010-10-29
    • 2012-02-09
    • 1970-01-01
    • 2021-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多