예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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)));
        }