We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

VersionControlServer.QueryMerges Method

Gets information for all the passed merges in a specified branch, or between two specified branches. This function does not let you get information about deleted files or folders. If you want information about deleted files or folders, you can use the overload method that takes ItemSpec objects instead of strings. This function also does not give you details on which files within each changeset were merged or not merged. If you want information about the merged files you can use the QueryMergesWithDetails method.

Namespace:  Microsoft.TeamFoundation.VersionControl.Client
Assembly:  Microsoft.TeamFoundation.VersionControl.Client (in Microsoft.TeamFoundation.VersionControl.Client.dll)

public ChangesetMerge[] QueryMerges(
	string sourcePath,
	VersionSpec sourceVersion,
	string targetPath,
	VersionSpec targetVersion,
	VersionSpec versionFrom,
	VersionSpec versionTo,
	RecursionType recursion
)

Parameters

sourcePath
Type: System.String

If sourcePath is null, you will get all merges that have occurred on the targetPath. If sourcePath is not null, you will get all merges that have occurred between these two branches.

sourceVersion
Type: Microsoft.TeamFoundation.VersionControl.Client.VersionSpec

If you specify a sourcePath, use sourceVersion to specify its version. Use VersionSpec.Latest to specify the current version. This parameter is used to specify what the target item is actually, not to filter the results of the query, which accomplished by versionFrom and versionTo.

targetPath
Type: System.String

The item that you want to find all merges for. This value must not be null. Both this and the source path may represent Team Foundation Server paths ($/CmdLine/parse.cs) or local paths (C:\Code\CmdLine\parse.cs) If local paths are used, they are mapped to server paths using a workspace; however, if two local paths are in different workspaces, an exception occurs.

targetVersion
Type: Microsoft.TeamFoundation.VersionControl.Client.VersionSpec

The version of the required target spec. Use VersionSpec.Latest to specify the current version. This parameter is used to specify what the target item is actually , not to filter the results of the query, which is accomplished by versionFrom and versionTo.

versionFrom
Type: Microsoft.TeamFoundation.VersionControl.Client.VersionSpec

Gets only merges that start from this version of the target.

Pass null to start with the very first merge. This version spec must be specified in date, latest, or changeset form.

versionTo
Type: Microsoft.TeamFoundation.VersionControl.Client.VersionSpec

Gets only merges up to a point that you specify. Pass null to end with the most recent merge. This version spec must be specified in date, latest, or changeset form.

recursion
Type: Microsoft.TeamFoundation.VersionControl.Client.RecursionType

The recursion parameter controls what occurs if the path is a folder.

RecursionType.None designates the folder itself. (This is rarely used, as there are not many changes you can make on a folder itself.) RecursionType.OneLevel designates the files and folders directly inside that folder; RecursionType.Full designates all files and folders in the tree under that folder.

Return Value

Type: Microsoft.TeamFoundation.VersionControl.Client.ChangesetMerge[]
Returns an array of ChangesetMerge objects that describes the completed merges. Each merge is a particular changeset from the source branch that was merged into the target branch. The object gives the changeset ID of the change in the original source branch, the changeset ID of the change in the target branch that was created by the merge, and a Boolean variable that indicates if this merge was only partial (the complete changeset was not merged into the target branch).

Show: