コード例 #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);
                }
            }
コード例 #2
0
        static GUIStyle GetCategoryStyle(
            MergeChangesCategory category,
            int solvedChildrenCount,
            bool isSelected)
        {
            if (isSelected)
            {
                return(UnityStyles.Tree.Label);
            }

            if (category.CategoryType == MergeChangesCategory.Type.FileConflicts ||
                category.CategoryType == MergeChangesCategory.Type.DirectoryConflicts)
            {
                return(category.GetChildrenCount() > solvedChildrenCount ?
                       UnityStyles.Tree.RedLabel : UnityStyles.Tree.GreenLabel);
            }

            return(UnityStyles.Tree.Label);
        }
コード例 #3
0
        static int GetSolvedChildrenCount(
            MergeChangesCategory category,
            MergeSolvedFileConflicts solvedFileConflicts)
        {
            int solvedDirConflicts = 0;

            if (category.CategoryType == MergeChangesCategory.Type.DirectoryConflicts)
            {
                foreach (MergeChangeInfo change in category.GetChanges())
                {
                    if (change.DirectoryConflict.IsResolved())
                    {
                        solvedDirConflicts++;
                    }
                }

                return(solvedDirConflicts);
            }

            return((solvedFileConflicts == null) ? 0 :
                   solvedFileConflicts.GetCount());
        }
コード例 #4
0
 internal ChangeCategoryTreeViewItem(int id, MergeChangesCategory category)
     : base(id, 0, category.CategoryType.ToString())
 {
     Category = category;
 }