VersionControlServer - 在某一特定日期/时间获取最新版本的文件(Versio

2019-10-29 07:42发布

我有一个程序获取最新版本的文件使用下面的代码TFS服务器。

TeamFoundationServer myTFS = TeamFoundationServerFactory.GetServer(myURL);
VersionControlServer myVCS = (VersionControlServer)myTFS .GetService(typeof(VersionControlServer));

ItemSet downloadItems = myVCS.GetItems(myDirectory, RecursionType.Full);
foreach (Item item in downloadItems.Items)
{
    item.DownloadFile(myDownloadPath);
}

相反,获取最新版本的,我希望能够指定日期和时间,并在那个时间点得到物品的套装。 然后,在DownloadFile电话,我想无论是在套装中的文件的最新版本在指定的日期和时间。

我看到项目有CheckinDate属性,但如果这个值是我寻找的日期和时间后,我不知道如何让以前的版本。

Answer 1:

当您查询的项目GetItems ,你应该提供的版本规范你感兴趣的,在这种情况下DateVersionSpec

例如:

DateTime whenever = DateTime.Now;
ItemSet downloadItems = myVCS.GetItems(myDirectory, new DateVersionSpec(whenever), RecursionType.Full);

显然,更换DateTime.Now与任何你感兴趣的内容。



文章来源: VersionControlServer - Get latest version of file at a specific date/time