Handle error case where no merge info is returned by QueryMerges

This commit is contained in:
Dave Hanna
2014-06-27 11:04:29 -05:00
committed by Philippe Miossec
parent 62d141e2bc
commit c6eadbb477
2 changed files with 11 additions and 0 deletions
+1
View File
@@ -220,6 +220,7 @@ namespace Sep.Git.Tfs.VsCommon
{
var targetVersion = new ChangesetVersionSpec((int)targetChangeset);
var mergeInfo = VersionControl.QueryMerges(null, null, path, targetVersion, targetVersion, targetVersion, RecursionType.Full);
if (mergeInfo.Length == 0) return -1;
return mergeInfo.Max(x => x.SourceVersion);
}
+10
View File
@@ -381,6 +381,16 @@ namespace Sep.Git.Tfs.Core
else if (Repository.GetConfig(GitTfsConstants.IgnoreBranches) != true.ToString())
{
var parentChangesetId = Tfs.FindMergeChangesetParent(TfsRepositoryPath, changeset.Summary.ChangesetId, this);
if (parentChangesetId < 1) // Handle missing merge parent info
{
if (stopOnFailMergeCommit)
{
return false;
}
stdout.WriteLine("warning: this changeset " + changeset.Summary.ChangesetId +
" is a merge changeset. But git-tfs is unable to determine the parent changeset.");
return true;
}
var shaParent = Repository.FindCommitHashByChangesetId(parentChangesetId);
if (shaParent == null)
{