Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 修改";tf历史“;命令只生成未合并的变更集_Powershell_Command Line_Tfs - Fatal编程技术网

Powershell 修改";tf历史“;命令只生成未合并的变更集

Powershell 修改";tf历史“;命令只生成未合并的变更集,powershell,command-line,tfs,Powershell,Command Line,Tfs,我有两个分支,Apple和Banana。在Apple中所有未合并的变更集中,我只想合并那些在签入注释中包含术语mergetobana的变更集 到目前为止,这是我在PowerShell脚本中的内容: Param ( [Parameter(Mandatory=$true)] [String]$ChangesetComment ) $tf = get-item "c:\program files (x86)\Microsoft Visual S

我有两个分支,
Apple
Banana
。在
Apple
中所有未合并的变更集中,我只想合并那些在签入注释中包含术语
mergetobana
的变更集

到目前为止,这是我在PowerShell脚本中的内容:

Param (       
       [Parameter(Mandatory=$true)]
       [String]$ChangesetComment
       )

$tf = get-item "c:\program files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\TF.EXE"

if ($ChangesetComment) {
    echo "*** Looking for all changesets containing '$ChangesetComment' in their check-in comments. This might take a while. ***"
    $changesetsToMerge = & $tf history $/TeamProject/Server/Apple /noprompt /recursive | findstr $ChangesetComment  
    $changesetNumbers = $changesetsToMerge | % $_.changesetnumber

    echo "*** Now merging filtered changesets. ***"
    Foreach ($c in $changesetNumbers) {
        & $tf merge /version $_.c $/IMSDev/Closed/$ScdVersion . /r /noprompt    
    }
}
在我的示例中,运行脚本时,
changesetcoment
将设置为
mergetobana

我想修改我的
tf history
命令,以便它只生成
Apple
中尚未合并到
Banana
中的变更集信息,这样我就不必在整个历史记录中搜索签入注释中包含
changesetcoment
的变更集。我怎样才能做到


关于如何改进我的脚本的任何其他建议也是受欢迎的。

您可以尝试在中使用
/candidate
选项,而不是使用tf history命令

tf合并/候选源分支目标分支

例如:

tf合并/候选苹果香蕉

更多详细方法请参考此问题的答案: