TFS API Pending Items, Exclude list, Include List

  • Thread starter Thread starter Brav01
  • Start date Start date
B

Brav01

Guest
Hello

Background,

I am making a TFS merge tool to service out development and Branch requirements.

Withing this tool I have a business object layer that uses the Microsoft.Teamfoundation.ExtendedClient Package.

What I have

I currently have a function that does the checkin for my pending items

The 'changes' object has all my changes in it. Included and Excluded

Workspace workspace = _vcs.GetWorkspace(_workspaceName, _workspaceOwner);
WorkItemCheckinInfo checkInInfo = new WorkItemCheckinInfo(pbi, WorkItemCheckinAction.Associate);
PendingChange[] changes = workspace.GetPendingChanges();
ChangesetID = workspace.CheckIn(changes, checkInComment, null, new WorkItemCheckinInfo[] { checkInInfo }, null);


What I need


I need to only get his list of 'Included' Pending changes.

Some have suggested using, bu this fails as ITS only has zero rows.

//get all candidate changes and promote them to included changes
PendingChange[] candidateChanges = null;
string serverPath = workspace.GetServerItemForLocalItem(_workspaceName);
List<ItemSpec> its = new List<ItemSpec>();
its.Add(new ItemSpec(serverPath, RecursionType.Full));

workspace.GetPendingChangesWithCandidates(its.ToArray(), true, out candidateChanges);

foreach (var change in candidateChanges)
{
if (change.IsAdd)
{
//ws.PendAdd(change.LocalItem);
}
else if (change.IsDelete)
{
//ws.PendDelete(change.LocalItem);
}
}


I have also tried this but SavedCheckin = null and i get an exception.

SavedCheckin savedCheckin = workspace.LastSavedCheckin;
////// Create a list of pending changes.
var pendingAdds = new List<PendingChange>(workspace.GetPendingChanges());
List<PendingChange> excludedChanges = new List<PendingChange>();
for (int i = 0; i <= changes.Length - 1; i++)
{
if (savedCheckin.IsExcluded(changes.ServerItem))
{
excludedChanges.Add(changes);
}
Console.WriteLine(changes.LocalItem.ToString() + " Change " + changes.ChangeType)
}



So I either need to iterate through the 'changes' list and remove 'Excluded' items

or there is bound to be something im missing here.

thanks in advance

Alan

Continue reading...
 
Back
Top