Undo Checkout Activity if Build Failed

Feb 11, 2014 at 1:14 PM
I have checkout activity which checkouts all AssemblyInfo.cs as below, and later on I'm increasing the AssemblyInfo version number. Now somehow if build get failed due to some existing code issue than I should perform undo checkout instead of checkin.

Could someone help to provide solution on how to undo checkout. Below is my Checkin activity:

Workspace workspace = context.GetValue(this.Workspace);
        var pendingChanges = workspace.GetPendingChanges();
        WorkspaceCheckInParameters wcip = new WorkspaceCheckInParameters(pendingChanges, "Build. ***NO_CI***");
        wcip.Author = @"domain\user";
        wcip.OverrideGatedCheckIn = true;