/// <summary>Gets the hierarchical branch tree from the specified list of <paramref name="branches"/>.</summary>
            public 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

                Dictionary <string, BaseBranchNode> nodes = new Dictionary <string, BaseBranchNode>();
                var branchFullPaths = new List <string>();
                foreach (string branch in branches)
                {
                    BranchNode     branchNode = new BranchNode(this, branch);
                    BaseBranchNode parent     = branchNode.CreateRootNode(nodes,
                                                                          (tree, parentPath) => new BranchPathNode(tree, parentPath));
                    if (parent != null)
                    {
                        Nodes.AddNode(parent);
                    }
                    branchFullPaths.Add(branchNode.FullPath);
                }

                FireBranchAddedEvent(branchFullPaths);
            }
예제 #2
0
            /// <summary>Gets the hierarchical branch tree from the specified list of <paramref name="branches"/>.</summary>
            public 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

                Dictionary<string, BaseBranchNode> nodes = new Dictionary<string, BaseBranchNode>();
                foreach (string branch in branches)
                {
                    BranchNode branchNode = new BranchNode(this, branch);
                    BaseBranchNode parent = branchNode.CreateRootNode(nodes);
                    if (parent != null)
                        Nodes.AddNode(parent);
                }
            }