private void BuildOptions(GenericMenu menu, string path, bool initActive) { if (initActive) { menu.AddItem(new GUIContent("Init/Init"), false, () => { gitManager.Repository.Submodules.Init(path, false); gitManager.MarkDirty(true); }); } else { menu.AddDisabledItem(new GUIContent("Init/Init")); } menu.AddItem(new GUIContent("Init/Force"), false, () => { gitManager.Repository.Submodules.Init(path, true); gitManager.MarkDirty(true); }); menu.AddItem(new GUIContent("Update\\Info"), false, () => { var window = UniGitLoader.GetWindow <GitSubModuleOptionsWizard>(true); window.Init(path); }); }
public static void UpdateModule() { var path = Selection.assetGUIDs.Select(AssetDatabase.GUIDToAssetPath).FirstOrDefault(); var window = UniGitLoader.GetWindow <GitSubModuleOptionsWizard>(); window.Init(path); }
public void ShowDiff(string path, [NotNull] Commit oldCommit, [NotNull] Commit newCommit, GitExternalManager externalManager) { if (externalManager.TakeDiff(path, oldCommit, newCommit)) { return; } var window = UniGitLoader.GetWindow <GitDiffInspector>(); window.Init(path, oldCommit, newCommit); }
public void ShowBlameWizard(string path, GitExternalManager externalManager) { if (!string.IsNullOrEmpty(path)) { if (externalManager.TakeBlame(path)) { return; } var blameWizard = UniGitLoader.GetWindow <GitBlameWizard>(true); blameWizard.SetBlamePath(path); } }
public void ShowDiff(string path, GitExternalManager externalManager) { if (string.IsNullOrEmpty(path) || Repository == null) { return; } if (externalManager.TakeDiff(path)) { return; } var window = UniGitLoader.GetWindow <GitDiffInspector>(); window.Init(path); }
public void ShowDiffPrev(string path, GitExternalManager externalManager) { if (string.IsNullOrEmpty(path) || Repository == null) { return; } var lastCommit = Repository.Commits.QueryBy(path).Skip(1).FirstOrDefault(); if (lastCommit == null) { return; } if (externalManager.TakeDiff(path, lastCommit.Commit)) { return; } var window = UniGitLoader.GetWindow <GitDiffInspector>(); window.Init(path, lastCommit.Commit); }
private static void OpenGitRemoteToolsWindow() { UniGitLoader.GetWindow <GitRemoteToolsWindow>(); }
private static void OpenGitSettingsWindow() { UniGitLoader.GetWindow <GitSettingsWindow>(); }
private static void OpenGitDiffWindow() { UniGitLoader.GetWindow <GitDiffWindow>(); }
private static void OpenGitHistoryWindow() { UniGitLoader.GetWindow <GitHistoryWindow>(); }
public override void OnGUI(Rect rect) { if (Event.current.type == EventType.MouseMove) { editorWindow.Repaint(); } int stashCount = stashCollection.Count(); EditorGUILayout.BeginHorizontal("IN BigTitle"); if (GUILayout.Button(GitGUI.GetTempContent("Stash Save", gitOverlay.icons.stashIcon.image, "Save changes in working directory to stash."))) { UniGitLoader.GetWindow <GitStashSaveWizard>(true); } EditorGUILayout.EndHorizontal(); GUI.enabled = true; stashScroll = EditorGUILayout.BeginScrollView(stashScroll, GUILayout.ExpandHeight(true)); int stashId = 0; foreach (var stash in stashCollection) { string msg = stash.Message; GUIContent stashContent = GitGUI.GetTempContent(msg); Rect stastRect = GUILayoutUtility.GetRect(stashContent, stashStyle); if (Event.current.type == EventType.Repaint) { stashStyle.Draw(stastRect, stashContent, stastRect.Contains(Event.current.mousePosition) || stashId == selectedStash, false, false, false); } else if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && stastRect.Contains(Event.current.mousePosition)) { selectedStash = stashId; } stashId++; } GUILayout.FlexibleSpace(); EditorGUILayout.EndScrollView(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal("ProjectBrowserBottomBarBg"); GUI.enabled = stashCount > 0; if (GUILayout.Button(GitGUI.GetTempContent("Apply", "Apply stash to working directory."), EditorStyles.miniButtonLeft)) { if (EditorUtility.DisplayDialog("Apply Stash: " + selectedStash, "Are you sure you want to apply stash ? This will override your current working directory!", "Apply", "Cancel")) { stashCollection.Apply(selectedStash); gitManager.MarkDirty(true); gitCallbacks.IssueAssetDatabaseRefresh(); } } if (GUILayout.Button(GitGUI.GetTempContent("Pop", "Remove and apply stash to working directory."), EditorStyles.miniButtonMid)) { if (EditorUtility.DisplayDialog("Pop Stash: " + selectedStash, "Are you sure you want to pop the stash ? This will override your current working directory and remove the stash from the list.", "Pop and Apply", "Cancel")) { stashCollection.Pop(selectedStash); gitManager.MarkDirty(true); gitCallbacks.IssueAssetDatabaseRefresh(); } } if (GUILayout.Button(GitGUI.GetTempContent("Remove", "Remove stash from list"), EditorStyles.miniButtonRight)) { if (EditorUtility.DisplayDialog("Remove Stash: " + selectedStash, "Are you sure you want to remove the stash ? This action cannot be undone!", "Remove", "Cancel")) { stashCollection.Remove(selectedStash); } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }