public override void OnSelect(List <string> paths)
 {
     GitCore.StagePaths(paths, (output) =>
     {
         GitEvents.TriggerOnLocalChange();
     });
 }
Пример #2
0
        /// <summary>
        /// Scans the status of the local repo, and renders it
        /// </summary>
        private void Scan()
        {
            //Scan status
            GitCore.Status(true,
                           (commandOutput) =>
            {
                //Error catch
                if (commandOutput.errorData != null)
                {
                    Debug.LogError(commandOutput.errorData);
                    error       = true;
                    errorString = commandOutput.errorData;
                    return;
                }

                error = false;
                BuildStageLists(commandOutput.outputData);
            });

            //Scan branch
            GitCore.CurrentBranch((branch) =>
            {
                branchName = branch;
            }, (error) =>
            {
                branchName = "Error";
            });
        }
Пример #3
0
 //Run when button is clicked
 public override void OnClick(GitGudWindow window)
 {
     GitCore.Push(true, (output) =>
     {
         GitEvents.TriggerOnLocalChange();
     });
 }
Пример #4
0
 private void OnFinishStashWindow(string message)
 {
     GitCore.PushStash(message, (output) =>
     {
         GitEvents.TriggerOnLocalChange();
     });
 }
Пример #5
0
        private void RenderUnstageButtons()
        {
            bool noneSelected = (stagedFileViewer.GetSelectedPaths().Count == 0);
            bool noFiles      = (stagedFiles.Count == 0);

            EditorGUILayout.BeginHorizontal();

            //UNSTAGE SELECTED
            EditorGUI.BeginDisabledGroup(noneSelected);

            if (GUILayout.Button("Unstage Selected", GUILayout.ExpandWidth(false)))
            {
                GitCore.UnstagePaths(stagedFileViewer.GetSelectedPaths(), null);
                Scan();
            }

            EditorGUI.EndDisabledGroup();

            //UNSTAGE ALL
            EditorGUI.BeginDisabledGroup(noFiles);

            if (GUILayout.Button("Unstage All", GUILayout.ExpandWidth(false)))
            {
                GitCore.UnstagePaths(GitFile.GetPaths(stagedFiles), null);
                Scan();
            }

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndHorizontal();
        }
Пример #6
0
 private void OnEnable()
 {
     GitCore.CurrentBranch((branch) =>
     {
         currentBranchName = branch;
         Repaint();
     });
 }
Пример #7
0
 public override void OnSelect(List <Commit> commits)
 {
     GitCore.CheckoutCommit(commits[0], (output) =>
     {
         GitEvents.TriggerOnLocalChange();
         AssetDatabase.Refresh(ImportAssetOptions.Default);
     });
 }
Пример #8
0
 public override void OnSelect(List <Commit> commits)
 {
     GitCore.CheckoutCommit(commits[0], (output) =>
     {
         GitGud.RunCommands(new string[] { "clean -f -d", "reset --hard" }, (outputs) =>
         {
             GitEvents.TriggerOnLocalChange();
             AssetDatabase.Refresh(ImportAssetOptions.Default);
         });
     });
 }
Пример #9
0
        public override void Refresh()
        {
            GitCore.Log("@{push}..", (output, commits) =>
            {
                if (output.errorData != null)
                {
                    return;
                }

                pushCount = commits.Count;
            });
        }
Пример #10
0
        private void ScanStashes()
        {
            GitCore.ListStash((output, stashes) =>
            {
                if (output.errorData != null)
                {
                    stashes = null;
                    return;
                }

                this.stashes = stashes;
            });
        }
Пример #11
0
        private void ScanHistory()
        {
            GitCore.Log(null, (output, commits) =>
            {
                if (output.errorData != null)
                {
                    commits = null;
                    return;
                }

                this.commits = commits;
            });
        }
Пример #12
0
 private void CreateBranch()
 {
     GitCore.CreateBranch(newBranchName, (output) =>
     {
         if (output.errorData != null)
         {
             Debug.LogError("Could not create branch: " + output.errorData);
         }
         else
         {
             Debug.Log("Successfully create branch " + newBranchName);
         }
     });
 }
 //Function run when file context option is clicked
 public override void OnSelect(List <string> paths)
 {
     //Mkae sure all paths are not staged
     GitCore.UnstagePaths(paths, (unstageUutput) =>
     {
         //Discard files
         GitCore.DiscardFiles(paths, (discardOutput) =>
         {
             //Refresh
             GitEvents.TriggerOnLocalChange();
             AssetDatabase.Refresh(ImportAssetOptions.Default);
         });
     });
 }
Пример #14
0
        private void DiscardUnstaged()
        {
            bool discard = EditorUtility.DisplayDialog("Warning", "This will discard all unstaged changes - is this okay?", "Discard", "Cancel");

            if (!discard)
            {
                return;
            }

            GitCore.DiscardAll((output) =>
            {
                GitEvents.TriggerOnLocalChange();
                AssetDatabase.Refresh();
            });
        }
Пример #15
0
        private void AutoPush()
        {
            GitCore.Push(true, (output) =>
            {
                //Trigger a refresh
                GitEvents.TriggerOnLocalChange();

                //Error
                if (output.errorData != null)
                {
                    Debug.LogError(output.errorData);
                    return;
                }
            });
        }
Пример #16
0
        private void ScanHistory()
        {
            GitCore.Log(null, (output, commits) =>
            {
                if (output.errorData != null)
                {
                    commits = null;
                    return;
                }

                this.commitsDict = commits;

                //Cache list form of dictionary
                this.commits = commitsDict.Values.ToList();
            });
        }
Пример #17
0
        /// <summary>
        /// Scans the status of the local repo, and renders it
        /// </summary>
        private void Scan()
        {
            GitCore.Status(true,
                           (commandOutput) =>
            {
                //Error catch
                if (commandOutput.errorData != null)
                {
                    Debug.LogError(commandOutput.errorData);
                    error       = true;
                    errorString = commandOutput.errorData;
                    return;
                }

                error = false;
                BuildStageLists(commandOutput.outputData);
            });
        }
Пример #18
0
        private void Commit()
        {
            //Commit!
            GitCore.Commit(commitText, (output) =>
            {
                //Error
                if (output.errorData != null)
                {
                    Debug.LogError(output.errorData);
                    return;
                }

                //Auto push
                if (autoPush)
                {
                    AutoPush();
                }
                else
                {
                    //Trigger a refresh
                    GitEvents.TriggerOnLocalChange();
                }
            });
        }
Пример #19
0
 public RepoController(GitCore gitCore)
 {
     this.gitCore = gitCore;
 }