更新时间:2023-11-30 14:33:46
在做了更多研究之后,我发现了问题所在.我们的 TFS 的结构类似于以下内容:
After doing some more research I figured out the problem. Our TFS is structured similarly to the following:
$/Root
$/Root/Folder
$/Root/Folder/Branch
向下的第一级不会返回任何分支,因为没有任何分支.因此,我使用了一种更简单的方法来获取所有分支.
The first level down would not return any Branches because there aren't any. So Instead I used a simpler approach that gets all of the Branches.
var branchObjects = vcs.QueryRootBranchObjects(RecursionType.Full);
foreach (var branch in branchObjects)
{
var branchName = branch.Properties.RootItem.Item;
var parentFolder = branchName.Substring(0, branchName.LastIndexOf('/'));
if (!_listOfBranches.Contains(parentFolder))
{
_listOfBranches.Add(parentFolder);
}
_listOfBranches.Add(branchName);
}
_listOfBranches.Sort();
目前这不是最干净的方法.但它能够检索指定项目的所有分支,以及父文件夹(目前不包括根).
It's not the cleanest approach at the moment. But it's able to retrieve all the Branches for the specified project, as well as the Parent Folders (excluding the Root, for now).