static void ExtractMetaToCache( List <ChangeInfo> changes, Dictionary <string, ChangeInfo> cache) { HashSet <string> indexedKeys = BuildIndexedKeys(changes); for (int i = changes.Count - 1; i >= 0; i--) { ChangeInfo currentChange = changes[i]; if (!MetaPath.IsMetaPath(currentChange.Path)) { continue; } string realPath = MetaPath.GetPathFromMetaPath(currentChange.Path); if (!indexedKeys.Contains(BuildKey.BuildCacheKey( currentChange.ChangeTypes, realPath))) { continue; } // found foo.c and foo.c.meta // with the same chage types - move .meta to cache cache.Add(BuildKey.ForChange(currentChange), currentChange); changes.RemoveAt(i); } }
static void ExtractMetaToCache( MergeChangesCategory category, Dictionary <string, MergeChangeInfo> cache) { List <MergeChangeInfo> changes = category.GetChanges(); HashSet <string> indexedKeys = BuildIndexedKeys( changes); for (int i = changes.Count - 1; i >= 0; i--) { MergeChangeInfo currentChange = changes[i]; string path = currentChange.GetPath(); if (!MetaPath.IsMetaPath(path)) { continue; } string realPath = MetaPath.GetPathFromMetaPath(path); if (!indexedKeys.Contains(BuildKey.BuildCacheKey( currentChange.CategoryType, realPath))) { continue; } // found foo.c and foo.c.meta - move .meta to cache cache.Add(BuildKey.ForChange(currentChange), currentChange); changes.RemoveAt(i); } }
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); } }