I was hoping that I could pass a DateVersionSpec
into VersionControlServer.DownloadFile()
but it doesn't work. It tells me that the item doesn't exist at that version, even though the file existed in source on the date passed.
Do I need to query the Item history just so I can figure out what version the file was at on the date in question? Use QueryHistory(...)
method?
My current code:
version = new DateVersionSpec(date);
var changeSets = this.vcServer.QueryHistory(remoteFile, VersionSpec.Latest, 0,
RecursionType.None, user, version, version, 50, true, false);
if (changeSets == null)
{
throw new Exception("Failed to find...");
}
foreach (var item in changeSets)
{
}
Currently I'm not getting anything back when I pull the changeSets enumerable.
I'm using code that's a lot like this: http://blogs.microsoft.co.il/blogs/srlteam/archive/2009/06/14/how-to-get-a-file-history-in-tfs-source-control-using-code.aspx
Update: the code that I have is pretty close (practically identical to the code from the post) but it dies if the file was added on a date before the date passed in and hasn't been changed since i.e. it only has one change and that's an add.