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 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)); }
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); } }
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); } }
internal static UnityEngine.Object FromChangeInfo(ChangeInfo changeInfo) { string changeFullPath = changeInfo.GetFullPath(); if (MetaPath.IsMetaPath(changeFullPath)) { changeFullPath = MetaPath.GetPathFromMetaPath(changeFullPath); } return(FromFullPath(changeFullPath)); }
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)); }
static HashSet<string> BuildIndexedKeys(List<string> paths) { HashSet<string> result = new HashSet<string>(); foreach (string path in paths) { if (MetaPath.IsMetaPath(path)) continue; result.Add(path); } return result; }
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); }
void DoFileList( WorkspaceInfo wkInfo, List <string> paths, IAssetStatusCache assetStatusCache, MetaCache metaCache) { mFileListScrollPosition = GUILayout.BeginScrollView( mFileListScrollPosition, EditorStyles.helpBox, GUILayout.ExpandHeight(true)); foreach (string path in paths) { if (MetaPath.IsMetaPath(path)) { continue; } Texture fileIcon = Directory.Exists(path) ? Images.GetDirectoryIcon() : Images.GetFileIcon(path); string label = WorkspacePath.GetWorkspaceRelativePath( wkInfo.ClientPath, path); if (metaCache.HasMeta(path)) { label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL); } GUIContent content = new GUIContent( label, fileIcon); GUILayout.Label( content, GUILayout.Height(UnityConstants.TREEVIEW_ROW_HEIGHT)); Rect iconRect = GUILayoutUtility.GetLastRect(); DoStatusOverlays( iconRect, assetStatusCache, path); } GUILayout.EndScrollView(); }
static HashSet <string> BuildIndexedKeys( List <MergeChangeInfo> changes) { HashSet <string> result = new HashSet <string>(); foreach (MergeChangeInfo change in changes) { if (MetaPath.IsMetaPath(change.GetPath())) { continue; } result.Add(BuildKey.ForChange(change)); } return(result); }
static HashSet <string> BuildIndexedPathsForChanges( List <IncomingChangeInfo> changes) { HashSet <string> result = new HashSet <string>(); foreach (IncomingChangeInfo change in changes) { if (MetaPath.IsMetaPath(change.GetPath())) { continue; } result.Add(change.GetPath()); } return(result); }
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); } }
internal static List<string> GetSelectedMetaPaths( PendingChangesTreeView treeView) { List<ChangeInfo> selectedChanges = PendingChangesSelection .GetSelectedChanges(treeView); List<string> result = new List<string>(); foreach (ChangeInfo change in selectedChanges) { string path = change.GetFullPath(); if (!MetaPath.IsMetaPath(path)) continue; result.Add(path); } return result; }
internal static List <string> ForOperation( IAssetSelection assetSelection, IAssetStatusCache assetStatusCache, AssetMenuOperations operation) { List <string> selectedPaths = AssetsSelection.GetSelectedPaths( assetSelection.GetSelectedAssets()); List <string> result = new List <string>(selectedPaths); foreach (string path in selectedPaths) { if (MetaPath.IsMetaPath(path)) { continue; } string metaPath = MetaPath.GetMetaPath(path); if (!File.Exists(metaPath)) { continue; } if (result.Contains(metaPath)) { continue; } if (!IsApplicableForOperation( metaPath, false, operation, assetStatusCache)) { continue; } result.Add(metaPath); } return(result); }
void DoFileList( WorkspaceInfo wkInfo, List <string> paths, IAssetStatusCache assetStatusCache, MetaCache metaCache) { mFileListScrollPosition = GUILayout.BeginScrollView( mFileListScrollPosition, EditorStyles.helpBox, GUILayout.ExpandHeight(true)); foreach (string path in paths) { if (MetaPath.IsMetaPath(path)) { continue; } Texture fileIcon = Directory.Exists(path) ? Images.GetDirectoryIcon() : Images.GetFileIcon(path); string label = WorkspacePath.GetWorkspaceRelativePath( wkInfo.ClientPath, path); if (metaCache.HasMeta(path)) { label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL); } AssetsOverlays.AssetStatus assetStatus = assetStatusCache.GetStatusForPath(path); Rect selectionRect = EditorGUILayout.GetControlRect(); DoListViewItem(selectionRect, fileIcon, label, assetStatus); } GUILayout.EndScrollView(); }