我们已实现TFGet来下载最新项目,并提供TFS URL,TFS路径和本地路径。
如果在构建定义中选择了架子,则需要实施代码以搁置架子细节。
ItemSet = VcsRef.GetItems(TfsPath, VersionSpec.Latest, RecursionType.Full, DeletedState.NonDeleted, ItemType.File,true);
-使用它来获取用于下载文件/创建文件夹的项目列表(如果它是文件夹)。
要使用此下载搁置集详细信息,
PendingSet[] pendingSets = VcsRef.QueryShelvedChanges("tfget", "userid", null, true);
if (shelvedChanges.Length == 0)
{
Console.Error.WriteLine("You don't have permission to any of the files involved.");
Environment.Exit(1);
}
else if (pendingSets.Length > 1)
{
Console.Error.WriteLine("More than one shelveset matched.");
Environment.Exit(1);
}
PendingChange[] shelvedChanges = pendingSets[0].PendingChanges;
if (pendingSets.Length == 0)
{
Console.Error.WriteLine("No shelveset matched.");
Environment.Exit(1);
}
foreach (PendingChange shelvedChange in shelvedChanges)
{
// We only want files that are being edited, but there's nothing to diff if
// the file is guaranteed not to exist at a different version.
Console.WriteLine("shelved changes are",shelvedChange.ToString());
if (shelvedChange.ItemType != ItemType.File ||
!shelvedChange.IsEdit || shelvedChange.IsAdd || shelvedChange.IsBranch)
{
continue;
}
var relativeNameOnly = shelvedChange.ToString().Remove(0, TfsPath.Length);
var targetName = Local + relativeNameOnly.Replace("/", @"\");
//Console.WriteLine("shelvedChange {0} is", shelvedChange);
shelvedChange.DownloadShelvedFile(targetName);
}
但无法下载,这是正确的方法吗?
答案 0 :(得分:0)
您可以尝试REST API来获取浅层架子集引用的集合:
Get http://TFS:8080/tfs/DefaultCollection/_apis/tfvc/shelvesets?requestData.includeLinks=true&api-version=3.2-preview