在 TFS 项目中查找标签 [英] Find Label in TFS Project

查看:28
本文介绍了在 TFS 项目中查找标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用以下代码通过指定标签在 tfs-project 中查找分支:

I´m currently using the following code to find a branch inside a tfs-project by a specified label:

TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(tfsuri));

var vcs = tfs.GetService<VersionControlServer>();

string labelscope = labelscopepath;

var specifiedBranch = vcs.QueryLabels(label, labelscope, null, true);

但是这样我只有在知道标签名称时才会得到分支.所以我现在需要的是找到指定项目和相关分支中所有标签的方法.

But this way I only get branches when I know the name of the label. So what I need now is a methode to find all labels inside the specified project and the related branches.

这是我的 TFS 结构.分支Branch2"具有标签Label1".现在我想列出所有有标签的分支,包括标签名称.在这种情况下,此列表中只有 Branch2.

So here is my TFS-structure. The branch "Branch2" has the label "Label1". Now I´d like to list all branches that have a label, including the labelname. In this case only Branch2 would be in this list.

推荐答案

您可以先获取标签列表,然后列出具有标签的分支.

You could get a list of labels first, then list branches that have a label.

public VersionControlLabel[] QueryLabels(String labelName,
                                         String labelScope,
                                         String owner, 
                                         bool includeItems,
                                         String filterItem,
                                         VersionSpec versionFilterItem)

更多详情请参考此博客:在文件上显示标签,包括标签注释您甚至可以按照此教程.

More details please refer this blog: Displaying the labels on a file, including label comments You could even display Label dialog programatically following this tutorial.

这篇关于在 TFS 项目中查找标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆