Example #1
0
        protected override void OnInit()
        {
            KeyDic.Add(new ShortCut(KeyCode.U, "Change Stage", ChangeStage));
            KeyDic.Add(new ShortCut(KeyCode.R, "Refresh", item => Refresh(TreeView.GetSelectionIndex())));
            KeyDic.Add(new ShortCut(KeyCode.Z, "Undo", ChangeUndo));
            KeyDic.Add(new ShortCut(KeyCode.Return, "Show Diff", item => {
                if (item.depth != 1)
                {
                    return;
                }
                var param = new DiffParam();
                param.SetFile(item.displayName, item.Status == GitStatusType.Stage);
                GUI.OpenSub(ModuleType.Diff, param);
            }));
            KeyDic.Add(new ShortCut(KeyCode.T, "Target", item =>
            {
                if (item.depth != 1)
                {
                    return;
                }

                // スクリプト
                if (item.displayName.EndsWith(".cs"))
                {
                    InternalEditorUtility.OpenFileAtLineExternal(item.displayName, 0);

                    return;
                }

                var asset         = AssetDatabase.LoadAssetAtPath <UnityEngine.Object>(item.displayName);
                Selection.objects = new[] { asset };
            }));
        }
Example #2
0
        protected override void OnInit()
        {
            KeyDic.Add(new ShortCut(KeyCode.W, "Change Branch", SwitchBranch));
            KeyDic.Add(new ShortCut(KeyCode.R, "Reload", item =>
            {
                Fetch();
                OnEnter(null);
            }));

            KeyDic.Add(new ShortCut(KeyCode.Return, "Show Log", item => GUI.OpenSub(ModuleType.Log, item.displayName)));
        }
Example #3
0
        protected override void OnInit()
        {
            KeyDic.Add(new ShortCut(KeyCode.Return, "Show Diff", item =>
            {
                var param = new DiffParam();
                param.SetHash(item.displayName);
                GUI.OpenSub(ModuleType.Diff, param);
            }));
            KeyDic.Add(new ShortCut(KeyCode.R, "Reload", item => OnEnter(CurrentBranch())));
            KeyDic.Add(new ShortCut(KeyCode.P, "Push", item =>
            {
                var branch = CurrentBranch();
                if (EditorUtility.DisplayDialog("Warning", $"Try to Push \"{branch}\" ?", "Yes", "No"))
                {
                    Push(branch);
                    OnEnter(branch);
                }
            }));
            KeyDic.Add(new ShortCut(KeyCode.F, "Pull", item =>
            {
                var cb = CurrentBranch();
                if (cb.StartsWith("origin/"))
                {
                    return;
                }

                var output = GetStatus();
                // 差分があった場合
                if (output.Count() - GetUntrack(output).Count() > 0)
                {
                    if (!EditorUtility.DisplayDialog(
                            "Warning",
                            "There is a diff, want to pull rebase?",
                            "Yes",
                            "No"))
                    {
                        return;
                    }

                    var o2 = Stash();
                    EditorUtility.DisplayDialog("Info", o2, "Ok");
                }

                var o3 = PullRebase(cb);
                EditorUtility.DisplayDialog("Info", o3, "Ok");
                OnEnter(cb);
            }));
        }
Example #4
0
 protected override void OnInit()
 {
     KeyDic.Add(new ShortCut(KeyCode.Return, "Jump", Jump));
 }