2012-03-12 43 views
0

我們的團隊使用TFS管理以下流程中的工作流: 工作項目 - >源代碼管理 - >更改列表 - >手動部署到服務器獲取帶有完整目錄結構的TFS更改列表中的文件的文件夾/ zip

有什麼辦法只得到完整的目錄結構的文件列表對於給定的變更表?理想情況下,我希望能夠選擇多個更改列表和/或工作項目以獲取與工作項目關聯的所有更改列表,併爲更改列表/工作項目中的文件獲取完整的目錄結構。

任何建議,將不勝感激,謝謝!

回答

0

你可能可以使用下面的代碼片段上手

Uri tfsUri = new Uri(@"http://server:8080/tfs"); 
string serverPath = @"$/Project"; 

//Connect to the project collection 
var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
     tfsUri, new UICredentialsProvider()); 

//Get the source code control service. 
var sourceControl = projectCollection.GetService<VersionControlServer>(); 
var history = sourceControl.QueryHistory(
    serverPath, //Source control path to the item. Like $/Project/Path ... 
    LatestVersionSpec.Instance, //Search latest version 
    0, //No unique deletion id. 
    RecursionType.Full, //Full recursion on the path 
    null, //All users 
    new ChangesetVersionSpec("9829"), //From the 7 days ago ... 
    LatestVersionSpec.Instance, //To the current version ... 
    Int32.MaxValue, //Include all changes. Can limit the number you get back. 
    true, //Include details of items, not just metadata. 
    false //Slot mode is false. 
    ); 

//Enumerate of the changesets. 
foreach (Changeset changeset in history.OfType<Changeset>().Take(1)) 
{ 
    foreach (var change in changeset.Changes) 
    { 
     change.Item.ServerItem.Dump(); 
    } 
} 
相關問題