private Nodes FillBranchTree(IEnumerable <string> branches, CancellationToken token) { #region ex // (input) // a-branch // develop/crazy-branch // develop/features/feat-next // develop/features/feat-next2 // develop/issues/iss444 // develop/wild-branch // issues/iss111 // master // // -> // (output) // 0 a-branch // 0 develop/ // 1 features/ // 2 feat-next // 2 feat-next2 // 1 issues/ // 2 iss444 // 1 wild-branch // 1 wilds/ // 2 card // 0 issues/ // 1 iss111 // 0 master #endregion var nodes = new Nodes(this); var aheadBehindData = _aheadBehindDataProvider?.GetData(); var currentBranch = Module.GetSelectedBranch(); var pathToNode = new Dictionary <string, BaseBranchNode>(); foreach (var branch in branches) { token.ThrowIfCancellationRequested(); var localBranchNode = new LocalBranchNode(this, branch, branch == currentBranch); if (aheadBehindData != null && aheadBehindData.ContainsKey(localBranchNode.FullPath)) { localBranchNode.UpdateAheadBehind(aheadBehindData[localBranchNode.FullPath].ToDisplay()); } var parent = localBranchNode.CreateRootNode(pathToNode, (tree, parentPath) => new BranchPathNode(tree, parentPath)); if (parent != null) { nodes.AddNode(parent); } } return(nodes); }
private void FillBranchTree(IEnumerable <string> branches) { #region ex // (input) // a-branch // develop/crazy-branch // develop/features/feat-next // develop/features/feat-next2 // develop/issues/iss444 // develop/wild-branch // issues/iss111 // master // // -> // (output) // 0 a-branch // 0 develop/ // 1 features/ // 2 feat-next // 2 feat-next2 // 1 issues/ // 2 iss444 // 1 wild-branch // 1 wilds/ // 2 card // 0 issues/ // 1 iss111 // 0 master #endregion ex var nodes = new Dictionary <string, BaseBranchNode>(); var branchFullPaths = new List <string>(); foreach (var branch in branches) { var localBranchNode = new LocalBranchNode(this, branch); var parent = localBranchNode.CreateRootNode(nodes, (tree, parentPath) => new BranchPathNode(tree, parentPath)); if (parent != null) { Nodes.AddNode(parent); } branchFullPaths.Add(localBranchNode.FullPath); } FireBranchAddedEvent(branchFullPaths); }
private void FillBranchTree(IEnumerable <string> branches, CancellationToken token) { #region ex // (input) // a-branch // develop/crazy-branch // develop/features/feat-next // develop/features/feat-next2 // develop/issues/iss444 // develop/wild-branch // issues/iss111 // master // // -> // (output) // 0 a-branch // 0 develop/ // 1 features/ // 2 feat-next // 2 feat-next2 // 1 issues/ // 2 iss444 // 1 wild-branch // 1 wilds/ // 2 card // 0 issues/ // 1 iss111 // 0 master #endregion ex var currentBranch = Module.GetSelectedBranch(); var nodes = new Dictionary <string, BaseBranchNode>(); var branchFullPaths = new List <string>(); foreach (var branch in branches) { token.ThrowIfCancellationRequested(); var localBranchNode = new LocalBranchNode(this, branch, branch == currentBranch); var parent = localBranchNode.CreateRootNode(nodes, (tree, parentPath) => new BranchPathNode(tree, parentPath)); if (parent != null) { Nodes.AddNode(parent); } branchFullPaths.Add(localBranchNode.FullPath); } }