Explaining tf diff

三世轮回 提交于 2019-12-02 21:14:09

You're just not using the correct syntax when calling it. In this case, it tried to do a diff between your working copy, and the base repository version, of (non-existing) files 14318 and 14317.

What you need to do instead is to use a changeset range in /version, like this:

tf diff $/Foo /version:C14317~C14318 /recursive /format:unified > foo.diff

Note that you can use ~ with any other version specs - labels, dates etc. See here for details.

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 $/<serverName>/<RepoDir>

# 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
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!