Beispiel #1
0
        static void AddClientDiffs(
            TreeViewItem parentItem,
            ITreeViewNode parentNode,
            List <TreeViewItem> rows,
            TreeViewItemIds <IDiffCategory, ITreeViewNode> treeViewItemIds)
        {
            for (int i = 0; i < parentNode.GetChildrenCount(); i++)
            {
                ITreeViewNode child = parentNode.GetChild(i);

                int nodeId;
                if (!treeViewItemIds.TryGetInfoItemId(child, out nodeId))
                {
                    nodeId = treeViewItemIds.AddInfoItem(child);
                }

                TreeViewItem changeTreeViewItem =
                    new ClientDiffTreeViewItem(
                        nodeId,
                        parentItem.depth + 1,
                        (ClientDiffInfo)child);

                parentItem.AddChild(changeTreeViewItem);
                rows.Add(changeTreeViewItem);
            }
        }
            static ClientDiffInfo FindClientDiffOfType(
                string path,
                ChangeCategoryType type,
                ITreeViewNode node)
            {
                if (node is ClientDiffInfo)
                {
                    ClientDiffInfo clientDiffInfo = (ClientDiffInfo)node;
                    ChangeCategory category       = (ChangeCategory)node.GetParent();

                    if (category.Type == type &&
                        clientDiffInfo.DiffWithMount.Difference.Path == path)
                    {
                        return((ClientDiffInfo)node);
                    }
                }

                for (int i = 0; i < node.GetChildrenCount(); i++)
                {
                    ClientDiffInfo result = FindClientDiffOfType(path, type, node.GetChild(i));
                    if (result != null)
                    {
                        return(result);
                    }
                }

                return(null);
            }
Beispiel #3
0
        static void AddClientDiffInfos(ITreeViewNode node, List <ClientDiffInfo> result)
        {
            if (node is ClientDiffInfo)
            {
                result.Add((ClientDiffInfo)node);
                return;
            }

            for (int i = 0; i < node.GetChildrenCount(); i++)
            {
                AddClientDiffInfos(node.GetChild(i), result);
            }
        }
Beispiel #4
0
            static void ExtractToMetaCache(
                ITreeViewNode node,
                int nodeIndex,
                Dictionary <string, ClientDiffInfo> cache,
                HashSet <string> indexedKeys)
            {
                if (node is ClientDiffInfo)
                {
                    ClientDiffInfo diff = (ClientDiffInfo)node;

                    string path = diff.DiffWithMount.Difference.Path;

                    if (!MetaPath.IsMetaPath(path))
                    {
                        return;
                    }

                    string realPath = MetaPath.GetPathFromMetaPath(path);

                    if (!indexedKeys.Contains(BuildKey.BuildCacheKey(
                                                  BuildKey.GetMergeCategory(diff),
                                                  BuildKey.GetChangeCategory(diff),
                                                  realPath)))
                    {
                        return;
                    }

                    // found foo.c and foo.c.meta
                    // with the same chage types - move .meta to cache
                    cache.Add(BuildKey.ForDiff(diff), diff);
                    ((ChangeCategory)node.GetParent()).RemoveDiffAt(nodeIndex);
                }

                for (int i = node.GetChildrenCount() - 1; i >= 0; i--)
                {
                    ExtractToMetaCache(
                        node.GetChild(i),
                        i,
                        cache,
                        indexedKeys);
                }
            }