Ejemplo n.º 1
0
        private void ResetSelectedLinesToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (MessageBox.Show(_resetSelectedLinesConfirmation.Text, _resetChangesCaption.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            // Prepare git command
            string args = "apply --whitespace=nowarn --reverse";

            if (_currentItemStaged) //staged
            {
                args += " --index";
            }

            string patch = PatchManager.GetSelectedLinesAsPatch(SelectedDiff.GetText(), SelectedDiff.GetSelectionPosition(), SelectedDiff.GetSelectionLength(), _currentItemStaged);

            if (!string.IsNullOrEmpty(patch))
            {
                string output = GitCommandHelpers.RunCmd(Settings.GitCommand, args, patch);
                if (!string.IsNullOrEmpty(output))
                {
                    MessageBox.Show(output);
                }
                ScanClick(null, null);
            }
        }
Ejemplo n.º 2
0
        private void StageSelectedLinesToolStripMenuItemClick(object sender, EventArgs e)
        {
            // Prepare git command
            string args = "apply --cached --whitespace=nowarn";

            if (_currentItemStaged) //staged
                args += " --reverse";

            string patch = PatchManager.GetSelectedLinesAsPatch(SelectedDiff.GetText(), SelectedDiff.GetSelectionPosition(), SelectedDiff.GetSelectionLength(), _currentItemStaged);

            if (!string.IsNullOrEmpty(patch))
            {
                GitCommandHelpers.RunCmd(Settings.GitCommand, args, patch);
                ScanClick(null, null);
            }
        }