2012-03-27 73 views
1

我正在開發項目,以在服務器端實施TFS中的一些簽入策略。作爲其中的一部分,我試圖獲得現在正在提交的變更集的歷史記錄。但是,當檢查發生時,我得到的變更集號碼爲-1。我不知道爲什麼會發生這種情況。我懷疑是否僅在執行ProcessEvent方法後才分配變更集編號。感謝你的幫助。點擊TFS簽入事件

public EventNotificationStatus ProcessEvent(TeamFoundationRequestContext requestContext, NotificationType notificationType, 
       object notificationEventArgs, out int statusCode, out string statusMessage, out ExceptionPropertyCollection properties) 
      { 
       statusCode = 0; 
       properties = null; 
       statusMessage = string.Empty; 


       if (notificationType == NotificationType.DecisionPoint) 
       { 
        try 
        { 
         if (notificationEventArgs is CheckinNotification) 
         { 
          CheckinNotification notification = notificationEventArgs as CheckinNotification; 


           int changeId = notification.Changeset;; // here I get the Changeset as -1 
         } 
        } 
       } 
      } 

回答

5

您無法獲取當前的變更集編號,因爲在提交變更集之前執行了策略。

它必須這樣做,以便它可以拒絕簽入如果政策被違反。如果簽入被拒絕,它不應增加更改集編號。

+0

感謝您的回覆。 – Jaleel 2012-03-29 15:07:19