From 14de51d73859b15f0fd4f6f4c7bd17122b29481e Mon Sep 17 00:00:00 2001 From: Alexey Raga Date: Mon, 14 Jan 2013 09:55:44 +1100 Subject: [PATCH 1/4] Ordering the changesets by ID to correct the branching point (#284) --- GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs b/GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs index 1c9b74d79..f1afdfd3e 100644 --- a/GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs +++ b/GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs @@ -57,12 +57,14 @@ public override int GetRootChangesetForBranch(string tfsPathBranchToCreate, stri if (firstChangesetInBranchToCreate == null) { throw new GitTfsException("An unexpected error occured when trying to find the root changeset.\nFailed to find first changeset for " + tfsPathBranchToCreate); - } - - var mergedItemsToFirstChangesetInBranchToCreate = - VersionControl.TrackMerges(new int[] {firstChangesetInBranchToCreate.ChangesetId}, - new ItemIdentifier(tfsPathBranchToCreate), - new ItemIdentifier[] {new ItemIdentifier(tfsPathParentBranch),}, null); + } + + var mergedItemsToFirstChangesetInBranchToCreate = VersionControl + .TrackMerges(new int[] {firstChangesetInBranchToCreate.ChangesetId}, + new ItemIdentifier(tfsPathBranchToCreate), + new ItemIdentifier[] {new ItemIdentifier(tfsPathParentBranch),}, + null) + .OrderBy(x => x.SourceChangeset.ChangesetId); var lastChangesetsMergeFromParentBranch = mergedItemsToFirstChangesetInBranchToCreate.LastOrDefault(); From d17f956550c843af940e47361402afda4511854c Mon Sep 17 00:00:00 2001 From: Alexey Raga Date: Mon, 14 Jan 2013 10:00:28 +1100 Subject: [PATCH 2/4] Fixing a "missing parent" issue --- GitTfs/Core/TfsInterop/IBranch.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/GitTfs/Core/TfsInterop/IBranch.cs b/GitTfs/Core/TfsInterop/IBranch.cs index e7f0a2230..9a1334f48 100644 --- a/GitTfs/Core/TfsInterop/IBranch.cs +++ b/GitTfs/Core/TfsInterop/IBranch.cs @@ -55,8 +55,11 @@ public static BranchTree GetRootTfsBranchForRemotePath(this ITfsHelper tfs, stri foreach(var branch in branchTrees.Values) { if(!branch.IsRoot) - { - branchTrees[branch.ParentPath].ChildBranches.Add(branch); + { + //in some strange cases there might be a branch which is not marked as IsRoot + //but the parent for this branch is missing. + if (branchTrees.ContainsKey(branch.ParentPath)) + branchTrees[branch.ParentPath].ChildBranches.Add(branch); } } var roots = branchTrees.Values.Where(b => b.IsRoot); From 65cbe46846e65141f3b3eb830588f02925e61fa0 Mon Sep 17 00:00:00 2001 From: Alexey Raga Date: Mon, 14 Jan 2013 13:54:47 +1100 Subject: [PATCH 3/4] Indentation corrected --- GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs b/GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs index f1afdfd3e..f3b3155e7 100644 --- a/GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs +++ b/GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs @@ -57,14 +57,14 @@ public override int GetRootChangesetForBranch(string tfsPathBranchToCreate, stri if (firstChangesetInBranchToCreate == null) { throw new GitTfsException("An unexpected error occured when trying to find the root changeset.\nFailed to find first changeset for " + tfsPathBranchToCreate); - } - - var mergedItemsToFirstChangesetInBranchToCreate = VersionControl - .TrackMerges(new int[] {firstChangesetInBranchToCreate.ChangesetId}, - new ItemIdentifier(tfsPathBranchToCreate), - new ItemIdentifier[] {new ItemIdentifier(tfsPathParentBranch),}, - null) - .OrderBy(x => x.SourceChangeset.ChangesetId); + } + + var mergedItemsToFirstChangesetInBranchToCreate = VersionControl + .TrackMerges(new int[] {firstChangesetInBranchToCreate.ChangesetId}, + new ItemIdentifier(tfsPathBranchToCreate), + new ItemIdentifier[] {new ItemIdentifier(tfsPathParentBranch),}, + null) + .OrderBy(x => x.SourceChangeset.ChangesetId); var lastChangesetsMergeFromParentBranch = mergedItemsToFirstChangesetInBranchToCreate.LastOrDefault(); From 942137d01397d8c1498943c0c2db2a0a2abd2bba Mon Sep 17 00:00:00 2001 From: Alexey Raga Date: Mon, 14 Jan 2013 16:05:01 +1100 Subject: [PATCH 4/4] Correcting indentation in IBranch.cs --- GitTfs/Core/TfsInterop/IBranch.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/GitTfs/Core/TfsInterop/IBranch.cs b/GitTfs/Core/TfsInterop/IBranch.cs index 9a1334f48..df1501fea 100644 --- a/GitTfs/Core/TfsInterop/IBranch.cs +++ b/GitTfs/Core/TfsInterop/IBranch.cs @@ -55,11 +55,11 @@ public static BranchTree GetRootTfsBranchForRemotePath(this ITfsHelper tfs, stri foreach(var branch in branchTrees.Values) { if(!branch.IsRoot) - { - //in some strange cases there might be a branch which is not marked as IsRoot - //but the parent for this branch is missing. - if (branchTrees.ContainsKey(branch.ParentPath)) - branchTrees[branch.ParentPath].ChildBranches.Add(branch); + { + //in some strange cases there might be a branch which is not marked as IsRoot + //but the parent for this branch is missing. + if (branchTrees.ContainsKey(branch.ParentPath)) + branchTrees[branch.ParentPath].ChildBranches.Add(branch); } } var roots = branchTrees.Values.Where(b => b.IsRoot);