2012-03-27 8 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

関連する問題