3

We'd like to generate build notes with the following format:

1) Associated ChangeSets:
2)   - ChangeSet 45241, by Joe: "Patching fix for foobar"
3)     'Foo.cs' integrated from dev v. 22 to qa v. 7
4)     'Bar.cs' integrated from dev v. 9 to qa v. 3

So far, we have a custom build step that accomplishes 1) and 2). It looks at the information produced by the 'AssociatedChangesetsAndWorkItems' TFS Build Activity. Here is the code:

protected override bool Execute(CodeActivityContext context)
{
     StreamWriter sw = new StreamWriter(Path.Combine(BuildNotesPath.Get(context),"build-notes.txt"));
     sw.WriteLine("Associated ChangSets:");
     foreach (Changeset changeset in BuildAssociatedChangesets.Get(context))
     {
        sw.WriteLine(string.Format("ChangeSet {0}, by {1}: {2}", changeset.ChangesetId, changeset.Committer, changeset.Comment));            
        foreach (Change change in changeset.Changes)
        {               
           foreach (MergeSource source in change.MergeSources)
              sw.WriteLine(string.Format("\'t{0}': integrated from dev v. {1} to qa v. {2}", source.ServerItem, source.VersionFrom, source.VersionTo));
        }
     }
     sw.Flush();
     sw.Dispose();
     return true;  
}

The problem we're having is that the 'MergeSources' field is always an empty list. What do we have to do to get that field populated?

1 Answer 1

1

Take a look at MergeWorkItemsEventHandler.MergeWorkItems and .GetMergeHistory along with the Extensions.PendingMerges method in the TFS 2010 Merge Work Items Event Handler for an example of getting merge sources.

Jakob Enh deserves the credit for this answer. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.