Skip to content

Instantly share code, notes, and snippets.

@jrotello
Last active August 29, 2015 14:15
Show Gist options
  • Save jrotello/4f4106cc50a267db5072 to your computer and use it in GitHub Desktop.
Save jrotello/4f4106cc50a267db5072 to your computer and use it in GitHub Desktop.
Gets a list of all changesets from $Source branch that have not been merged into $Destination branch.
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client") | Out-Null
<#
.Synopsis
Gets a list of all changesets from $Source that have not been merged into $Destination.
.DESCRIPTION
Gets a list of all changesets from $Source that have not been merged into $Destination.
.EXAMPLE
$tfs = Get-TfsServer http://<hostname>:8080/tfs
Get-MergeCandidates -Server $tfs -Source "$/Some/Source/Branch" -Destination "$/Some/Destinsation/Branch"
The Get-TfsServer cmdlet is included as part of the PowerShell snapin provided by the TFS Power Tools
extension for Visual Studio. If everything is installed correctly, you should be able to load the snapin
with the following command:
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
#>
function Get-TfsMergeCandidates {
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true)]
[Microsoft.TeamFoundation.Client.TfsTeamProjectCollection]
$Server,
[Parameter(Mandatory = $true)]
[string]
$Source,
[Parameter(Mandatory = $true)]
[string]
$Destination
)
$service = $Server.GetService([Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer])
$candidates = $service.GetMergeCandidates(
$Source,
$Destination,
[Microsoft.TeamFoundation.VersionControl.Client.RecursionType]::Full
)
$candidates | select -ExpandProperty changeset
}
@Mozketo
Copy link

Mozketo commented Feb 19, 2015

Awesome work. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment