예제 #1
0
            HashSet <string> BuildIndexedKeys(List <ClientDiffInfo> diffs)
            {
                HashSet <string> result = new HashSet <string>();

                foreach (ClientDiffInfo diff in diffs)
                {
                    if (MetaPath.IsMetaPath(diff.DiffWithMount.Difference.Path))
                    {
                        continue;
                    }

                    result.Add(BuildKey.ForDiff(diff));
                }

                return(result);
            }
예제 #2
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);
                }
            }