I have two branches, Apple
and Banana
. Out of all the unmerged changesets in Apple
, I only want to merge those that contain the term MergeToBanana
in their check-in comments.
So far this is what I have in my PowerShell script:
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
}
}
Given my example, ChangesetComment
will be set to MergeToBanana
when I run the script.
I would like to modify my tf history
command so that it only yields information about changesets in Apple
that are not yet merged into Banana
, so that I don't have to search through the entire history for changesets that contain ChangesetComment
in their check-in comments. How can I do so?
Any other advice on how to improve my script is also welcome.