private static bool IsObjectUnlocked(Object selected) { if (selected == null) { return(false); } SPath assetPath = AssetDatabase.GetAssetPath(selected.GetInstanceID()).ToSPath(); SPath repositoryPath = assetPath.RelativeToRepository(manager.Environment); var alreadyLocked = locks.Any(x => repositoryPath == x.Path); if (alreadyLocked) { return(false); } GitFileStatus status = GitFileStatus.None; if (entries != null) { status = entries.FirstOrDefault(x => repositoryPath == x.Path.ToSPath()).Status; } return(status != GitFileStatus.Untracked && status != GitFileStatus.Ignored); }
private static ITask CreateLockObjectTask(Object selected) { SPath assetPath = AssetDatabase.GetAssetPath(selected.GetInstanceID()).ToSPath(); SPath repositoryPath = assetPath.RelativeToRepository(manager.Environment); var task = Repository.RequestLock(repositoryPath); //task.OnEnd += (_, s, ___) => { if (s) manager.TaskManager.Run(manager.UsageTracker.IncrementUnityProjectViewContextLfsLock, null); }; return(task); }
private static bool IsObjectLocked(Object selected, bool isLockedByCurrentUser) { if (selected == null) { return(false); } SPath assetPath = AssetDatabase.GetAssetPath(selected.GetInstanceID()).ToSPath(); SPath repositoryPath = assetPath.RelativeToRepository(manager.Environment); return(locks.Any(x => repositoryPath == x.Path && (!isLockedByCurrentUser || x.Owner.Name == currentUsername))); }