Пример #1
0
        private bool CheckForRemoteRevision(string filename)
        {
            if (string.IsNullOrEmpty(Settings.Module.GetConflictedFileNames(filename)[2]))
            {
                string caption = string.Format(fileModifiedLocallyAndDelededRemotelyLong.Text,
                                               filename,
                                               GetLocalSideString(),
                                               GetRemoteSideString());

                var frm = new FormModifiedDeletedCreated(string.Format(keepModifiedButtonText.Text + " ({0})", GetLocalSideString()),
                                                         string.Format(deleteFileButtonText.Text + " ({0})", GetRemoteSideString()),
                                                         keepBaseButtonText.Text,
                                                         caption);
                frm.ShowDialog(this);
                if (frm.KeepBase) //base
                {
                    Settings.Module.HandleConflictSelectBase(GetFileName());
                }
                if (frm.KeepLocal) //delete
                {
                    Settings.Module.HandleConflictSelectLocal(GetFileName());
                }
                if (frm.KeepRemote) //remote
                {
                    Settings.Module.RunGitCmd("rm -- \"" + filename + "\"");
                }
                return(false);
            }
            return(true);
        }
        private void BinairyFilesChooseLocalBaseRemote(string filename)
        {
            string caption = string.Format(fileBinairyChooseLocalBaseRemote.Text,
                                           filename,
                                           GetLocalSideString(),
                                           GetRemoteSideString());

            using (var frm = new FormModifiedDeletedCreated(string.Format(chooseLocalButtonText.Text + " ({0})", GetLocalSideString()),
                                                            string.Format(chooseRemoteButtonText.Text + " ({0})", GetRemoteSideString()),
                                                            keepBaseButtonText.Text,
                                                            caption))
            {
                frm.ShowDialog(this);
                if (frm.KeepBase) //base
                {
                    ChooseBaseOnConflict(GetFileName());
                }
                if (frm.KeepLocal) //local
                {
                    ChooseLocalOnConflict(GetFileName());
                }
                if (frm.KeepRemote) //remote
                {
                    ChooseRemoteOnConflict(GetFileName());
                }
            }
        }
Пример #3
0
        private void BinairyFilesChooseLocalBaseRemote(string filename)
        {
            string caption = string.Format(fileBinairyChooseLocalBaseRemote.Text,
                                           filename,
                                           GetLocalSideString(),
                                           GetRemoteSideString());

            var frm = new FormModifiedDeletedCreated(string.Format(chooseLocalButtonText.Text + " ({0})", GetLocalSideString()),
                                                     string.Format(chooseRemoteButtonText.Text + " ({0})", GetRemoteSideString()),
                                                     keepBaseButtonText.Text,
                                                     caption);

            frm.ShowDialog(this);
            if (frm.KeepBase) //base
            {
                Settings.Module.HandleConflictSelectBase(GetFileName());
            }
            if (frm.KeepLocal) //local
            {
                Settings.Module.HandleConflictSelectLocal(GetFileName());
            }
            if (frm.KeepRemote) //remote
            {
                Settings.Module.HandleConflictSelectRemote(GetFileName());
            }
        }
        private bool CheckForLocalRevision(string filename)
        {
            if (string.IsNullOrEmpty(Module.GetConflictedFileNames(filename)[1]))
            {
                string caption = string.Format(fileDeletedLocallyAndModifiedRemotelyLong.Text,
                                               filename,
                                               GetLocalSideString(),
                                               GetRemoteSideString());

                using (var frm = new FormModifiedDeletedCreated(string.Format(deleteFileButtonText.Text + " ({0})", GetLocalSideString()),
                                                                string.Format(keepModifiedButtonText.Text + " ({0})", GetRemoteSideString()),
                                                                keepBaseButtonText.Text,
                                                                caption))
                {
                    frm.ShowDialog(this);
                    if (frm.KeepBase) //base
                    {
                        ChooseBaseOnConflict(GetFileName());
                    }
                    if (frm.KeepLocal) //delete
                    {
                        Module.RunGitCmd("rm -- \"" + filename + "\"");
                    }
                    if (frm.KeepRemote) //remote
                    {
                        ChooseRemoteOnConflict(GetFileName());
                    }
                }
                return(false);
            }
            return(true);
        }
Пример #5
0
        private bool CheckForBaseRevision(string filename)
        {
            if (string.IsNullOrEmpty(GitModule.Current.GetConflictedFileNames(filename)[0]))
            {
                string caption = string.Format(fileCreatedLocallyAndRemotelyLong.Text,
                                               filename,
                                               GetLocalSideString(),
                                               GetRemoteSideString());

                using (var frm = new FormModifiedDeletedCreated(string.Format(chooseLocalButtonText.Text + " ({0})", GetLocalSideString()),
                                                                string.Format(chooseRemoteButtonText.Text + " ({0})", GetRemoteSideString()),
                                                                deleteFileButtonText.Text,
                                                                caption))
                {
                    frm.ShowDialog(this);
                    if (frm.KeepBase) //delete
                    {
                        GitModule.Current.RunGitCmd("rm -- \"" + filename + "\"");
                    }
                    if (frm.KeepLocal) //local
                    {
                        GitModule.Current.HandleConflictSelectLocal(GetFileName());
                    }
                    if (frm.KeepRemote) //remote
                    {
                        GitModule.Current.HandleConflictSelectRemote(GetFileName());
                    }
                }
                return(false);
            }
            return(true);
        }
        private bool CheckForRemoteRevision(string filename)
        {
            if (string.IsNullOrEmpty(Settings.Module.GetConflictedFileNames(filename)[2]))
            {
                string caption = string.Format(fileModifiedLocallyAndDelededRemotelyLong.Text,
                                                filename,
                                                GetLocalSideString(),
                                                GetRemoteSideString());

                var frm = new FormModifiedDeletedCreated(string.Format(keepModifiedButtonText.Text + " ({0})", GetLocalSideString()),
                                                                                string.Format(deleteFileButtonText.Text + " ({0})", GetRemoteSideString()),
                                                                                keepBaseButtonText.Text,
                                                                                caption);
                frm.ShowDialog(this);
                if (frm.KeepBase) //base
                    Settings.Module.HandleConflictSelectBase(GetFileName());
                if (frm.KeepLocal) //delete
                    Settings.Module.HandleConflictSelectLocal(GetFileName());
                if (frm.KeepRemote) //remote
                    Settings.Module.RunGitCmd("rm -- \"" + filename + "\"");
                return false;
            }
            return true;
        }
        private void BinairyFilesChooseLocalBaseRemote(string filename)
        {
            string caption = string.Format(fileBinairyChooseLocalBaseRemote.Text,
                                            filename,
                                            GetLocalSideString(),
                                            GetRemoteSideString());

            var frm = new FormModifiedDeletedCreated(string.Format(chooseLocalButtonText.Text + " ({0})", GetLocalSideString()),
                                                                            string.Format(chooseRemoteButtonText.Text + " ({0})", GetRemoteSideString()),
                                                                            keepBaseButtonText.Text,
                                                                            caption);
            frm.ShowDialog(this);
            if (frm.KeepBase) //base
                Settings.Module.HandleConflictSelectBase(GetFileName());
            if (frm.KeepLocal) //local
                Settings.Module.HandleConflictSelectLocal(GetFileName());
            if (frm.KeepRemote) //remote
                Settings.Module.HandleConflictSelectRemote(GetFileName());
        }
Пример #8
0
        private void ConflictedFiles_DoubleClick(object sender, EventArgs e)
        {
            if (ConflictedFiles.SelectedRows.Count != 1)
                return;

            DataGridViewRow row = ConflictedFiles.SelectedRows[0];

            string filename = GitCommands.GitCommands.GetConflictedFiles(((GitItem)row.DataBoundItem).FileName);

            if (Directory.Exists(Settings.WorkingDir + filename) && !File.Exists(Settings.WorkingDir + filename))
            {
                List<GitSubmodule> submodules = GitCommands.GitCommands.GetSubmodules();
                foreach (GitSubmodule submodule in submodules)
                {
                    if (submodule.LocalPath.Equals(filename))
                    {
                        if (MessageBox.Show("The selected mergeconflict is a submodule. Mark conflict as resolved?", "Merge", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            GitCommands.GitCommands.RunCmd(Settings.GitDir + "git.cmd", "add -- \"" + filename + "\"");
                            Initialize();
                        }
                        return;
                    }
                }
            }

            bool file1 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".BASE");
            bool file2 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".LOCAL");
            bool file3 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".REMOTE");

            string arguments = mergetoolCmd;

            if (file1 && file2 && file3)
            {
                arguments = arguments.Replace("$BASE", filename + ".BASE");
                arguments = arguments.Replace("$LOCAL", filename + ".LOCAL");
                arguments = arguments.Replace("$REMOTE", filename + ".REMOTE");
                arguments = arguments.Replace("$MERGED", filename + "");

                GitCommands.GitCommands.RunCmd(mergetoolPath, "" + arguments + "");

                if (MessageBox.Show("Is the mergeconflict solved?", "Merge", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    GitCommands.GitCommands.RunCmd(Settings.GitDir + "git.cmd", "add -- \"" + filename + "\"");
                    Initialize();

                }
            }
            else
            {
                FormModifiedDeletedCreated frm = new FormModifiedDeletedCreated();
                if ((file1 && file2 && !file3) || (file1 && !file2 && file3))
                {
                    frm.Label.Text = "Use modified or deleted file?";
                    frm.Created.Text = "Modified";
                }
                else
                    if (!file1)
                    {
                        frm.Label.Text = "Use created or delete file?";
                    }
                    else
                    {
                        File.Delete(Settings.WorkingDir + filename + ".BASE");
                        File.Delete(Settings.WorkingDir + filename + ".LOCAL");
                        File.Delete(Settings.WorkingDir + filename + ".REMOTE");

                        Directory.SetCurrentDirectory(GitCommands.Settings.WorkingDir);
                        GitCommands.GitCommands.RunRealCmd(GitCommands.Settings.GitDir + "git.cmd", "mergetool \"" + filename + "\"");
                        Initialize();
                        return;
                    }

                frm.ShowDialog();

                if (frm.Aborted)
                {
                    File.Delete(Settings.WorkingDir + filename + ".BASE");
                    File.Delete(Settings.WorkingDir + filename + ".LOCAL");
                    File.Delete(Settings.WorkingDir + filename + ".REMOTE");
                    return;
                }
                else
                    if (frm.Delete)
                        GitCommands.GitCommands.RunCmd(Settings.GitDir + "git.cmd", "rm -- \"" + filename + "\"");
                    else
                        if (!frm.Delete)
                            GitCommands.GitCommands.RunCmd(Settings.GitDir + "git.cmd", "add -- \"" + filename + "\"");

                Initialize();
            }

            File.Delete(Settings.WorkingDir + filename + ".BASE");
            File.Delete(Settings.WorkingDir + filename + ".LOCAL");
            File.Delete(Settings.WorkingDir + filename + ".REMOTE");
        }
        private bool CheckForLocalRevision(string filename)
        {
            if (string.IsNullOrEmpty(GitCommandHelpers.GetConflictedFileNames(filename)[1]))
            {
                string caption = string.Format(fileDeletedLocallyAndModifiedRemotelyLong.Text,
                                                filename,
                                                GetLocalSideString(),
                                                GetRemoteSideString());

                FormModifiedDeletedCreated frm = new FormModifiedDeletedCreated(string.Format(deleteFileButtonText.Text + " ({0})", GetLocalSideString()),
                                                                                string.Format(keepModifiedButtonText.Text + " ({0})", GetRemoteSideString()),
                                                                                keepBaseButtonText.Text,
                                                                                caption);
                frm.ShowDialog();
                if (frm.KeepBase) //base
                    GitCommandHelpers.HandleConflictSelectBase(GetFileName());
                if (frm.KeepLocal) //delete
                    GitCommandHelpers.RunCmd(Settings.GitCommand, "rm -- \"" + filename + "\"");
                if (frm.KeepRemote) //remote
                    GitCommandHelpers.HandleConflictSelectRemote(GetFileName());
                return false;
            }
            return true;
        }
        private void ConflictedFiles_DoubleClick(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (ConflictedFiles.SelectedRows.Count != 1)
                return;

            string filename = GitCommands.GitCommands.GetConflictedFiles(GetFileName());

            if (Directory.Exists(Settings.WorkingDir + filename) && !File.Exists(Settings.WorkingDir + filename))
            {
                IList<IGitSubmodule> submodules = (new GitCommands.GitCommands()).GetSubmodules();
                foreach (IGitSubmodule submodule in submodules)
                {
                    if (submodule.LocalPath.Equals(filename))
                    {
                        if (MessageBox.Show("The selected mergeconflict is a submodule. Mark conflict as resolved?", "Merge", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            GitCommands.GitCommands.RunCmd(Settings.GitCommand, "add -- \"" + filename + "\"");
                            Initialize();
                        }
                        return;
                    }
                }
            }

            bool file1 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".BASE");
            bool file2 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".LOCAL");
            bool file3 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".REMOTE");

            string arguments = mergetoolCmd;

            if (file1 && file2 && file3)
            {
                if (FileHelper.IsBinaryFile(filename))
                {
                    if (MessageBox.Show("The selected file appears to be a binary file." + Environment.NewLine + "Are you sure you want to open this file in " + mergetool + "?") == DialogResult.No)
                        return;
                }

                arguments = arguments.Replace("$BASE", filename + ".BASE");
                arguments = arguments.Replace("$LOCAL", filename + ".LOCAL");
                arguments = arguments.Replace("$REMOTE", filename + ".REMOTE");
                arguments = arguments.Replace("$MERGED", filename + "");

                GitCommands.GitCommands.RunCmd(mergetoolPath, "" + arguments + "");

                if (MessageBox.Show("Is the mergeconflict solved?", "Merge", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    GitCommands.GitCommands.RunCmd(Settings.GitCommand, "add -- \"" + filename + "\"");
                    Initialize();

                }
            }
            else
            {
                FormModifiedDeletedCreated frm = new FormModifiedDeletedCreated();
                if ((file1 && file2 && !file3) || (file1 && !file2 && file3))
                {
                    frm.Label.Text = "Use modified or deleted file?";
                    frm.Created.Text = "Modified";
                }
                else
                    if (!file1)
                    {
                        frm.Label.Text = "Use created or delete file?";
                    }
                    else
                    {
                        File.Delete(Settings.WorkingDir + filename + ".BASE");
                        File.Delete(Settings.WorkingDir + filename + ".LOCAL");
                        File.Delete(Settings.WorkingDir + filename + ".REMOTE");

                        Directory.SetCurrentDirectory(GitCommands.Settings.WorkingDir);
                        GitCommands.GitCommands.RunRealCmd(GitCommands.Settings.GitCommand, "mergetool \"" + filename + "\"");
                        Initialize();
                        return;
                    }

                frm.ShowDialog();

                if (frm.Aborted)
                {
                    File.Delete(Settings.WorkingDir + filename + ".BASE");
                    File.Delete(Settings.WorkingDir + filename + ".LOCAL");
                    File.Delete(Settings.WorkingDir + filename + ".REMOTE");
                    return;
                }
                else
                    if (frm.Delete)
                        GitCommands.GitCommands.RunCmd(Settings.GitCommand, "rm -- \"" + filename + "\"");
                    else
                        if (!frm.Delete)
                            GitCommands.GitCommands.RunCmd(Settings.GitCommand, "add -- \"" + filename + "\"");

                Initialize();
            }

            File.Delete(Settings.WorkingDir + filename + ".BASE");
            File.Delete(Settings.WorkingDir + filename + ".LOCAL");
            File.Delete(Settings.WorkingDir + filename + ".REMOTE");
        }
Пример #11
0
        private void ConflictedFiles_DoubleClick(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (ConflictedFiles.SelectedRows.Count != 1)
                return;

            string filename = GitCommands.GitCommands.GetConflictedFiles(GetFileName());

            if (Directory.Exists(Settings.WorkingDir + filename) && !File.Exists(Settings.WorkingDir + filename))
            {
                IList<IGitSubmodule> submodules = (new GitCommands.GitCommands()).GetSubmodules();
                foreach (IGitSubmodule submodule in submodules)
                {
                    if (submodule.LocalPath.Equals(filename))
                    {
                        if (MessageBox.Show(mergeConflictIsSubmodule.Text, mergeConflictIsSubmoduleCaption.Text, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            GitCommands.GitCommands.RunCmd(Settings.GitCommand, "add -- \"" + filename + "\"");
                            Initialize();
                        }
                        return;
                    }
                }
            }

            bool file1 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".BASE");
            bool file2 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".LOCAL");
            bool file3 = File.Exists(GitCommands.Settings.WorkingDir + filename + ".REMOTE");

            string arguments = mergetoolCmd;

            if (file1 && file2 && file3)
            {
                if (FileHelper.IsBinaryFile(filename))
                {
                    if (MessageBox.Show(string.Format(fileIsBinary.Text, mergetool)) == DialogResult.No)
                        return;
                }

                arguments = arguments.Replace("$BASE", filename + ".BASE");
                arguments = arguments.Replace("$LOCAL", filename + ".LOCAL");
                arguments = arguments.Replace("$REMOTE", filename + ".REMOTE");
                arguments = arguments.Replace("$MERGED", filename + "");

                GitCommands.GitCommands.RunCmd(mergetoolPath, "" + arguments + "");

                if (MessageBox.Show(askMergeConflictSolved.Text, askMergeConflictSolvedCaption.Text, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    GitCommands.GitCommands.RunCmd(Settings.GitCommand, "add -- \"" + filename + "\"");
                    Initialize();

                }
            }
            else
            {
                FormModifiedDeletedCreated frm = new FormModifiedDeletedCreated();
                if ((file1 && file2 && !file3) || (file1 && !file2 && file3))
                {
                    frm.Label.Text = useModifiedOrDeletedFile.Text;
                    frm.Created.Text = modifiedButton.Text;
                }
                else
                    if (!file1)
                    {
                        frm.Label.Text = useCreatedOrDeletedFile.Text;
                    }
                    else
                    {
                        File.Delete(Settings.WorkingDir + filename + ".BASE");
                        File.Delete(Settings.WorkingDir + filename + ".LOCAL");
                        File.Delete(Settings.WorkingDir + filename + ".REMOTE");

                        Directory.SetCurrentDirectory(GitCommands.Settings.WorkingDir);
                        GitCommands.GitCommands.RunRealCmd(GitCommands.Settings.GitCommand, "mergetool \"" + filename + "\"");
                        Initialize();
                        return;
                    }

                frm.ShowDialog();

                if (frm.Aborted)
                {
                    File.Delete(Settings.WorkingDir + filename + ".BASE");
                    File.Delete(Settings.WorkingDir + filename + ".LOCAL");
                    File.Delete(Settings.WorkingDir + filename + ".REMOTE");
                    return;
                }
                else
                    if (frm.Delete)
                        GitCommands.GitCommands.RunCmd(Settings.GitCommand, "rm -- \"" + filename + "\"");
                    else
                        if (!frm.Delete)
                            GitCommands.GitCommands.RunCmd(Settings.GitCommand, "add -- \"" + filename + "\"");

                Initialize();
            }

            File.Delete(Settings.WorkingDir + filename + ".BASE");
            File.Delete(Settings.WorkingDir + filename + ".LOCAL");
            File.Delete(Settings.WorkingDir + filename + ".REMOTE");
        }
Пример #12
0
        private bool CheckForBaseRevision(string filename)
        {
            if (string.IsNullOrEmpty(Module.GetConflictedFileNames(filename)[0]))
            {
                string caption = string.Format(fileCreatedLocallyAndRemotelyLong.Text,
                                                filename,
                                                GetLocalSideString(),
                                                GetRemoteSideString());

                using (var frm = new FormModifiedDeletedCreated(string.Format(chooseLocalButtonText.Text + " ({0})", GetLocalSideString()),
                                                                                string.Format(chooseRemoteButtonText.Text + " ({0})", GetRemoteSideString()),
                                                                                deleteFileButtonText.Text,
                                                                                caption))
                {
                    frm.ShowDialog(this);
                    if (frm.KeepBase) //delete
                        Module.RunGitCmd("rm -- \"" + filename + "\"");
                    if (frm.KeepLocal) //local
                        Module.HandleConflictSelectLocal(GetFileName());
                    if (frm.KeepRemote) //remote
                        Module.HandleConflictSelectRemote(GetFileName());
                }
                return false;
            }
            return true;
        }
        private void ConflictedFiles_DoubleClick(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (ConflictedFiles.SelectedRows.Count != 1)
                return;

            string filename = GetFileName();
            string[] filenames = GitCommands.GitCommands.GetConflictedFiles(filename);

            if (Directory.Exists(Settings.WorkingDir + filename) && !File.Exists(Settings.WorkingDir + filename))
            {
                /* BEGIN REPLACED WITH FASTER, BUT DIRTIER SUBMODULE CHECK
                IList<IGitSubmodule> submodules = (new GitCommands.GitCommands()).GetSubmodules();
                foreach (IGitSubmodule submodule in submodules)
                {
                    if (submodule.LocalPath.Equals(filename))
                    {
                        if (MessageBox.Show(mergeConflictIsSubmodule.Text, mergeConflictIsSubmoduleCaption.Text, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            stageFile(filename);
                            Initialize();
                        }
                        return;
                    }
                }*/
                ConfigFile submoduleConfig = new ConfigFile(Settings.WorkingDir + ".gitmodules");
                foreach (ConfigSection configSection in submoduleConfig.GetConfigSections())
                {
                    if (configSection.GetValue("path").Trim().Equals(filename.Trim()))
                    {
                        if (MessageBox.Show(mergeConflictIsSubmodule.Text, mergeConflictIsSubmoduleCaption.Text, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            stageFile(filename);
                            Initialize();
                        }
                        return;
                    }
                }
                //END: REPLACED WITH FASTER, BUT DIRTIER SUBMODULE CHECK
            }

            bool file1 = File.Exists(filenames[0]);
            bool file2 = File.Exists(filenames[1]);
            bool file3 = File.Exists(filenames[2]);

            string arguments = mergetoolCmd;

            if (file1 && file2 && file3)
            {
                if (FileHelper.IsBinaryFile(filename))
                {
                    if (MessageBox.Show(string.Format(fileIsBinary.Text, mergetool)) == DialogResult.No)
                        return;
                }

                arguments = arguments.Replace("$BASE", filenames[0]);
                arguments = arguments.Replace("$LOCAL", filenames[1]);
                arguments = arguments.Replace("$REMOTE", filenames[2]);
                arguments = arguments.Replace("$MERGED", filename + "");

                GitCommands.GitCommands.RunCmd(mergetoolPath, "" + arguments + "");

                if (MessageBox.Show(askMergeConflictSolved.Text, askMergeConflictSolvedCaption.Text, MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    stageFile(filename);
                    Initialize();
                }
            }
            else
            {
                FormModifiedDeletedCreated frm = new FormModifiedDeletedCreated();
                if ((file1 && file2 && !file3) || (file1 && !file2 && file3))
                {
                    frm.Label.Text = useModifiedOrDeletedFile.Text;
                    frm.Created.Text = modifiedButton.Text;
                }
                else
                    if (!file1)
                    {
                        frm.Label.Text = useCreatedOrDeletedFile.Text;
                    }
                    else
                    {
                        if (File.Exists(filenames[0]))
                            File.Delete(filenames[0]);
                        if (File.Exists(filenames[1]))
                            File.Delete(filenames[1]);
                        if (File.Exists(filenames[2]))
                            File.Delete(filenames[2]);

                        Directory.SetCurrentDirectory(GitCommands.Settings.WorkingDir);
                        GitCommands.GitCommands.RunRealCmd(GitCommands.Settings.GitCommand, "mergetool \"" + filename + "\"");
                        Initialize();
                        return;
                    }

                frm.ShowDialog();

                if (frm.Aborted)
                {
                    if (File.Exists(filenames[0]))
                        File.Delete(filenames[0]);
                    if (File.Exists(filenames[1]))
                        File.Delete(filenames[1]);
                    if (File.Exists(filenames[2]))
                        File.Delete(filenames[2]);
                    return;
                }
                else
                    if (frm.Delete)
                        GitCommands.GitCommands.RunCmd(Settings.GitCommand, "rm -- \"" + filename + "\"");
                    else
                        if (!frm.Delete)
                            stageFile(filename);

                Initialize();
            }

            if (File.Exists(filenames[0]))
                File.Delete(filenames[0]);
            if (File.Exists(filenames[1]))
                File.Delete(filenames[1]);
            if (File.Exists(filenames[2]))
                File.Delete(filenames[2]);
            Cursor.Current = Cursors.Default;
        }
        private void BinairyFilesChooseLocalBaseRemote(string filename)
        {
            string caption = string.Format(fileBinairyChooseLocalBaseRemote.Text,
                                            filename,
                                            GetLocalSideString(),
                                            GetRemoteSideString());

            using (var frm = new FormModifiedDeletedCreated(string.Format(chooseLocalButtonText.Text + " ({0})", GetLocalSideString()),
                                                                            string.Format(chooseRemoteButtonText.Text + " ({0})", GetRemoteSideString()),
                                                                            keepBaseButtonText.Text,
                                                                            caption))
            {
                frm.ShowDialog(this);
                if (frm.KeepBase) //base
                    ChooseBaseOnConflict(GetFileName());
                if (frm.KeepLocal) //local
                    ChooseLocalOnConflict(GetFileName());
                if (frm.KeepRemote) //remote
                    ChooseRemoteOnConflict(GetFileName());
            }
        }