public void ApplyMailboxPatchCmd()
 {
     Assert.AreEqual(
         "am --3way --signoff \"hello/world.patch\"",
         GitCommandHelpers.ApplyMailboxPatchCmd(false, "hello\\world.patch").Arguments);
     Assert.AreEqual(
         "am --3way --signoff --ignore-whitespace \"hello/world.patch\"",
         GitCommandHelpers.ApplyMailboxPatchCmd(true, "hello\\world.patch").Arguments);
     Assert.AreEqual(
         "am --3way --signoff --ignore-whitespace",
         GitCommandHelpers.ApplyMailboxPatchCmd(true).Arguments);
 }
Exemple #2
0
        private void Apply_Click(object sender, EventArgs e)
        {
            var patchFile        = PatchFile.Text;
            var dirText          = PatchDir.Text;
            var ignoreWhiteSpace = IgnoreWhitespace.Checked;
            var signOff          = SignOff.Checked;

            if (string.IsNullOrEmpty(patchFile) && string.IsNullOrEmpty(dirText))
            {
                MessageBox.Show(this, _noFileSelectedText.Text, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            using (WaitCursorScope.Enter())
            {
                Skipped.Clear();

                if (PatchFileMode.Checked)
                {
                    var arguments = IsDiffFile(patchFile)
                        ? GitCommandHelpers.ApplyDiffPatchCmd(ignoreWhiteSpace, patchFile)
                        : GitCommandHelpers.ApplyMailboxPatchCmd(signOff, ignoreWhiteSpace, patchFile);

                    FormProcess.ShowDialog(this, process: null, arguments, Module.WorkingDir, input: null, useDialogSettings: true);
                }
                else
                {
                    var arguments = GitCommandHelpers.ApplyMailboxPatchCmd(signOff, ignoreWhiteSpace);

                    Module.ApplyPatch(dirText, arguments);
                }

                UICommands.RepoChangedNotifier.Notify();

                EnableButtons();

                if (!Module.InTheMiddleOfAction() && !Module.InTheMiddleOfPatch())
                {
                    Close();
                }
            }
        }
        private void Apply_Click(object sender, EventArgs e)
        {
            var patchFile        = PatchFile.Text;
            var dirText          = PatchDir.Text;
            var ignoreWhiteSpace = IgnoreWhitespace.Checked;

            if (string.IsNullOrEmpty(patchFile) && string.IsNullOrEmpty(dirText))
            {
                MessageBox.Show(this, _noFileSelectedText.Text);
                return;
            }

            using (WaitCursorScope.Enter())
            {
                if (PatchFileMode.Checked)
                {
                    var arguments = IsDiffFile(patchFile)
                        ? GitCommandHelpers.ApplyDiffPatchCmd(ignoreWhiteSpace, patchFile)
                        : GitCommandHelpers.ApplyMailboxPatchCmd(ignoreWhiteSpace, patchFile);

                    FormProcess.ShowDialog(this, arguments);
                }
                else
                {
                    var arguments = GitCommandHelpers.ApplyMailboxPatchCmd(ignoreWhiteSpace);

                    Module.ApplyPatch(dirText, arguments);
                }

                UICommands.RepoChangedNotifier.Notify();

                EnableButtons();

                if (!Module.InTheMiddleOfAction() && !Module.InTheMiddleOfPatch())
                {
                    Close();
                }
            }
        }
 public void ApplyMailboxPatchCmd(bool signOff, bool ignoreWhitespace, string patchFile, string expected)
 {
     Assert.AreEqual(
         expected,
         GitCommandHelpers.ApplyMailboxPatchCmd(signOff, ignoreWhitespace, patchFile).Arguments);
 }