Due to Microsoft's usual lack of thorough documentation I misunderstood the fromVersion
and toVersion
parameters to mean sourceVersion
and targetVersion
(merging "from" one branch "to" another branch), respectively, though I did wonder what would be the use case would be around having a VersionSpec
in the target branch, since you would always be applying it to the Tip. As it turns out, it seems that the fromVersion
and toVersion
are there to select a subset of changesets, so in the code above, the VersionSpec
spec variable should be used in the toVersion
argument, not a fromVersion
. fromVersion = null
would imply that the merge should go back to the initial changeset in the branch (or the last recorded merge, presumably), whereas toVersion = null
would imply that the merge should use everything up to the Tip/most recent changeset.
Updated code:
VersionSpec spec = VersionSpec.ParseSingleSpec("T", null)
mergeStatus = workspace.Merge(ServerSourcePath, ServerTargetPath, null, spec, LockLevel.None, RecursionType.Full, MergeOptions.None);
//mergeStatus.noActionNeeded returns FALSE
//OK now try another method
spec = VersionSpec.Latest
mergeStatus = workspace.Merge(ServerSourcePath, ServerTargetPath, null, spec, LockLevel.None, RecursionType.Full, MergeOptions.None);
//mergeStatus.noActionNeeded returns FALSE again
//And if I try using null instead of a VersionSpec....
mergeStatus = workspace.Merge(ServerSourcePath, ServerTargetPath, null, null, LockLevel.None, RecursionType.Full, MergeOptions.None);
//mergeStatus.noActionNeeded returns FALSE