Наследование: GitExtensionsForm
Пример #1
0
        public bool StartCommitDialog(IWin32Window owner, bool showWhenNoChanges)
        {
            if (!RequiresValidWorkingDir(owner))
            {
                return(false);
            }

            if (!InvokeEvent(owner, PreCommit))
            {
                return(true);
            }

            using (var form = new FormCommit())
            {
                if (showWhenNoChanges)
                {
                    form.ShowDialogWhenChanges(owner);
                }
                else
                {
                    form.ShowDialog(owner);
                }

                InvokeEvent(owner, PostCommit);

                if (!form.NeedRefresh)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        public bool StartCommitDialog()
        {
            if (!RequiresValidWorkingDir())
            {
                return(false);
            }

            if (!InvokeEvent(PreCommit))
            {
                return(true);
            }

            var form = new FormCommit();

            form.ShowDialog();

            InvokeEvent(PostCommit);

            if (!form.NeedRefresh)
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        public bool StartCommitDialog(bool showWhenNoChanges)
        {
            if (!RequiresValidWorkingDir())
            {
                return(false);
            }

            if (!InvokeEvent(PreCommit))
            {
                return(true);
            }

            var form = new FormCommit();

            if (showWhenNoChanges)
            {
                form.ShowDialogWhenChanges();
            }
            else
            {
                form.ShowDialog();
            }

            InvokeEvent(PostCommit);

            if (!form.NeedRefresh)
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
        private void MergetoolClick(object sender, EventArgs e)
        {
            GitModule.Current.RunGitRealCmd("mergetool");

            if (MessageBox.Show(this, _allMergeConflictSolvedQuestion.Text, _allMergeConflictSolvedQuestionCaption.Text,
                                MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            using (var frm = new FormCommit()) frm.ShowDialog(this);
        }
Пример #5
0
        private void Mergetool_Click(object sender, EventArgs e)
        {
            GitCommands.GitCommands.RunRealCmd(GitCommands.Settings.GitDir + "git.cmd", "mergetool");

            if (MessageBox.Show("Resolved all conflicts? Commit?", "Conflicts solved", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                //Output.Text += "\n";
                FormCommit form = new FormCommit();
                form.ShowDialog();
            }
        }
Пример #6
0
        private void PrepareCorrectionCommit(CommitKind commitKind)
        {
            if (Revisions.RowCount <= LastRow || LastRow < 0)
                return;

            using (var frm = new FormCommit(UICommands, commitKind, GetRevision(LastRow))) frm.ShowDialog(this);

            ForceRefreshRevisions();
            OnActionOnRepositoryPerformed();
        }
Пример #7
0
        private void Initialize()
        {
            button1.Focus();

            ConflictedFiles.DataSource = GitCommands.GitCommands.GetConflictedFiles();
            InitMergetool();

            if (!GitCommands.GitCommands.InTheMiddleOfPatch() && !GitCommands.GitCommands.InTheMiddleOfRebase() && !GitCommands.GitCommands.InTheMiddleOfConflictedMerge() && ThereWhereMergeConflicts)
            {
                if (MessageBox.Show("All mergeconflicts are resolved, you can commit." + Environment.NewLine + "Do you want to commit now?", "Commit", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    FormCommit frm = new FormCommit();
                    frm.ShowDialog();
                }

            }

            if (!GitCommands.GitCommands.InTheMiddleOfConflictedMerge() && ThereWhereMergeConflicts)
            {
                Close();
            }
        }
Пример #8
0
        public bool StartCommitDialog(bool showWhenNoChanges)
        {
            if (!RequiresValidWorkingDir())
                return false;

            if (!InvokeEvent(PreCommit))
                return true;

            var form = new FormCommit();
            if (showWhenNoChanges)
                form.ShowDialogWhenChanges();
            else
                form.ShowDialog();

            InvokeEvent(PostCommit);

            if (!form.NeedRefresh)
                return false;

            return true;
        }
        private void MergetoolClick(object sender, EventArgs e)
        {
            Settings.Module.RunGitRealCmd("mergetool");

            if (MessageBox.Show(this, _allMergeConflictSolvedQuestion.Text, _allMergeConflictSolvedQuestionCaption.Text,
                                MessageBoxButtons.YesNo) != DialogResult.Yes)
                return;
            using (var frm = new FormCommit()) frm.ShowDialog(this);
        }
Пример #10
0
        public bool StartCommitDialog()
        {
            if (!InvokeEvent(PreCommit))
                return true;

            FormCommit form = new FormCommit();
            form.ShowDialog();

            InvokeEvent(PostCommit);

            if (!form.NeedRefresh)
                return false;

            return true;
        }
Пример #11
0
 private void commitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FormCommit form = new FormCommit();
     form.ShowDialog();
     if (form.NeedRefresh)
         Initialize();
 }
Пример #12
0
        void IContextMenu.InvokeCommand(IntPtr pici)
        {
            if (fileNames.Count == 1)
                if (Directory.Exists(fileNames[0]))
                    GitCommands.Settings.WorkingDir = fileNames[0];

            if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir) && fileNames.Count > 0)
                GitCommands.Settings.WorkingDir = fileNames[0].Substring(0, fileNames[0].LastIndexOf('\\'));

            if (string.IsNullOrEmpty(GitCommands.Settings.WorkingDir))
                GitCommands.Settings.WorkingDir = Directory.GetCurrentDirectory();

            try
            {
                Type typINVOKECOMMANDINFO = Type.GetType("ShellExt.INVOKECOMMANDINFO");
                INVOKECOMMANDINFO ici = (INVOKECOMMANDINFO)Marshal.PtrToStructure(pici, typINVOKECOMMANDINFO);
                switch (ici.verb-1)
                {
                    case 0://Add file
                        {
                            FormAddFiles form = new FormAddFiles();
                            form.Show();

                            break;
                        }
                    case 1://Branch
                        {
                            FormBranch form = new FormBranch();
                            form.Show();
                            break;
                        }
                    case 2://Browse
                        {
                            FormBrowse form = new FormBrowse();
                            form.Show();
                            break;
                        }
                    case 3://Checkout
                        {
                            FormCheckout form = new FormCheckout();
                            form.Show();
                            break;
                        }
                    case 4://Clone
                        {
                            FormClone form = new FormClone();
                            form.Show();
                            break;
                        }
                    case 5://Commit
                        {
                            FormCommit form = new FormCommit();
                            form.Show();
                            break;
                        }
                    case 6://Diff
                        {
                            FormDiff form = new FormDiff();
                            form.Show();
                            break;
                        }
                    case 7://Init
                        {
                            GitCommands.Init cmd = new GitCommands.Init(new GitCommands.InitDto());
                            cmd.Execute();
                            MessageBox.Show(cmd.Dto.Result);
                            break;
                        }
                    case 8://File history
                        {
                            if (fileNames.Count > 0)
                            {
                                FormFileHistory form = new FormFileHistory(fileNames[0]);
                                form.Show();
                            }
                            break;
                        }
                    case 9://ViewPatch
                        {
                            ViewPatch patchapply = new ViewPatch();
                            patchapply.Show();
                            break;
                        }
                    case 10://MergePatch
                        {
                            MergePatch form = new MergePatch();
                            form.Show();
                            break;
                        }
                    case 11://Push
                        {
                            FormPush form = new FormPush();
                            form.Show();
                            break;
                        }
                    case 12://Pull
                        {
                            FormPull form = new FormPull();
                            form.Show();
                            break;
                        }
                    case 13://Bash
                        {
                            GitCommands.GitCommands.RunBash();
                            break;
                        }
                    case 14://Gui
                        {
                            GitCommands.GitCommands.RunGui();
                            break;
                        }
                    default:
                        break;

                }

            }
            catch(Exception exe)
            {
                EventLog.WriteEntry("FileHashShell", exe.ToString());
            }

            //fileNames
        }
Пример #13
0
 void warning_Click(object sender, EventArgs e)
 {
     if (GitCommands.GitCommands.InTheMiddleOfConflictedMerge())
     {
         if (MessageBox.Show("There are unresolved mergeconflicts, run mergetool now?", "Merge conflicts", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             GitCommands.GitCommands.RunRealCmd(GitCommands.Settings.GitDir + "git.cmd", "mergetool");
             if (MessageBox.Show("When all mergeconflicts are resolved, you can commit.\nDo you want to commit now?", "Commit", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 FormCommit frm = new FormCommit();
                 frm.ShowDialog();
             }
             Initialize();
         }
     }
 }
Пример #14
0
        public bool StartCommitDialog(IWin32Window owner)
        {
            if (!RequiresValidWorkingDir())
                return false;

            if (!InvokeEvent(PreCommit))
                return true;

            var form = new FormCommit();
            form.ShowDialog(owner);

            InvokeEvent(PostCommit);

            if (!form.NeedRefresh)
                return false;

            return true;
        }
Пример #15
0
        /// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary>
        /// <param term='commandName'>The name of the command to execute.</param>
        /// <param term='executeOption'>Describes how the command should be run.</param>
        /// <param term='varIn'>Parameters passed from the caller to the command handler.</param>
        /// <param term='varOut'>Parameters passed from the command handler to the caller.</param>
        /// <param term='handled'>Informs the caller if the command was handled or not.</param>
        /// <seealso class='Exec' />
        public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
        {
            try
            {
                //Settings.WorkingDir =

                handled = false;
                string fileName = _applicationObject.Solution.FileName;
                Settings.WorkingDir = @"f:\Dev";//fileName.Substring(0, fileName.LastIndexOf('\\'));

                if (executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
                {

                    if (commandName == "GitPlugin.Connect.AddFiles")
                    {
                        FormAddFiles form = new FormAddFiles();
                        form.ShowDialog();
                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Branch")
                    {
                        FormBranch form = new FormBranch();
                        form.ShowDialog();

                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Browse")
                    {
                        FormBrowse form = new FormBrowse();
                        form.ShowDialog();

                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Checkout")
                    {
                        FormCheckout form = new FormCheckout();
                        form.ShowDialog();

                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Clone")
                    {
                        FormClone form = new FormClone();
                        form.ShowDialog(); ;

                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Commit")
                    {
                        FormCommit formCommit = new FormCommit();
                        formCommit.ShowDialog();

                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Diff")
                    {
                        FormDiff formDiff = new FormDiff();
                        formDiff.ShowDialog();

                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Init")
                    {
                        InitDto dto = new InitDto();
                        Init init = new Init(dto);
                        init.Execute();

                        MessageBox.Show(dto.Result);

                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Patch")
                    {
                        MergePatch form = new MergePatch();
                        form.ShowDialog();
                        handled = true;
                        return;
                    } if (commandName == "GitPlugin.Connect.Pull")
                    {
                        FormPull form = new FormPull();
                        form.ShowDialog();

                        handled = true;
                        return;
                    }
                    if (commandName == "GitPlugin.Connect.Push")
                    {
                        FormPull form = new FormPull();
                        form.ShowDialog();
                        handled = true;
                        return;
                    }

                }
            }
            catch
            {
                MessageBox.Show("ERROR!");
            }
        }
Пример #16
0
        public bool StartCommitDialog(IWin32Window owner, bool showWhenNoChanges)
        {
            if (!RequiresValidWorkingDir(owner))
                return false;

            if (!InvokeEvent(owner, PreCommit))
                return true;

            using (var form = new FormCommit(this))
            {
                if (showWhenNoChanges)
                    form.ShowDialogWhenChanges(owner);
                else
                    form.ShowDialog(owner);

                InvokeEvent(owner, PostCommit);

                if (!form.NeedRefresh)
                    return false;
            }

            return true;
        }
Пример #17
0
        public void StartCommitDialog(Action<FormCommit> refresh, Action finish = null, bool alwaysInTaskbar = true, IWin32Window owner = null, bool showWhenNoChanges = false, bool blocking = false)
        {
            if (RequiresValidWorkingDir(owner))
                if (!InvokeEvent(owner, PreCommit))
                    refresh(null);
                else
                {
                    var form = new FormCommit();
                    form.ShowInTaskbar |= alwaysInTaskbar;

                    Action Committed = () =>
                    {
                        if (form.NeedRefresh && refresh != null)
                        {
                            refresh(form);
                            form.NeedRefresh = false;
                        }
                    };
                    form.Committed += Committed;
                    form.FormClosed += (s, e) =>
                    {
                        try
                        {
                            InvokeEvent(owner, PostCommit);
                        }
                        finally
                        {
                            try
                            {
                                Committed();
                            }
                            finally
                            {
                                if (finish != null)
                                    finish();
                            }
                        }
                    };

                    if (showWhenNoChanges)
                        form.ShowWhenChanges(owner, blocking);
                    else if (blocking)
                        form.ShowDialog(owner);
                    else
                        form.Show();
                }
        }