简体   繁体   中英

TFS ISubscriber plugin, how do I access the files checked in?

I am writing a plugin for TFS that performs automatic branching and merging based on an xml file stored in source. I am able to perform this on the server except I am unable to get the latest of the xml file if it was changed.

public EventNotificationStatus ProcessEvent(TeamFoundationRequestContext requestContext, NotificationType notificationType, object notificationEventArgs, out int statusCode, out string statusMessage, out ExceptionPropertyCollection properties)
{
  TeamFoundationVersionControlService versionControl = requestContext.GetService<TeamFoundationVersionControlService>();

  string localTempFile = Path.GetTempFileName();          
  versionControl.DownloadFile(requestContext, serverItemPath, 0, VersionSpec.Parse("C" + versionControl.GetLatestChangeset(requestContext).ToString(), null).First(), localTempFile);

  return EventNotificationStatus.ActionApproved
}

The issue is that because I want to intercept the checkin before it becomes a changeset, the download file function gets me the version of the latest checkin, not the version that was promoted. Does anyone know how to get the version being checked in?

您应该尝试CheckinEvent类的工件字段。

CheckinEvent ev = notificationEventArgs as CheckinEvent;

I would take a different route: use a CI build that monitors just that file. It is way more robust and manageable than a server plug-in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM