Beispiel #1
0
        protected void OnMergeComplete(MergeResult result, string mergeType)
        {
            var historyWindow = UniGitLoader.FindWindow <GitHistoryWindow>();
            var diffWindow    = UniGitLoader.FindWindow <GitDiffWindow>();

            switch (result.Status)
            {
            case MergeStatus.UpToDate:
                if (historyWindow != null)
                {
                    historyWindow.ShowNotification(new GUIContent(string.Format("Everything is Up to date. Nothing to {0}.", mergeType)));
                }
                break;

            case MergeStatus.FastForward:
                if (historyWindow != null)
                {
                    historyWindow.ShowNotification(new GUIContent(mergeType + " Complete with Fast Forwarding."));
                }
                break;

            case MergeStatus.NonFastForward:
                if (diffWindow != null)
                {
                    diffWindow.ShowNotification(new GUIContent("Do a merge commit in order to push changes."));
                    diffWindow.SetCommitMessage(gitManager.Repository.Info.Message);
                }
                else
                {
                    GitDiffWindow.SetCommitMessage(gitManager, gitManager.Repository.Info.Message);
                }
                Debug.Log(mergeType + " Complete without Fast Forwarding.");
                break;

            case MergeStatus.Conflicts:
                GUIContent content = GitGUI.IconContent("console.warnicon", "There are merge conflicts!");
                if (diffWindow != null)
                {
                    diffWindow.ShowNotification(content);
                    diffWindow.SetCommitMessage(gitManager.Repository.Info.Message);
                }
                else
                {
                    GitDiffWindow.SetCommitMessage(gitManager, gitManager.Repository.Info.Message);
                }
                break;
            }
            gitManager.MarkDirty();
            Debug.LogFormat("{0} Status: {1}", mergeType, result.Status);
        }