Example #1
0
 public void RemoveProject()
 {
     if (IsDirectoryCreated())
     {
         QuickGit.RemoveFolder(GetProjectPathInUnity());
     }
 }
Example #2
0
    public static List <GitUnityPackageLinkOnDisk> GetGitUnityPackageInDirectory(string directoryPath)
    {
        List <GitLinkOnDisk> links;

        QuickGit.GetGitsInDirectory(directoryPath, out links);
        return(GetGitUnityPackageInDirectory(links));
    }
    public void Refresh()
    {
        string assetPath = UnityPaths.GetUnityAssetsPath();

        QuickGit.GetGitsInParents(assetPath, out m_inParentsPath);
        QuickGit.GetGitsInDirectory(assetPath, out m_inTheProject, true);
    }
    public static void PushLocalToGitLab(string directoryPath, string userName, string newRepoName, out string gitCreatedUrl)
    {
        QuickGit.CreateGitKeepInEmptyFolders(directoryPath);
        directoryPath = UnityPaths.ReplaceByBackslash(directoryPath);
        UnityEngine.Debug.Log("" + userName + "????" + newRepoName);
        UnityEngine.Debug.Log("" + "????" + directoryPath);
        if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(newRepoName))
        {
            gitCreatedUrl = "https://gitlab.com/" + userName + "/" + newRepoName + ".git";
        }
        else
        {
            gitCreatedUrl = "";
        }

        //https://docs.gitlab.com/ee/gitlab-basics/create-project.html
        //git push --set-upstream https://gitlab.example.com/namespace/nonexistent-project.git master
        //git push --set-upstream address/your-project.git
        WindowCMD.RunCommands(new string[] {
            "git add .",
            "git commit -m \"Local to Remote\"",
            "git push --set-upstream \"https://gitlab.com/" + userName + "/" + newRepoName + ".git\" master",
            "git push -u origin master"
        }, directoryPath);
    }
 public void AutoSaveAndPush(string commitMessage = "")
 {
     for (int i = 0; i < m_inTheProject.Count; i++)
     {
         QuickGit.PullPushWithAddAndCommit(m_inTheProject[i].GetDirectoryPath(), commitMessage);
     }
 }
Example #6
0
    private void ProposeToCreateLocalGit()
    {
        if (GUILayout.Button("Create Local"))
        {
            QuickGit.CreateLocal(m_absoluteSelection);
        }
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Clone"))
        {
            QuickGit.Clone(m_gitLinkToClone, m_absoluteSelection);
        }
        m_gitLinkToClone = GUILayout.TextField(
            m_gitLinkToClone);


        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("GitLab"))
        {
            Application.OpenURL("https://gitlab.com/dashboard/projects");
        }
        if (GUILayout.Button("GitHub"))
        {
            Application.OpenURL("https://github.com/");
        }

        GUILayout.EndHorizontal();
    }
    public string GetLastRevision(out bool found)
    {
        string value;

        QuickGit.GetLastRevision(m_projectDirectoryPath, out found, out value);
        return(value);
    }
Example #8
0
    private void PushLocalGitToOnlineAccount()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("User id ");
        m_gitlabprojectAuthor = GUILayout.TextField(m_gitlabprojectAuthor);

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("Project id ");
        m_gitlabprojectId = GUILayout.TextField(m_gitlabprojectId);
        string urlToCrate = string.Format("https://gitlab.com/{0}/{1}.git", m_gitlabprojectAuthor, m_gitlabprojectId);


        GUILayout.EndHorizontal();
        if (m_gitlabprojectAuthor != "" && m_gitlabprojectId != "")

        {
            if (GUILayout.Button("Create/Push Online"))
            {
                string url = "";
                QuickGit.PushLocalToGitLab(m_gitLinkedToSelectedAsset, m_gitlabprojectAuthor, m_gitlabprojectId, out url);
            }
        }
        DisplayMessageToHelp("Please enter your account id and the name of the project in the git link: " + urlToCrate);
    }
Example #9
0
    public void RefreshInfo()
    {
        QuickGit.SetDebugOn(m_useDebug);
        m_useDebug = QuickGit.GetDebugState();

        m_isValideLink = UnityPackageUtility.IsGitLinkValide(m_gitLink);
        m_projectName  = UnityPackageUtility.GetProjectNameFromGitLink(m_gitLink);
    }
 public void AutoSaveLocal(string commitMessage = "")
 {
     for (int i = 0; i < m_inTheProject.Count; i++)
     {
         QuickGit.Add(m_inTheProject[i].GetDirectoryPath());
         QuickGit.Commit(m_inTheProject[i].GetDirectoryPath(), commitMessage);
     }
 }
 public static void ButtonDeleteEmptyFiles(string absolutPath)
 {
     if (GUILayout.Button("Delete Empty folder in directory"))
     {
         QuickGit.RemoveAllEmptyFolders(absolutPath);
         AssetDatabase.Refresh();
     }
 }
Example #12
0
    public static void Up(string directory, bool affectManifest = true)
    {
        string namespaceId = "", gitUrl = "";

        TryToAccessPackageNamespaceIdFromFolder(directory, out namespaceId);
        QuickGit.GetGitUrl(directory, out gitUrl);
        Up(directory, namespaceId, gitUrl, affectManifest);
    }
 public static void ButtonRefreshGitKeeper(string absolutPath)
 {
     if (GUILayout.Button("Refresh gitkeep in directory"))
     {
         QuickGit.RefreshGitKeepInEmptyFolder(absolutPath);
         AssetDatabase.Refresh();
     }
 }
    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);
        }
    }
Example #15
0
 private void RefreshAccess()
 {
     m_info.m_readMe        = ReadMeUtility.GetReadMeFile(m_selector);
     m_info.m_sample        = SampleUtility.GetSampleFolder(m_selector);
     m_info.m_documentation = DocumentationUtility.GetDocumentFolder(m_selector);
     m_info.m_changelog     = ChangeLogUtility.GetReadMeFile(m_selector);
     m_info.m_license       = LicenseUtility.GetReadMeFile(m_selector);
     QuickGit.GetGitInDirectory(m_selector.GetAbsolutePath(true), out m_info.m_gitLink, false);
 }
    public static void GetAffectedGit(UnityPathSelectionInfo selector, out GitLinkOnDisk gitAffected)
    {
        string path = selector.GetAbsolutePath(true);

        if (QuickGit.IsPathHasGitRootFolder(path))
        {
            gitAffected = new  GitLinkOnDisk(path);
        }
        QuickGit.GetGitInParents(path, QuickGit.PathReadDirection.LeafToRoot, out gitAffected);
    }
Example #17
0
 private void Reset()
 {
     if (string.IsNullOrEmpty(m_directory))
     {
         m_directory = Application.dataPath + "/../";
     }
     m_gitLinksPath = QuickGit.GetAllFolders(m_directory, true);
     QuickGit.GetGitsInDirectory(m_directory, out m_gitLinks);
     m_packageInfo = UnityPackageUtility.GetGitUnityPackageInDirectory(m_directory);
 }
    void OnGUI()
    {
        UnityPathSelectionInfo.Get(out m_pathFound, out m_selector);
        GUILayout.Label("Package.json: " + m_selector.GetRelativePath(false), EditorStyles.boldLabel);
        PackageJsonFileStream f = PackageJsonUtility.GetPackageFile(m_selector);

        QuickGit.GetGitInParents(m_selector.GetAbsolutePath(false), QuickGit.PathReadDirection.LeafToRoot,
                                 out m_gitLink);
        DrawEditorDefaultInterface(m_selector, f, ref m_builder, ref m_jsonProposition, ref m_raw, ref m_hide);
    }
Example #19
0
    void OnGUI()
    {
        UnityPathSelectionInfo.Get(out m_pathFound, out m_selector);
        GUILayout.Label("Read Me: " + m_selector.GetRelativePath(false), EditorStyles.boldLabel);
        ReadMeFileStream f = ReadMeUtility.GetReadMeFile(m_selector);

        QuickGit.GetGitInParents(m_selector.GetAbsolutePath(false), QuickGit.PathReadDirection.LeafToRoot, out m_gitLink);

        //QuickGit.GetGitInDirectory(m_selector.GetAbsolutePath(false), out m_gitLink, true);
        DrawEditorDefaultInterface(f, ref m_gitLink, ref m_text, ref m_hide);
    }
    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();
        }
    }
    public static void ProposeCloneProject(UnityPathSelectionInfo selector, ref string cloneProposed)
    {
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Clone"))
        {
            QuickGit.Clone(cloneProposed, selector.GetAbsolutePath(true));
        }
        cloneProposed = GUILayout.TextField(
            cloneProposed);


        GUILayout.EndHorizontal();
    }
Example #22
0
    private string GetGitFolderAbsolutPath(out bool hasGitInParent)
    {
        string path = "";

        hasGitInParent = false;
        GitLinkOnDisk gd;

        QuickGit.GetGitInParents(m_absoluteSelection, QuickGit.PathReadDirection.LeafToRoot, out gd);
        if (gd != null)
        {
            hasGitInParent = true;
            path           = gd.GetDirectoryPath();
        }
        return(path);
    }
    public static void LoadCommitsFromDateToDate(string [] repositoriesAbsolutePath, GitDateFormat dateFromFormat, GitDateFormat dateToFormat, out List <LogCommitReceived> commits, out List <WindowCMDCallback> callbacks, int maxToRecover = 50000)
    {
        callbacks = new List <WindowCMDCallback>();

        List <LogCommitReceived> receivedCommits = new List <LogCommitReceived>();

        commits = new List <LogCommitReceived>();
        for (int i = 0; i < repositoriesAbsolutePath.Length; i++)
        {
            WindowCMDCallback callback;
            QuickGit.LoadCommitsFromDateToDate(repositoriesAbsolutePath[i], dateFromFormat, dateToFormat, out receivedCommits, out callback, maxToRecover);
            callbacks.Add(callback);
            commits.AddRange(receivedCommits);
        }
    }
Example #24
0
    public static void Up(string directory, string namespaceId, string gitUrl, bool affectManifest = true)
    {
        string directoryPath = directory;

        QuickGit.AddFileInEmptyFolder(directoryPath);
        QuickGit.PullPushWithAddAndCommit(directoryPath, "Update: " + DateTime.Now.ToString("yyyy/mm/dd -  hh:mm"));

        #if UNITY_EDITOR
        UnityEditor.FileUtil.DeleteFileOrDirectory(directoryPath);
        UnityEditor.AssetDatabase.Refresh();
        #endif
        if (affectManifest && !string.IsNullOrEmpty(namespaceId) && !string.IsNullOrEmpty(gitUrl))
        {
            UnityPackageUtility.AddPackage(namespaceId, gitUrl);
        }
    }
Example #25
0
    private void ProposeToCreateLocalGit()
    {
        if (GUILayout.Button("Create Local"))
        {
            QuickGit.CreateLocal(m_absoluteSelection);
        }
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Clone"))
        {
            QuickGit.Clone(m_gitLinkToClone, m_absoluteSelection);
        }
        m_gitLinkToClone = GUILayout.TextField(
            m_gitLinkToClone);


        GUILayout.EndHorizontal();
    }
Example #26
0
    public static void Down(string directory, string gitUrl, bool affectManifest = true)
    {
        string directoryPath = directory;

        Directory.CreateDirectory(directoryPath);
        if (!Directory.Exists(directoryPath + "/.git"))
        {
            QuickGit.Clone(gitUrl, directoryPath);
        }
        else
        {
            QuickGit.Pull(directoryPath);
        }

        if (affectManifest && !string.IsNullOrEmpty(gitUrl))
        {
            UnityPackageUtility.RemovePackage(gitUrl);
        }
    }
Example #27
0
 public GitUnityPackageLinkOnDisk(string directoryPath)
 {
     UnityPackageUtility.GetUnityPackage(directoryPath, out m_packageInfo);
     QuickGit.GetGitUrl(directoryPath, out m_gitLink);
     this.m_projectDirectoryPath = directoryPath;
 }
Example #28
0
 public static List <GitUnityPackageLinkOnDisk> GetGitUnityPackageInDirectory(string[] directoriesPath)
 {
     return(GetGitUnityPackageInDirectory(QuickGit.GetGitsInGivenDirectories(directoriesPath)));
 }
 public GitLinkOnDisk(string directoryPath)
 {
     QuickGit.GetGitUrl(directoryPath, out m_gitLink);
     this.m_projectDirectoryPath = directoryPath;
 }
 public bool IsInsideUnityProject()
 {
     return(QuickGit.IsGitInsideProject(m_projectDirectoryPath));
 }