public static void DrawPackageDownUpButton(GitLinkOnDisk disk, bool affectPackage = true) { if (!disk.HasUrl()) { return; } bool isDirectoryCreated = Directory.Exists(disk.GetDirectoryPath()); bool isGitFolderPresent = disk.HasUrl(); GUIStyle disableStyle = GetDisableStyle(); GUIStyle enableStyle = GetEnableStyle(); GUILayout.BeginHorizontal(); bool downAllow = true; if (GUILayout.Button("Down", downAllow ? enableStyle : disableStyle)) { UnityPackageUtility.Down(disk.GetDirectoryPath(), disk.GetUrl(), affectPackage); } bool upAllow = isDirectoryCreated && isGitFolderPresent; if (GUILayout.Button("Up", upAllow ? enableStyle : disableStyle)) { if (upAllow) { UnityPackageUtility.Up(disk.GetDirectoryPath(), affectPackage); } } GUILayout.EndHorizontal(); }
public static void DisplayDeleteRepositoryOptions(GitLinkOnDisk gitLink) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Remove Repository")) { FileUtil.DeleteFileOrDirectory(gitLink.GetDirectoryPath()); RefreshDatabase(); } if (GUILayout.Button("Remove .git")) { FileUtil.DeleteFileOrDirectory(gitLink.GetDirectoryPath() + "/.git"); RefreshDatabase(); } EditorGUILayout.EndHorizontal(); }
public static void DisplayGitLink(GitLinkOnDisk git) { GUIStyle button = new GUIStyle(GUI.skin.button); GUILayout.BeginHorizontal(); if (GUILayout.Button("> Git:", button, GUILayout.MaxWidth(50))) { Application.OpenURL(git.GetUrl()); } EditorGUILayout.TextField(git.GetUrl()); if (GUILayout.Button("> Path:", new GUIStyle(GUI.skin.button), GUILayout.MaxWidth(50))) { Application.OpenURL(git.GetDirectoryPath()); } EditorGUILayout.TextField(git.GetDirectoryPath()); GUILayout.EndHorizontal(); }
public static void PushLocalGitToOnlineAccount(GitLinkOnDisk gitLink, ref string userName, ref string projectNameId, ref int dropDownSelectionServer, ref bool compact) { compact = EditorGUILayout.Foldout(compact, "→ Push repository online", EditorStyles.boldLabel); if (!compact) { GUILayout.BeginHorizontal(); GUILayout.Label("User id "); userName = GUILayout.TextField(userName, GUILayout.MaxWidth(500)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Project id "); projectNameId = GUILayout.TextField(projectNameId, GUILayout.MaxWidth(500)); GUILayout.EndHorizontal(); dropDownSelectionServer = EditorGUILayout.Popup(dropDownSelectionServer, new string[] { "GitLab", "GitHub" }); string urlToCreate = ""; if (dropDownSelectionServer == 0) { urlToCreate = string.Format("https://gitlab.com/{0}/{1}.git", userName, projectNameId); } if (dropDownSelectionServer == 1) { urlToCreate = "https://github.com?name=" + projectNameId; } if (userName != "" && projectNameId != "") { string url = ""; if (dropDownSelectionServer == 0) { if (GUILayout.Button("Create/Push Online")) { QuickGit.PushLocalToGitLab(gitLink.GetDirectoryPath(), userName, projectNameId, out url); urlToCreate = string.Format("https://gitlab.com/{0}/{1}.git", userName, projectNameId); Application.OpenURL(urlToCreate); } } if (dropDownSelectionServer == 1) { if (GUILayout.Button("Go to Github")) { //QuickGit.PushLocalToGitHub(gitLink.GetDirectoryPath(), userName, projectNameId, out url); urlToCreate = "https://github.com?name=" + projectNameId; Application.OpenURL(url); } } } DisplayDeleteRepositoryOptions(gitLink); DisplayMessageToHelp("Please enter your account id and the name of the project in the git link: " + urlToCreate); } }
public static void DisplayGitCommands(GitLinkOnDisk gitDirectory) { bool hasUrl = gitDirectory.HasUrl(); if (gitDirectory.Exist()) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Add -a")) { QuickGit.Add(gitDirectory.GetDirectoryPath()); } if (GUILayout.Button("Commit")) { QuickGit.Commit(gitDirectory.GetDirectoryPath()); } if (hasUrl && GUILayout.Button("Pull")) { QuickGit.Pull(gitDirectory.GetDirectoryPath()); } if (hasUrl && GUILayout.Button("Push")) { QuickGit.Push(gitDirectory.GetDirectoryPath()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (hasUrl && GUILayout.Button("Add>Commit>Pull")) { QuickGit.AddCommitAndPush(gitDirectory.GetDirectoryPath()); } if (hasUrl && GUILayout.Button("A>C>Pull + A>C>push")) { QuickGit.PullPushWithAddAndCommit(gitDirectory.GetDirectoryPath()); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Open explorer")) { Application.OpenURL(gitDirectory.GetDirectoryPath()); } if (GUILayout.Button("See Status")) { QuickGit.OpenCmd(gitDirectory.GetDirectoryPath()); } if (hasUrl && GUILayout.Button("Go to Server")) { Application.OpenURL(gitDirectory.GetUrl()); } GUILayout.EndHorizontal(); } }