private void OnGUI() { CreateStyles(); if (!GitManager.IsValidRepo) { GitHistoryWindow.InvalidRepoGUI(); return; } RepositoryInformation repoInfo = GitManager.Repository.Info; GUILayout.BeginArea(CommitRect); DoCommit(repoInfo); GUILayout.EndArea(); SerializedProperty diffScrollProperty = editoSerializedObject.FindProperty("diffScroll"); if (statusList == null) { return; } DoDiffScroll(Event.current); editoSerializedObject.ApplyModifiedProperties(); if (Event.current.type == EventType.MouseDown) { GUIUtility.keyboardControl = 0; GUI.FocusControl(null); } }
private void Commit() { Signature signature = GitManager.Signature; try { if (!GitExternalManager.TakeCommit(commitMessage)) { GitManager.Repository.Commit(commitMessage, signature, signature, new CommitOptions() { AllowEmptyCommit = settings.emptyCommit, AmendPreviousCommit = settings.amendCommit, PrettifyMessage = settings.prettify }); GitHistoryWindow.GetWindow(true); } GitManager.Update(); } catch (Exception e) { Debug.LogException(e); } finally { GUI.FocusControl(""); commitMessage = string.Empty; } }
protected void OnMergeComplete(MergeResult result, string mergeType) { switch (result.Status) { case MergeStatus.UpToDate: GitHistoryWindow.GetWindow(true).ShowNotification(new GUIContent(string.Format("Everything is Up to date. Nothing to {0}.", mergeType))); break; case MergeStatus.FastForward: GitHistoryWindow.GetWindow(true).ShowNotification(new GUIContent(mergeType + " Complete with Fast Forwarding.")); break; case MergeStatus.NonFastForward: GitDiffWindow.GetWindow(true).ShowNotification(new GUIContent("Do a merge commit in order to push changes.")); GitDiffWindow.GetWindow(false).commitMessage = GitManager.Repository.Info.Message; Debug.Log(mergeType + " Complete without Fast Forwarding."); break; case MergeStatus.Conflicts: GUIContent content = EditorGUIUtility.IconContent("console.warnicon"); content.text = "There are merge conflicts!"; GitDiffWindow.GetWindow(true).ShowNotification(content); GitDiffWindow.GetWindow(false).commitMessage = GitManager.Repository.Info.Message; break; } GitManager.Update(); Debug.LogFormat("{0} Status: {1}", mergeType, result.Status); }
private void OnWizardCreate() { try { using (var repository = new Repository(GitManager.RepoPath)) { repository.Network.Push(repository.Branches[branchNames[selectedBranch]], pushOptions); GitManager.Update(); var window = GitHistoryWindow.GetWindow(true); window.ShowNotification(new GUIContent("Push Complete")); } } catch (Exception e) { if (e is NonFastForwardException) { GUIContent content = EditorGUIUtility.IconContent("console.warnicon"); content.text = "Could not push changes to remote. Merge changes with remote before pushing."; GetWindow <GitHistoryWindow>().ShowNotification(content); } Debug.LogException(e); } finally { EditorUtility.ClearProgressBar(); } }
private void OnGUI() { if (gitManager == null || !gitManager.IsValidRepo) { GitHistoryWindow.InvalidRepoGUI(gitManager); return; } Event current = Event.current; EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); EditorGUI.BeginChangeCheck(); if (tabs != null) { for (int i = 0; i < tabs.Length; i++) { bool value = GUILayout.Toggle(tab == i, tabs[i].Name, EditorStyles.toolbarButton); if (value) { tab = i; } } } if (EditorGUI.EndChangeCheck()) { LoseFocus(); if (currentTab != null) { currentTab.OnFocus(); } } GUILayout.FlexibleSpace(); if (GitGUI.LinkButtonLayout(GitOverlay.icons.donateSmall, GitGUI.Styles.IconButton)) { GitLinks.GoTo(GitLinks.Donate); } if (GitGUI.LinkButtonLayout(GitGUI.Contents.Help, GitGUI.Styles.IconButton)) { GitLinks.GoTo(GitLinks.SettingsWindowHelp); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (gitManager.Repository != null) { Rect localRect = new Rect(0, 0, position.width, position.height - EditorGUIUtility.singleLineHeight * 1.6f); if (currentTab != null) { currentTab.OnGUI(localRect, current); } } EditorGUILayout.Space(); if (current.type == EventType.MouseDown) { LoseFocus(); } }
private void OnWizardCreate() { try { GitManager.Repository.Network.Fetch(remotes[selectedRemote], fetchOptions); Debug.Log("Fetch Complete"); var window = GitHistoryWindow.GetWindow(true); window.ShowNotification(new GUIContent("Fetch Complete")); } catch (Exception e) { Debug.LogException(e); } finally { EditorUtility.ClearProgressBar(); } }
private void OnWizardCreate() { try { MergeResult result = GitManager.Repository.MergeFetchedRefs(GitManager.Signature, mergeOptions); GitHistoryWindow.GetWindow(true); OnMergeComplete(result, "Merge"); GitManager.Update(); AssetDatabase.Refresh(); } catch (CheckoutConflictException e) { Debug.LogException(e); } finally { EditorUtility.ClearProgressBar(); } }
private void OnGUI() { if (!GitManager.IsValidRepo) { GitHistoryWindow.InvalidRepoGUI(); return; } Event current = Event.current; EditorGUILayout.BeginHorizontal("Toolbar"); EditorGUI.BeginChangeCheck(); bool value = GUILayout.Toggle(tab == SettingTabEnum.General, GitGUI.GetTempContent("General"), "toolbarbutton"); if (value) { tab = SettingTabEnum.General; } value = GUILayout.Toggle(tab == SettingTabEnum.Externals, GitGUI.GetTempContent("Externals"), "toolbarbutton"); if (value) { tab = SettingTabEnum.Externals; } value = GUILayout.Toggle(tab == SettingTabEnum.Remotes, GitGUI.GetTempContent("Remotes"), "toolbarbutton"); if (value) { tab = SettingTabEnum.Remotes; } value = GUILayout.Toggle(tab == SettingTabEnum.Branches, GitGUI.GetTempContent("Branches"), "toolbarbutton"); if (value) { tab = SettingTabEnum.Branches; } value = GUILayout.Toggle(tab == SettingTabEnum.LFS, GitGUI.GetTempContent("LFS"), "toolbarbutton"); if (value) { tab = SettingTabEnum.LFS; } value = GUILayout.Toggle(tab == SettingTabEnum.Security, GitGUI.GetTempContent("Security"), "toolbarbutton"); if (value) { tab = SettingTabEnum.Security; } if (EditorGUI.EndChangeCheck()) { LoseFocus(); } GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (GitManager.Repository != null) { switch (tab) { case SettingTabEnum.Remotes: DoRemotes(current); break; case SettingTabEnum.Externals: DoExternals(current); break; case SettingTabEnum.Branches: DoBranches(current); break; case SettingTabEnum.LFS: DoLFS(current); break; case SettingTabEnum.Security: DoSecurity(current); break; default: DoGeneral(current); break; } } EditorGUILayout.Space(); if (current.type == EventType.MouseDown) { LoseFocus(); } }
private void OnGUI() { if (!GitManager.IsValidRepo) { GitHistoryWindow.InvalidRepoGUI(); return; } Event current = Event.current; EditorGUILayout.BeginHorizontal("Toolbar"); EditorGUI.BeginChangeCheck(); bool value = GUILayout.Toggle(tab == SettingTabEnum.General, GitGUI.GetTempContent("General"), "toolbarbutton"); if (value) { tab = SettingTabEnum.General; } value = GUILayout.Toggle(tab == SettingTabEnum.Externals, GitGUI.GetTempContent("Externals", "External Programs Helpers"), "toolbarbutton"); if (value) { tab = SettingTabEnum.Externals; } value = GUILayout.Toggle(tab == SettingTabEnum.Remotes, GitGUI.GetTempContent("Remotes", "Remote Repositories"), "toolbarbutton"); if (value) { tab = SettingTabEnum.Remotes; } value = GUILayout.Toggle(tab == SettingTabEnum.Branches, GitGUI.GetTempContent("Branches"), "toolbarbutton"); if (value) { tab = SettingTabEnum.Branches; } value = GUILayout.Toggle(tab == SettingTabEnum.LFS, GitGUI.GetTempContent("LFS", "Git Large File Storage (beta)"), "toolbarbutton"); if (value) { tab = SettingTabEnum.LFS; } value = GUILayout.Toggle(tab == SettingTabEnum.Security, GitGUI.GetTempContent("Security"), "toolbarbutton"); if (value) { tab = SettingTabEnum.Security; } if (EditorGUI.EndChangeCheck()) { LoseFocus(); if (currentTab != null) { currentTab.OnFocus(); } } GUILayout.FlexibleSpace(); if (GUILayout.Button(GitGUI.IconContent("_Help"), "IconButton")) { GoToHelp(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (GitManager.Repository != null) { Rect localRect = new Rect(0, 0, position.width, position.height - EditorGUIUtility.singleLineHeight * 1.6f); if (currentTab != null) { currentTab.OnGUI(localRect, current); } } EditorGUILayout.Space(); if (current.type == EventType.MouseDown) { LoseFocus(); } }