Exemple #1
0
            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);
                }
            }
Exemple #2
0
        static bool IsOpenForEdit(string assetPath, out string message)
        {
            message = string.Empty;

            if (!IsEnabled)
            {
                return(true);
            }

            if (assetPath.StartsWith("ProjectSettings/"))
            {
                return(true);
            }

            if (ForceCheckout)
            {
                return(true);
            }

            if (MetaPath.IsMetaPath(assetPath))
            {
                assetPath = MetaPath.GetPathFromMetaPath(assetPath);
            }

            AssetStatus status = mAssetStatusCache.GetStatusForPath(
                Path.GetFullPath(assetPath));

            if (ClassifyAssetStatus.IsAdded(status) ||
                ClassifyAssetStatus.IsCheckedOut(status))
            {
                return(true);
            }

            return(!ClassifyAssetStatus.IsControlled(status));
        }
            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);
                }
            }
Exemple #4
0
            internal void Build(List <string> paths)
            {
                HashSet <string> indexedKeys = BuildIndexedKeys(paths);

                for (int i = paths.Count - 1; i >= 0; i--)
                {
                    string currentPath = paths[i];

                    if (!MetaPath.IsMetaPath(currentPath))
                    {
                        continue;
                    }

                    string realPath = MetaPath.GetPathFromMetaPath(currentPath);

                    if (!indexedKeys.Contains(realPath))
                    {
                        continue;
                    }

                    // found foo.c and foo.c.meta
                    // with the same chage types - move .meta to cache
                    mCache.Add(currentPath);
                    paths.RemoveAt(i);
                }
            }
Exemple #5
0
        internal static UnityEngine.Object FromChangeInfo(ChangeInfo changeInfo)
        {
            string changeFullPath = changeInfo.GetFullPath();

            if (MetaPath.IsMetaPath(changeFullPath))
            {
                changeFullPath = MetaPath.GetPathFromMetaPath(changeFullPath);
            }

            return(FromFullPath(changeFullPath));
        }
Exemple #6
0
        static AssetStatus GetAssetStatus(Asset asset, IAssetStatusCache assetStatusCache)
        {
            string assetPath = Path.GetFullPath(asset.assetPath);

            if (MetaPath.IsMetaPath(assetPath))
            {
                assetPath = MetaPath.GetPathFromMetaPath(assetPath);
            }

            return(assetStatusCache.GetStatusForPath(assetPath));
        }
Exemple #7
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);
                }
            }