TFS API 变更集分支
我尝试按照 这篇文章。但是,我注意到变更集有一个名为 IsBranch 的属性,这不是本文描述的检查变更集是否为分支的方法。
以下检查有什么区别:
VersionControlServer vcs = tpc.GetService<VersionControlServer>();
Changeset cs = vcs.GetChangeset(changeset.ChangesetId);
Console.WriteLine("Changeset: {0}", cs.ChangesetId);
// Get History
foreach (var change in cs.Changes)
{
if (change.Item.IsBranch)
{
}
和
VersionControlServer vcs = tpc.GetService<VersionControlServer>();
Changeset cs = vcs.GetChangeset(changeset.ChangesetId);
Console.WriteLine("Changeset: {0}", cs.ChangesetId);
// Get History
foreach (var change in cs.Changes)
{
if ((change.ChangeType & ChangeType.Branch) == ChangeType.Branch)
{
}
I’ve trying to extract the branch history from a changeset, following this article. However, I’ve noticed that a Changeset has a property called IsBranch, which is not the way that the article describes to check whether the changeset is a branch.
What is the difference between the following checks:
VersionControlServer vcs = tpc.GetService<VersionControlServer>();
Changeset cs = vcs.GetChangeset(changeset.ChangesetId);
Console.WriteLine("Changeset: {0}", cs.ChangesetId);
// Get History
foreach (var change in cs.Changes)
{
if (change.Item.IsBranch)
{
}
And
VersionControlServer vcs = tpc.GetService<VersionControlServer>();
Changeset cs = vcs.GetChangeset(changeset.ChangesetId);
Console.WriteLine("Changeset: {0}", cs.ChangesetId);
// Get History
foreach (var change in cs.Changes)
{
if ((change.ChangeType & ChangeType.Branch) == ChangeType.Branch)
{
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Item 类的 IsBranch 属性是 2010 年新增的,因此第二种方法是您在以前版本的 TFS 中执行此操作的方法。
2010 级成员
2008 级成员
The IsBranch property of the Item class is new in 2010, so the second way is the way that you would have done it in previous versions of TFS.
2010 Class Members
2008 Class Members
要让 TFS 设置
item.IsBranch
属性的值,您需要通过传递GetItemsOptions.IncludeBranchInfo< 告诉
VersionControlServer
您需要项目的分支信息调用GetItem()
时的 /code> 标志。示例:
To get TFS to set the value for the
item.IsBranch
property you need to tell theVersionControlServer
that you want the item's branch info by passing theGetItemsOptions.IncludeBranchInfo
flag when callingGetItem()
.Example: