Udostępnij za pośrednictwem


Monad version of "find changesets with overrides"

I already made the C# version but since I had made the Team Foundation Version Control provider for Monad last weekend (hopefully it can be a powertoy soon), I wanted to make a Monad version of this - one of the primary reasons is flexibility - once you have a script that just filters it down to the Changeset objects for you, you can do what you want - spit it out to excel, xml, a table, a list, whatever.

As with all Monad scripts I've seen so far, it's scary easy.

function find_overrides($server, $path)
{
    $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($server);
    $vcs = $tfs.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer]);

    $vcs.QueryHistory($path,
                      [Microsoft.TeamFoundation.VersionControl.Client.VersionSpec]::Latest,
                      0,
                      [Microsoft.TeamFoundation.VersionControl.Client.RecursionType]::Full,
                      $null,
                      $null,
                      $null,
                      [int]::MaxValue,
                      $false,
                      $false) | where-object { $_.PolicyOverride.PolicyFailures.Length -gt 0 }
}

Now with this function I can do something like (wither either local or server path) "find_overrides tkbgitvstsat01 D:\task1\vset\SCM\SourceControl\CommandLine" and get an actual stream of Changeset objects (in this case, the same one mentioned in the C#-version post).  Then I have more freedom than the C# app afforded me - I can count them, display them, whatever - the default of just showing them formatted is pretty nice too :)

ArtifactUri          : vstfs:///VersionControl/Changeset/7662
[snip]
Comment              : vstf rtm branch: vset directory
[snip]
PolicyOverride       : PolicyOverrideInfo instance 30360532
                         Comment: new branch
                         PolicyFailures: [2]PolicyFailureInfo instance 46367007
                         PolicyName: [Invalid Policy]
                         Message: Internal error in Dogfood Policy
                       , PolicyFailureInfo instance 50041622
                         PolicyName: Work Items
                         Message: You must associate this check-in with one or
                       more work items.
Committer            : REDMOND\jeffbe
CreationDate         : 8/10/2005 1:25:42 AM
ChangesetId          : 7662
Owner                : REDMOND\jeffbe

Comments

  • Anonymous
    April 07, 2006
    While it's rough and I'm sure could use some work, the TFVC provider I mentioned back in November is...