如何获得在TFS API的sourcecontrol的历史?

编程入门 行业动态 更新时间:2024-10-28 18:25:24
本文介绍了如何获得在TFS API的sourcecontrol的历史?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是新使用TFS API,我书面方式一个应用程序,谁删除我的团队项目,但在此之前我删除,我想知道上一次被合并了我的意思是出现在源代码控制浏览器的信息>样本项目>查看历史记录,并付诸文本框。

I'm new using the TFS API, I'm writting an app who delete my team projects, but before I delete I want to know the last time was merged I mean the info that appear in Source Control Explorer > "Sample Project" > view history, and put into a textbox.

此外,最后一次用户输入的项目的信息。

Also the info of the last time a user entered the project.

推荐答案

我不知道如何检查的时候是一个用户连接到该项目中的最后一次,但如何从$ C访问源代码控制历史$ C,

I Don't know how to check when was the last time a user connected to the project, but this how you can access the source control history from code,

using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.VersionControl.Client; using System.Collections; using System.Windows.Forms; //The example function is very simple: It gets a change and shows message boxes of all the changesets that have a change for the specified file up to the change transferred to the method. //Note: Change the [Server Name] with your TFS name. public void GetChangesetsOfFile(Change theChange) { //Query History parameters TeamFoundationServer tfs = new TeamFoundationServer ("[Server Name]"); VersionControlServer VCServer = (VersionControlServer)tfs.GetService (typeof(VersionControlServer)); int changeId = (theChange.Item.DeletionId != 0) ? theChange.Item.ChangesetId - 1 : theChange.Item.ChangesetId; ChangesetVersionSpec version = new ChangesetVersionSpec(changeId); ChangesetVersionSpec versionFrom = new ChangesetVersionSpec(1); string path = theChange.Item.ServerItem; //Query History Command IEnumerable changesets = VCServer.QueryHistory(path, version, 0, RecursionType.None, null, versionFrom, LatestVersionSpec.Latest, int.MaxValue, true, false); foreach (Changeset cSet in changesets) { MessageBox.Show(cSet.Changes [0].Item.ChangesetId.ToString()); } }

参考

blogs.microsoft.co.il/blogs/srlteam/archive/2009/06/14/how-to-get-a-file-history-in-tfs-source-control-using-$c$c.aspx

更多推荐

如何获得在TFS API的sourcecontrol的历史?

本文发布于:2023-11-03 09:17:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1554791.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何获得   历史   API   TFS   sourcecontrol

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!