hereから取得したこのコードを使用したため、ローカルワークスペースとTFSのserverionバージョンの違いとともに最新の変更を取得したい
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;
}
}
}
ただし、このコードはソースからすべてのファイルをダウンロードし、ローカル ワークスペースの既存のファイルを置き換えます。
ローカル版とサーバー版の違いだけをダウンロードする方法はありますか? たとえば、ローカルのファイル/フォルダーを削除した場合、他のファイルを置き換えることなく、変更セットに関連付けられた新しいファイルと一緒にそれらもダウンロードする必要があります