【问题标题】:TFVC Get Items for a specific date time version programaticallyTFVC 以编程方式获取特定日期时间版本的项目
【发布时间】:2020-11-25 21:14:48
【问题描述】:

有没有办法检索使用 TFVC 客户端包含的特定日期和时间戳的天蓝色项目?在 Visual Studio 中,我可以使用 Get specific version 选项从源代码管理中检索特定日期时间的文件。

但是,当我尝试使用 TFVC 客户端库通过 .NET 代码执行此操作时,它会返回文件 before 该特定日期并且时间戳被完全忽略。

var version = new TfvcVersionDescriptor
            {
                VersionType = TfvcVersionType.Date,
                Version = date.ToString(),
                
            };
var items = ttfClient.GetItemsAsync(_config.ProjectName, _config.ScopePath, recursionLevel: VersionControlRecursionType.Full, versionDescriptor: version).Result;

还有其他有效的方法可以实现吗?

【问题讨论】:

    标签: c# azure azure-devops tfvc azure-rest-api


    【解决方案1】:

    作为解决方法,您可以运行两次其余 api 以获取特定日期之前的项目列表。然后比较它们以检索特定日期的项目列表。

    这里我以rest api为例:

    获取日期2019-02-28之前的物品清单:

    https://dev.azure.com/{org}/{pro}/_apis/tfvc/items?versionDescriptor.versionType=date&versionDescriptor.version=2019-02-28T00:00&scopePath=$/Path&api-version=5.1
    

    获取日期2019-02-27之前的物品清单:

    https://dev.azure.com/{org}/{pro}/_apis/tfvc/items?versionDescriptor.versionType=date&versionDescriptor.version=2019-02-27T00:00&scopePath=$/Path&api-version=5.1
    

    比较以上回复中的项目,则可以得到特定日期 2019-02-27 的项目列表。

    【讨论】:

    • 嗨,休,谢谢你的建议。我正在做类似的事情。获取 (date.AddDays(1)) 的项目,这基本上是所需日期或之前的所有项目。谢谢:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-27
    • 2010-12-17
    相关资源
    最近更新 更多