TFS SDK를 사용하고 있으며 최신 버전의 프로젝트를 가져올 수있는 방법이 있습니다. 하지만 내가 메서드 호출 할 때, 그것은 항상 파일을 다시 다운로드합니다. 이것은 또한 오랜 시간이 걸립니다.항상 최신 메소드 가져 오기
나는 그것을 시도했다. 나는 changeSet을 얻었고 항목들을 비교했다. 항목에 변경 사항이있는 경우 다운로드하십시오. 그러나이 방법은 너무 오래 걸립니다. 체크 변경 집합없이 내 첫 번째 코드입니다
ItemSet items = sourceControl.GetItems(itemPath, VersionSpec.Latest, RecursionType.Full);
foreach (Item item in items.Items)
{
localName = item.ServerItem.ToString();
localName = localName.Substring(2, (localName.Length - 2)).Replace("/", "\\");
switch (item.ItemType)
{
case ItemType.Any:
throw new ArgumentOutOfRangeException("ItemType returned was Any; expected File or Folder.");
case ItemType.File:
item.DownloadFile("D:\\WORK\\Tries\\"+localName);
break;
case ItemType.Folder:
Directory.CreateDirectory("D:\\WORK\\Tries\\"+localName);
break;
}
}
그리고 내 새로운 코드 검사 체인지
ItemSet items = sourceControl.GetItems(itemPath, VersionSpec.Latest, RecursionType.Full);
foreach (Item item in items.Items)
{
localName = item.ServerItem.ToString();
localName = localName.Substring(2, (localName.Length - 2)).Replace("/", "\\");
var histories = sourceControl.QueryHistory(itemPath, VersionSpec.Latest, 0, RecursionType.OneLevel, null, null, null, Int32.MaxValue, true, false, true);
bool check = false;
foreach (Changeset history in histories)
{
foreach (Change change in history.Changes)
{
if (change.Item.Equals(item))
check = true;
}
}
switch (item.ItemType)
{
case ItemType.Any:
throw new ArgumentOutOfRangeException("ItemType returned was Any; expected File or Folder.");
case ItemType.File:
if(check)
item.DownloadFile("D:\\WORK\\Tries\\"+localName);
break;
case ItemType.Folder:
if(!Directory.Exists("D:\\WORK\\Tries\\" + localName))
Directory.CreateDirectory("D:\\WORK\\Tries\\"+localName);
break;
}
}
아무도 제안이 있는가이다? 감사.
편집 : 최신 변경 작업 영역을 업데이트하려고하는 경우 실제로 잘못된 방법을 요구하고있다
String ServerFolder = itemPath; // start with "$/ + serverFolder path"
itemPath = itemPath.Substring(2, (itemPath.Length - 2)).Replace("/", "\\");
String LocalFolder = @"D:\WORK\"+itemPath;
WorkingFolder workfolder = new WorkingFolder(ServerFolder, LocalFolder);
workspace.CreateMapping(workfolder);
workspace.Get(VersionSpec.Latest,GetOptions.Overwrite);
이해 don'd. 몇 가지 예제 코드를 제공해 주시겠습니까? – mozkarakoc
샘플 코드가 게시물에 추가되었습니다. 궁금한 점이 있으면 알려주세요. –
나는 며칠 동안 떨어져있었습니다. 나는 그것을 보았다. 감사. 작동하지만 작업 영역의 모든 프로젝트를 업데이트합니다. treeView에서 선택된 프로젝트의 최신 버전을 얻고 싶습니다. 편집 : 문제를 해결했습니다. – mozkarakoc