Skip to content

Commit

Permalink
Merge pull request git-tfs#291 from AlexeyRaga/master
Browse files Browse the repository at this point in the history
Branching point corrected (git-tfs#284)
  • Loading branch information
spraints committed Jan 24, 2013
2 parents 3f244ec + 942137d commit 72f07f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 6 additions & 4 deletions GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ public override int GetRootChangesetForBranch(string tfsPathBranchToCreate, stri
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();

Expand Down
5 changes: 4 additions & 1 deletion GitTfs/Core/TfsInterop/IBranch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public static BranchTree GetRootTfsBranchForRemotePath(this ITfsHelper tfs, stri
{
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);
Expand Down

0 comments on commit 72f07f0

Please sign in to comment.