TFS: how to add check-in comment automatically
I would like to know if it's possible, eventually by developing somethng using the SDK, to provide a check-开发者_如何学Cin comment automatically when checking-in in TFS.
UPDATE: I tried using the SDK API like so:
TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(tfsName);
tfs.EnsureAuthenticated();
VersionControlServer versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
versionControl.CommitCheckin += VersionControlOnCommitCheckin;
But the event does not seem to be fired. Is there anything blatantly wrong I'm doing?
The problem is that the TFS API events used as shown in my question are raised only when the operations are performed from the same API instance, thus same machine, same process, same AppDomain.
Without knowing anything about TFS, that sounds like it runs counter to the purpose of having a commit comment. You're supposed to include useful high-level information in a check-in comment about why things have changed. If people just want to know what has changed, they can look at diffs. Automatically generating a comment would seem to be defeating the point.
Both the SDK and the command line allow you to specify the check-in comment. If you're looking at doing this when the person checks in from within Visual Studio, you'll have to look at some automation, but, with VS2010, it should be relatively straightforward using DTE/MEF.
We have a couple automated processes that do check-ins, and we specify the comment to indicate that the check-in occurred as part of an automated process.
精彩评论