简体   繁体   中英

Use tf.exe to create a new label from an existing label

In Visual Studio it is possible to create a new source control label from the files associated with an existing label.

How would I do that in a Powershell script, using tf.exe ?

This is possible with the /version parameter on the tf.exe label command.

Documentation explains that the /version parameter should be formatted as L followed by the label name:

# Create an alias to tf.exe
Set-Alias tf "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe"

$labelName = "New label"
$labelComment = "Comment on new label"
$previousLabelName = "Nightly Build"
$sourceFolder = "C:\Folder\Containing Source\"

tf label $labelName $sourceFolder /comment:$labelComment /version:L$previousLabelName /recursive /child:Replace

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM