Push() public static method

public static Push ( string remoteName, CommandOutput outputDelegate ) : void
remoteName string
outputDelegate CommandOutput
return void
Esempio n. 1
0
    void OnGUI()
    {
        if (progressMode)
        {
            GUILayout.Label(progressString);
        }
        else
        {
            remoteSelection         = EditorGUILayout.Popup(remoteSelection, remotes);
            GitSystem.currentRemote = remotes[remoteSelection];

            if (GUILayout.Button("Push", GUILayout.MaxWidth(100)))
            {
                GitSystem.Push(remotes[remoteSelection], ProgressReceiver);
                progressMode = true;
            }
        }
    }
Esempio n. 2
0
        public override void RunCommand(string[] param)
        {
            GitSystem        gitSystem = GameObject.Find("GitObject").GetComponent <GitSystem>();
            DeveloperConsole console   = GameObject.Find("DeveloperConsoleObject").GetComponent <DeveloperConsole>();

            if (param.Length == 1)
            {
                console.AddMessageToConsole("Error format");
                return;
            }
            if (param[1] == "init")
            {
                if (param.Length != 2)
                {
                    console.AddMessageToConsole("Error format");
                }
                else
                {
                    bool exist = GameObject.Find("GitObject").GetComponent <GitSystem>();
                    if (exist)
                    {
                        GameObject.Find("GitObject").GetComponent <GitSystem>().buildRepository();
                    }
                }
            }
            if (param[1] == "add")
            {
                if (param.Length != 3)
                {
                    console.AddMessageToConsole("Error format");
                }
                else
                {
                    gitSystem.trackFile(param[2], "test");
                }
            }
            if (param[1] == "remove")
            {
                if (param.Length != 3)
                {
                    console.AddMessageToConsole("Error format");
                }
                else
                {
                    gitSystem.untrackFile(param[2]);
                }
            }
            if (param[1] == "commit")
            {
                if (param.Length != 4 || param[2] != "-m")
                {
                    console.AddMessageToConsole("Error format");
                }
                else
                {
                    gitSystem.Commit(param[3]);
                }
            }
            if (param[1] == "remote")
            {
                if (param[2] == "add" && param.Length == 4)
                {
                    gitSystem.addRemote(param[3]);
                }
                else
                {
                    console.AddMessageToConsole("Error format");
                }
            }
            if (param[1] == "push")
            {
                if (param.Length != 2)
                {
                    console.AddMessageToConsole("Error format");
                }
                else
                {
                    gitSystem.Push();
                }
            }
            if (param[1] == "clone")
            {
                if (param.Length != 3)
                {
                    console.AddMessageToConsole("Error format");
                }
                bool clone = gitSystem.cloneRepository(param[2]);
                if (!clone)
                {
                    console.AddMessageToConsole("Cannot clone");
                }
            }
            if (param[1] == "branch")
            {
                if (param.Length == 2)
                {
                    Debug.Log(gitSystem.localRepository.branches.ToString());
                }
                else if (param.Length == 3)
                {
                    gitSystem.createBranch(param[2]);
                }
                else if (param.Length == 4 && param[2] == "-D")
                {
                    gitSystem.deleteBranch(param[3]);
                }
                else
                {
                    console.AddMessageToConsole("Error format");
                }
            }
            if (param[1] == "checkout")
            {
                if (param.Length != 3)
                {
                    console.AddMessageToConsole("Error format");
                }
                else
                {
                    gitSystem.checkout(param[2]);
                }
            }
            if (param[1] == "merge")
            {
                if (param.Length != 3)
                {
                    console.AddMessageToConsole("Error format");
                }
                else
                {
                    gitSystem.Merge(param[2]);
                }
            }
            if (param[1] == "pull")
            {
                if (param.Length != 4)
                {
                    console.AddMessageToConsole("Error format");
                }
                else
                {
                    gitSystem.Pull(param[2], param[3]);
                }
            }
        }