有没有办法在签到政策之外的TFS中获得选定和未选择的待定更改?
我知道IPendingCheckinPendingChanges
和IPendingCheckin
接口,但有没有办法检索那些没有签入策略或Visual Studio插件的实例?
答案 0 :(得分:1)
您可以通过SavedCheckin.IsExcluded方法实现这一目标。请查看以下代码,该代码引自Kelley在此case中的第二个回复。
TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfsservername:8080/tfs/DefaultCollection"));
VersionControlServer vcs = (VersionControlServer)tpc.GetService(typeof(VersionControlServer));
Workspace workspace = vcs.GetWorkspace("$/sourcelocation");
IEnumerable<PendingChange> pendingChanges = workspace.GetPendingChangesEnumerable();
SavedCheckin savedCheckin = workspace.LastSavedCheckin;
List<PendingChange> excludedChanges = new List<PendingChange>();
foreach (PendingChange change in pendingChanges)
{
if (savedCheckin.IsExcluded(change.ServerItem))
{
excludedChanges.Add(change);
}
}