Explaining tf diff

后端 未结 2 1686
孤街浪徒
孤街浪徒 2021-02-02 03:38

Using Visual Studio 2008 tools,

I am trying to get an ASCII diff of change sets 14318 and 14317.

I can do so using GUI:

tf changeset 14318
         


        
2条回答
  •  粉色の甜心
    2021-02-02 03:57

    Here is a PowerShell (V2) script, extending from Pavel's answer, this will be more performant, because we find the files that have changed, then get tf to diff them individually:

    Write-Host "Checking if TFS snap-in has been added..." -ForegroundColor green
    
    # Find all TFS snapins.
    $snapins = Get-PSSnapin -Registered | Where-Object { $_.Name -like "*TeamFoundation*" } 
    
    foreach($snapin in $snapins)
    { 
        # Add snapin if not already added.
        $exists = Get-PSSnapin | Where-Object { $_.Name -eq $snapin.Name } 
        if (!$exists)
        {
            Write-Host "Adding Snapin " $snapin.Name -ForegroundColor green 
            Add-PSSnapin $snapin.Name 
        }
        else
        {
            Write-Host "Snapin already added." -ForegroundColor green
        }
    }
    
    
    
    # Get TFS Server object reference.
    $tfs_server = Get-TfsServer -Name $//
    
    # Get list of changed files 
    $changes_from_changeset = Get-TfsChangeset -ChangesetNumber 829 | Select -Expand Changes | % { $_.Item.ServerItem }
    #$changes_from_changeset
    
    foreach($change in $changes_from_changeset)
    {
        &"C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe" diff $change /version:829~T /format:unified
    }
    

提交回复
热议问题