I want to get the latest changes along with the difference between the local workspace and the server version from TFS, since I used this code, which I got from here
private static void GetLatest(string username, string password, string path_to_download,
string tf_src_path)
{
Uri collectionUri = new Uri(PathConstants.uri);
NetworkCredential credential = new NetworkCredential(username, password);
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(PathConstants.uri), credential);
tfs.EnsureAuthenticated();
VersionControlServer vc = tfs.GetService<VersionControlServer>();
foreach (var item in vc.GetItems(PathConstants.tfsRoot + tf_src_path, VersionSpec.Latest, RecursionType.Full).Items)
{
string relativePath = _BuildRelativePath(path_to_download, item.ServerItem);
switch (item.ItemType)
{
case ItemType.Any:
throw new ArgumentOutOfRangeException("ItemType returned was Any; expected File or Folder.");
case ItemType.File:
item.DownloadFile(relativePath);
break;
case ItemType.Folder:
Directory.CreateDirectory(relativePath);
break;
}
}
}
But this code loads all the files from the source code and replaces the existing files in the local workspace.
Is there a way to download only the difference between the local and server versions? for example, if I delete any files / folders on my local computer, they will also be downloaded along with the new files associated with the change sets, without replacing other files.
source
share