Find all locked files in TFS

前端 未结 5 1094
粉色の甜心
粉色の甜心 2021-02-04 03:48

I would like to see all files that are locked. so far, I\'ve only found to use tf.exe status and look for anything with \'!\' because they are not reported as \"lock, edit\" as

5条回答
  •  礼貌的吻别
    2021-02-04 04:18

    from your command prompt

    >powershell
    

    Then from powershell do:

    PS > tf info * -recursive | &{
     begin{
      $out=@{}
      $prefix = "loc"
     }
     process{
      if ($_ -match "Local information"){
       if ($out.Count -gt 0) {
        [pscustomobject]$out
        $out=@{}
        $prefix = "loc"
       }
      } ElseIf ($_ -match "Server information"){
       $prefix = "svr"
      } else {
       $parts = $_.Split(':')
       if ($parts.Length -eq 2){
        $out.Add($prefix + $parts[0].Trim(), $parts[1].Trim())
       }
      }
     }
     end{
      if ($out.Count -gt 0) {
       [pscustomobject]$out
      }
     }
    } | where {!($_.svrLock -eq 'none')}
    

提交回复
热议问题