git-tfs/git-tfs — pull request #628 by daveh551 (2014-06-30 12:27:00+00:00)
Title: Fix missing merge parent

This pull request fixes issue #627 (and also #590,of which it is a duplicate).

In some cases (probably involving a badly formed TFS changeset, or a merge changeset in which the merge parent has been deleted), the VersionControl.QueryMerges call in FindMergeChangesetParent can return an empty array. In such cases, the subsequent merginfo.Max(x => x.SourceVersion) call will throw a "Sequence contains no objects" InvalidOperationException.

This patch avoids that error by checking for a zero-length array, and returning -1 to the caller, which then checks for that and handles it with a warning message that git-tfs can't locate the parent.