Skip to content
Snippets Groups Projects
Commit 48267446 authored by Stanley Goldman's avatar Stanley Goldman
Browse files

Using the repository path when requesting a lock

parent 20d95b45
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,10 @@ namespace GitHub.Unity ...@@ -61,7 +61,10 @@ namespace GitHub.Unity
{ {
isBusy = true; isBusy = true;
var selected = Selection.activeObject; var selected = Selection.activeObject;
var path = AssetDatabase.GetAssetPath(selected.GetInstanceID());
var assetPath = AssetDatabase.GetAssetPath(selected.GetInstanceID());
var repositoryPath = EntryPoint.Environment.GetRepositoryPath(assetPath);
repository.RequestLock(new MainThreadTaskResultDispatcher<string>(s => { repository.RequestLock(new MainThreadTaskResultDispatcher<string>(s => {
isBusy = false; isBusy = false;
GUI.FocusControl(null); GUI.FocusControl(null);
...@@ -71,7 +74,7 @@ namespace GitHub.Unity ...@@ -71,7 +74,7 @@ namespace GitHub.Unity
isBusy = false; isBusy = false;
GUI.FocusControl(null); GUI.FocusControl(null);
EditorApplication.RepaintProjectWindow(); EditorApplication.RepaintProjectWindow();
}), path); }), repositoryPath);
} }
[MenuItem("Assets/Release lock", true, 1000)] [MenuItem("Assets/Release lock", true, 1000)]
...@@ -87,8 +90,11 @@ namespace GitHub.Unity ...@@ -87,8 +90,11 @@ namespace GitHub.Unity
return false; return false;
if (locks == null || locks.Count == 0) if (locks == null || locks.Count == 0)
return false; return false;
NPath path = AssetDatabase.GetAssetPath(selected.GetInstanceID());
var isLocked = locks.Any(x => x.Path == path); var assetPath = AssetDatabase.GetAssetPath(selected.GetInstanceID());
var repositoryPath = EntryPoint.Environment.GetRepositoryPath(assetPath);
var isLocked = locks.Any(x => x.Path == repositoryPath);
return isLocked; return isLocked;
} }
...@@ -97,14 +103,17 @@ namespace GitHub.Unity ...@@ -97,14 +103,17 @@ namespace GitHub.Unity
{ {
isBusy = true; isBusy = true;
var selected = Selection.activeObject; var selected = Selection.activeObject;
var path = AssetDatabase.GetAssetPath(selected.GetInstanceID());
var assetPath = AssetDatabase.GetAssetPath(selected.GetInstanceID());
var repositoryPath = EntryPoint.Environment.GetRepositoryPath(assetPath);
repository.ReleaseLock(new MainThreadTaskResultDispatcher<string>(s => repository.ReleaseLock(new MainThreadTaskResultDispatcher<string>(s =>
{ {
isBusy = false; isBusy = false;
GUI.FocusControl(null); GUI.FocusControl(null);
EditorApplication.RepaintProjectWindow(); EditorApplication.RepaintProjectWindow();
}, },
() => isBusy = false), path, false); () => isBusy = false), repositoryPath, false);
} }
public static void Run() public static void Run()
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment