当前位置: 首页>>代码示例>>C#>>正文


C# GitCommands.GitCommands类代码示例

本文整理汇总了C#中GitCommands.GitCommands的典型用法代码示例。如果您正苦于以下问题:C# GitCommands类的具体用法?C# GitCommands怎么用?C# GitCommands使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GitCommands类属于GitCommands命名空间,在下文中一共展示了GitCommands类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FormatPatch_Click

        private void FormatPatch_Click(object sender, EventArgs e)
        {
            string rev1 = "";
            string rev2 = "";

            if (RevisionGrid.GetRevisions().Count > 0)
            {
                {
                    rev1 = RevisionGrid.GetRevisions()[0].ParentGuids[0];
                    rev2 = RevisionGrid.GetRevisions()[0].Guid;
                }

                if (RevisionGrid.GetRevisions().Count == 2)
                {
                    rev1 = RevisionGrid.GetRevisions()[0].ParentGuids[0];
                    rev2 = RevisionGrid.GetRevisions()[1].Guid;
                }
            }
            if (string.IsNullOrEmpty(rev1) || string.IsNullOrEmpty(rev2))
            {
                MessageBox.Show("You need to select 2 revisions", "Patch error");
                return;
            }

            string result = new GitCommands.GitCommands().FormatPatch(rev1, rev2, OutputPath.Text);

            MessageBox.Show(result, "Patch result");
        }
开发者ID:OldPaladin,项目名称:gitextensions,代码行数:28,代码来源:FormFormatPath.cs

示例2: Execute

        public void Execute()
        {
            Revisions = new List<GitRevision>();

            heads = GitCommands.GetHeads(true);

            if (!LogParam.Contains("=") && Settings.ShowRevisionGraph)
                LogParam = " --graph " + LogParam;

            if (Settings.OrderRevisionByDate)
                LogParam = " --date-order " + LogParam;

            string dateFormat;
            if (Settings.RelativeDate)
                dateFormat = "%cr";
            else
                dateFormat = "%cd";

            gitGetGraphCommand = new GitCommands();
            gitGetGraphCommand.CollectOutput = false;
            gitGetGraphCommand.CmdStartProcess(Settings.GitDir + "git.cmd", "log -n " + LimitRevisions + " --pretty=format:\"Commit %H %nTree:   %T%nAuthor: %aN %nDate:   " + dateFormat + " %nParents:%P %n%s\" " + LogParam);

            gitGetGraphCommand.DataReceived += new System.Diagnostics.DataReceivedEventHandler(gitGetGraphCommand_DataReceived);
            gitGetGraphCommand.Exited += new EventHandler(gitGetGraphCommand_Exited);
        }
开发者ID:rzeng,项目名称:gitextensions,代码行数:25,代码来源:RevisionGraph.cs

示例3: Execute

        public void Execute()
        {
            Revisions = new List<GitRevision>();

            heads = GitCommands.GetHeads(true);

            gitGetGraphCommand = new GitCommands();
            gitGetGraphCommand.CollectOutput = false;
            gitGetGraphCommand.CmdStartProcess(Settings.GitDir + "git.cmd", "log -n " + LimitRevisions + " --graph --all --pretty=format:\"Commit %H %nTree:   %T%nAuthor: %aN %nDate:   %cd %nParents:%P %n%s\"");

            gitGetGraphCommand.DataReceived += new System.Diagnostics.DataReceivedEventHandler(gitGetGraphCommand_DataReceived);
            gitGetGraphCommand.Exited += new EventHandler(gitGetGraphCommand_Exited);
        }
开发者ID:arBmind,项目名称:gitextensions,代码行数:13,代码来源:RevisionGraph.cs

示例4: SolveKDiff

        public static bool SolveKDiff()
        {
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
            string mergeTool = gitCommands.GetGlobalSetting("merge.tool");
            if (string.IsNullOrEmpty(mergeTool))
            {
                mergeTool = "kdiff3";
                gitCommands.SetGlobalSetting("merge.tool", mergeTool);
            }

            if (mergeTool.Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
                return SolveKDiffPath(gitCommands);

            return true;
        }
开发者ID:bleis-tift,项目名称:gitextensions,代码行数:15,代码来源:FormSettings.cs

示例5: FormatPatch_Click

        private void FormatPatch_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(OutputPath.Text))
                MessageBox.Show("You need to enter an output path.");

            string rev1 = "";
            string rev2 = "";
            string result = "";

            if (RevisionGrid.GetRevisions().Count > 0)
            {
                if (RevisionGrid.GetRevisions().Count == 1)
                {
                    rev1 = RevisionGrid.GetRevisions()[0].ParentGuids[0];
                    rev2 = RevisionGrid.GetRevisions()[0].Guid;
                    result = new GitCommands.GitCommands().FormatPatch(rev1, rev2, OutputPath.Text);
                }

                if (RevisionGrid.GetRevisions().Count == 2)
                {
                    rev1 = RevisionGrid.GetRevisions()[0].ParentGuids[0];
                    rev2 = RevisionGrid.GetRevisions()[1].Guid;
                    result = new GitCommands.GitCommands().FormatPatch(rev1, rev2, OutputPath.Text);
                }

                if (RevisionGrid.GetRevisions().Count > 2)
                {
                    int n = 0;
                    foreach (GitRevision revision in RevisionGrid.GetRevisions())
                    {
                        n++;
                        rev1 = revision.ParentGuids[0];
                        rev2 = revision.Guid;
                        result += new GitCommands.GitCommands().FormatPatch(rev1, rev2, OutputPath.Text, n);
                    }
                }
            } else
            if (string.IsNullOrEmpty(rev1) || string.IsNullOrEmpty(rev2))
            {
                MessageBox.Show("You need to select 2 revisions", "Patch error");
                return;
            }

            MessageBox.Show(result, "Patch result");
            Close();
        }
开发者ID:jorn,项目名称:gitextensions,代码行数:46,代码来源:FormFormatPath.cs

示例6: Execute

        public void Execute()
        {
            Revisions = new List<GitRevision>();

            heads = GitCommands.GetHeads(true);

            if (!LogParam.Contains("=") && Settings.ShowRevisionGraph)
                LogParam = " --graph " + LogParam;

            if (Settings.OrderRevisionByDate)
                LogParam = " --date-order " + LogParam;

            string dateFormat;
            if (Settings.RelativeDate)
                dateFormat = "r";
            else
                dateFormat = "d";

            string limitRevisionsArgument;
            if (LogParam.Contains("--follow"))
                limitRevisionsArgument = "";
            else
                limitRevisionsArgument = " -n " + LimitRevisions;

            string arguments = String.Format(CultureInfo.InvariantCulture,
                "log{0} --pretty=format:\"Commit %H %nTree: %T %nAuthor: %aN %nAuthorDate: %a{1} %nCommitter: %cN %nCommitDate: %c{1} %nParents: %P %n%s\" {2}",
                limitRevisionsArgument,
                dateFormat,
                LogParam);

            gitGetGraphCommand = new GitCommands();
            gitGetGraphCommand.CollectOutput = false;
            gitGetGraphCommand.CmdStartProcess(Settings.GitCommand, arguments);

            gitGetGraphCommand.DataReceived += new System.Diagnostics.DataReceivedEventHandler(gitGetGraphCommand_DataReceived);
            gitGetGraphCommand.Exited += new EventHandler(gitGetGraphCommand_Exited);
        }
开发者ID:spidercat,项目名称:gitextensions,代码行数:37,代码来源:RevisionGraph.cs

示例7: Save

        private bool Save()
        {
            GitCommands.Settings.FollowRenamesInFileHistory = FollowRenamesInFileHistory.Checked;

            GitCommands.Settings.Smtp = SmtpServer.Text;

            GitCommands.Settings.GitDir = GitPath.Text;
            GitCommands.Settings.GitBinDir = GitBinPath.Text;

            GitCommands.Settings.CloseProcessDialog = CloseProcessDialog.Checked;
            GitCommands.Settings.ShowRevisionGraph = ShowRevisionGraph.Checked;
            GitCommands.Settings.ShowGitCommandLine = ShowGitCommandLine.Checked;

            GitCommands.Settings.UseFastChecks = UseFastChecks.Checked;
            GitCommands.Settings.RelativeDate = ShowRelativeDate.Checked;

            GitCommands.Settings.Dictionary = Dictionary.Text;

            GitCommands.Settings.MaxCommits = (int)MaxCommits.Value;

            GitCommands.Settings.Plink = PlinkPath.Text;
            GitCommands.Settings.Puttygen = PuttygenPath.Text;
            GitCommands.Settings.Pageant = PageantPath.Text;
            GitCommands.Settings.AutoStartPageant = AutostartPageant.Checked;

            if (string.IsNullOrEmpty(Encoding.Text) || Encoding.Text.Equals("Default", StringComparison.CurrentCultureIgnoreCase))
                GitCommands.Settings.Encoding = System.Text.Encoding.Default;
            else
                if (Encoding.Text.Equals("ASCII", StringComparison.CurrentCultureIgnoreCase))
                    GitCommands.Settings.Encoding = new ASCIIEncoding();
                else
                    if (Encoding.Text.Equals("Unicode", StringComparison.CurrentCultureIgnoreCase))
                        GitCommands.Settings.Encoding = new UnicodeEncoding();
                    else
                        if (Encoding.Text.Equals("UTF7", StringComparison.CurrentCultureIgnoreCase))
                            GitCommands.Settings.Encoding = new UTF7Encoding();
                        else
                            if (Encoding.Text.Equals("UTF8", StringComparison.CurrentCultureIgnoreCase))
                                GitCommands.Settings.Encoding = new UTF8Encoding(false);
                            else
                                if (Encoding.Text.Equals("UTF32", StringComparison.CurrentCultureIgnoreCase))
                                    GitCommands.Settings.Encoding = new UTF32Encoding(true, false);
                                else
                                    GitCommands.Settings.Encoding = System.Text.Encoding.Default;

            Settings.RevisionGraphColor = RevisionGraphColorLabel.BackColor;
            Settings.RevisionGraphColorSelected = RevisionGraphColorSelected.BackColor;
            Settings.TagColor = ColorTagLabel.BackColor;
            Settings.BranchColor = ColorBranchLabel.BackColor;
            Settings.RemoteBranchColor = ColorRemoteBranchLabel.BackColor;
            Settings.OtherTagColor = ColorOtherLabel.BackColor;

            Settings.DiffAddedColor = ColorAddedLineLabel.BackColor;
            Settings.DiffRemovedColor = ColorRemovedLine.BackColor;
            Settings.DiffSectionColor = ColorSectionLabel.BackColor;

            EnableSettings();

            if (!CanFindGitCmd())
            {
                if (MessageBox.Show("The path to git.cmd is not configured correct." + Environment.NewLine + "You need to set the correct path to be able to use GitExtensions." + Environment.NewLine + Environment.NewLine + "Do you want to set the correct path now?", "Incorrect path", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    return false;
            }
            else
            {
                GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();

                if (string.IsNullOrEmpty(UserName.Text) || !UserName.Text.Equals(GitCommands.GitCommands.GetSetting("user.name")))
                    GitCommands.GitCommands.SetSetting("user.name", UserName.Text);
                if (string.IsNullOrEmpty(UserEmail.Text) || !UserEmail.Text.Equals(GitCommands.GitCommands.GetSetting("user.email")))
                    GitCommands.GitCommands.SetSetting("user.email", UserEmail.Text);
                GitCommands.GitCommands.SetSetting("core.editor", Editor.Text);
                GitCommands.GitCommands.SetSetting("merge.tool", MergeTool.Text);

                if (KeepMergeBackup.CheckState == CheckState.Checked)
                    GitCommands.GitCommands.SetSetting("mergetool.keepBackup", "true");
                else
                    if (KeepMergeBackup.CheckState == CheckState.Unchecked)
                        GitCommands.GitCommands.SetSetting("mergetool.keepBackup", "false");

                GitCommands.GitCommands.SetSetting("core.autocrlf", LocalAutoCRLF.SelectedItem as string);

                if (string.IsNullOrEmpty(GlobalUserName.Text) || !GlobalUserName.Text.Equals(gitCommands.GetGlobalSetting("user.name")))
                    gitCommands.SetGlobalSetting("user.name", GlobalUserName.Text);
                if (string.IsNullOrEmpty(GlobalUserEmail.Text) || !GlobalUserEmail.Text.Equals(gitCommands.GetGlobalSetting("user.email")))
                    gitCommands.SetGlobalSetting("user.email", GlobalUserEmail.Text);
                gitCommands.SetGlobalSetting("core.editor", GlobalEditor.Text);
                gitCommands.SetGlobalSetting("merge.tool", GlobalMergeTool.Text);

                if (!string.IsNullOrEmpty(GlobalMergeTool.Text))
                    gitCommands.SetGlobalSetting("mergetool." + GlobalMergeTool.Text + ".path", MergetoolPath.Text);
                if (!string.IsNullOrEmpty(GlobalMergeTool.Text))
                    gitCommands.SetGlobalSetting("mergetool." + GlobalMergeTool.Text + ".cmd", MergeToolCmd.Text);

                if (GlobalKeepMergeBackup.CheckState == CheckState.Checked)
                    gitCommands.SetGlobalSetting("mergetool.keepBackup", "true");
                else
                    if (GlobalKeepMergeBackup.CheckState == CheckState.Unchecked)
                        gitCommands.SetGlobalSetting("mergetool.keepBackup", "false");

//.........这里部分代码省略.........
开发者ID:PProvost,项目名称:gitextensions,代码行数:101,代码来源:FormSettings.cs

示例8: execute

        private void execute()
        {
            lock (revisions)
            {
                revisions.Clear();
            }

            heads = GitCommands.GetHeads(true);

            string formatString =
                /* <COMMIT>       */ COMMIT_BEGIN + "%n" +
                /* Hash           */ "%H%n" +
                /* Parents        */ "%P%n";
            if (!ShaOnly)
            {
                formatString +=
                    /* Tree           */ "%T%n" +
                    /* Author Name    */ "%aN%n" +
                    /* Author Date    */ "%ai%n" +
                    /* Committer Name */ "%cN%n" +
                    /* Committer Date */ "%ci%n" +
                    /* Commit Message */ "%s";
            }

            // NOTE:
            // when called from FileHistory and FollowRenamesInFileHistory is enabled the "--name-only" argument is set.
            // the filename is the next line after the commit-format defined above.

            if (Settings.OrderRevisionByDate)
            {
                LogParam = " --date-order " + LogParam;
            }
            else
            {
                LogParam = " --topo-order " + LogParam;
            }

            string arguments = String.Format(CultureInfo.InvariantCulture,
                "log -z {2} --pretty=format:\"{1}\" {0}",
                LogParam,
                formatString,
                BranchFilter);

            gitGetGraphCommand = new GitCommands();
            gitGetGraphCommand.StreamOutput = true;
            gitGetGraphCommand.CollectOutput = false;
            Process p = gitGetGraphCommand.CmdStartProcess(Settings.GitCommand, arguments);

            string line;
            do
            {
                line = p.StandardOutput.ReadLine();

                if (line != null)
                {
                    foreach (string entry in line.Split('\0'))
                    {
                        dataReceived(entry);
                    }
                }
            } while (line != null);
            finishRevision();

            Exited(this, new EventArgs());
        }
开发者ID:meaney,项目名称:gitextensions,代码行数:65,代码来源:RevisionGraph.cs

示例9: LoadRevisions

        private void LoadRevisions()
        {
            if (RevisionList == null)
            {
                return;
            }

            if (RevisionList != null && (RevisionList.Count == 0 && string.IsNullOrEmpty(Filter)))
            {
                Loading.Visible = false;
                NoCommits.Visible = true;
                Revisions.Visible = false;
                return;
            }

            Revisions.SuspendLayout();
            Revisions.Columns[3].HeaderText = Settings.ShowAuthorDate ? "Author Date" : "Commit Date";

            if (!ScrollBarSet)
            {
                ScrollBarSet = true;
                Revisions.ScrollBars = ScrollBars.None;
                Revisions.RowCount = RevisionList.Count;
                Revisions.ScrollBars = ScrollBars.Vertical;

                if (RevisionList.Count >= GitCommands.Settings.MaxCommits)
                {
                    string grep = "";
                    if (!string.IsNullOrEmpty(Filter))
                        grep = " --grep=\"" + Filter + "\" ";

                    gitCountCommitsCommand = new GitCommands.GitCommands();
                    gitCountCommitsCommand.CmdStartProcess("cmd.exe", "/c \"\"" + Settings.GitCommand + "\" rev-list " + grep + LogParam + " | \"" + Settings.GitBinDir + "wc\" -l\"");
                    gitCountCommitsCommand.Exited += new EventHandler(gitCountCommitsCommand_Exited);
                }

            }

            Revisions.SelectionChanged -= new EventHandler(Revisions_SelectionChanged);

            if (LastScrollPos > 0 && Revisions.RowCount > LastScrollPos)
            {
                Revisions.FirstDisplayedScrollingRowIndex = LastScrollPos;
                LastScrollPos = -1;
            }

            if (LastSelectedRows.Count > 0)
            {
                Revisions.ClearSelection();

                if (Revisions.Rows.Count > LastSelectedRows[0])
                    Revisions.CurrentCell = Revisions.Rows[LastSelectedRows[0]].Cells[0];

                foreach (int row in LastSelectedRows)
                {
                    if (Revisions.Rows.Count > row)
                    {
                        Revisions.Rows[row].Selected = true;
                    }
                }
                LastSelectedRows.Clear();
            }

            DrawVisibleGraphPart();

            Loading.Visible = false;
            Revisions.Enabled = true;
            Revisions.Focus();
            Revisions.SelectionChanged += new EventHandler(Revisions_SelectionChanged);

            Revisions.ResumeLayout();

            if (initialLoad)
            {
                initialLoad = false;
                SelecctionTimer.Enabled = false;
                SelecctionTimer.Stop();
                SelecctionTimer.Enabled = true;
                SelecctionTimer.Start();
            }
        }
开发者ID:bszafko,项目名称:gitextensions,代码行数:81,代码来源:RevisionGrid.cs

示例10: InitMergetool

        private void InitMergetool()
        {
            Cursor.Current = Cursors.WaitCursor;
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();

            mergetool = GitCommands.GitCommands.GetSetting("merge.tool");
            if (string.IsNullOrEmpty(mergetool))
                mergetool = gitCommands.GetGlobalSetting("merge.tool");

            if (string.IsNullOrEmpty(mergetool))
            {
                MessageBox.Show(noMergeTool.Text);
                return;
            }

            mergetoolCmd = GitCommands.GitCommands.GetSetting("mergetool." + mergetool + ".cmd");
            if (string.IsNullOrEmpty(mergetoolCmd))
                mergetoolCmd = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".cmd");

            mergetoolPath = GitCommands.GitCommands.GetSetting("mergetool." + mergetool + ".path");
            if (string.IsNullOrEmpty(mergetoolPath))
                mergetoolPath = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".path");

            if (string.IsNullOrEmpty(mergetool) || mergetool == "kdiff3")
                mergetoolCmd = mergetoolPath + " \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\"";

            mergetoolPath = mergetoolCmd.Substring(0, mergetoolCmd.IndexOf(".exe") + 5).Trim(new char[]{'\"', ' '});
            mergetoolCmd = mergetoolCmd.Substring(mergetoolCmd.IndexOf(".exe") + 5);
        }
开发者ID:alexeik,项目名称:gitextensions,代码行数:29,代码来源:FormResolveConflicts.cs

示例11: GlobalMergeTool_TextChanged

        private void GlobalMergeTool_TextChanged(object sender, EventArgs e)
        {
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
            MergetoolPath.Text = gitCommands.GetGlobalSetting("mergetool." + GlobalMergeTool.Text.Trim() + ".path");
            MergeToolCmd.Text = gitCommands.GetGlobalSetting("mergetool." + GlobalMergeTool.Text.Trim() + ".cmd");

            button1_Click_1(null, null);
        }
开发者ID:PProvost,项目名称:gitextensions,代码行数:8,代码来源:FormSettings.cs

示例12: button1_Click_1

        private void button1_Click_1(object sender, EventArgs e)
        {
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();

            if (GlobalMergeTool.Text.Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
            {
                MergeToolCmd.Text = "";

                string kdiff3path = gitCommands.GetGlobalSetting("mergetool.kdiff3.path");
                if (!kdiff3path.Contains("kdiff3.exe"))
                    kdiff3path = "";
                if (string.IsNullOrEmpty(kdiff3path) || !File.Exists(kdiff3path))
                {
                    kdiff3path = @"c:\Program Files\KDiff3\kdiff3.exe";
                    if (string.IsNullOrEmpty(kdiff3path) || !File.Exists(kdiff3path))
                    {
                        kdiff3path = @"c:\Program Files (x86)\KDiff3\kdiff3.exe";
                        if (string.IsNullOrEmpty(kdiff3path) || !File.Exists(kdiff3path))
                        {
                            kdiff3path = GetRegistryValue(Registry.LocalMachine, "SOFTWARE\\KDiff3", "") + "\\kdiff3.exe";
                            if (string.IsNullOrEmpty(kdiff3path) || !File.Exists(kdiff3path))
                            {
                                kdiff3path = MergetoolPath.Text;
                                if (!kdiff3path.Contains("kdiff3.exe"))
                                    kdiff3path = "";
                            }
                        }
                    }

                }
                MergetoolPath.Text = kdiff3path;
            }
            AutoConfigMergeToolcmd();
        }
开发者ID:PProvost,项目名称:gitextensions,代码行数:34,代码来源:FormSettings.cs

示例13: AutoConfigMergeToolcmd

        private void AutoConfigMergeToolcmd()
        {
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
            if (GlobalMergeTool.Text.Equals("p4merge", StringComparison.CurrentCultureIgnoreCase))
            {
                if (MergetoolPath.Text.Contains("kdiff3") || MergetoolPath.Text.Contains("TortoiseMerge"))
                    MergetoolPath.Text = "";
                if (string.IsNullOrEmpty(MergetoolPath.Text) || !File.Exists(MergetoolPath.Text))
                {
                    MergetoolPath.Text = @"c:\Program Files\Perforce\p4merge.exe";

                    MergetoolPath.Text = FindFileInFolders("p4merge.exe",
                                       @"c:\Program Files (x86)\Perforce\",
                                       @"c:\Program Files\Perforce\");

                    if (!File.Exists(MergetoolPath.Text))
                    {
                        MergetoolPath.Text = "";
                        MessageBox.Show("Please enter the path to p4merge.exe and press suggest.", "Suggest mergetool cmd");
                        return;
                    }
                }

                MergeToolCmd.Text = "\"" + MergetoolPath.Text + "\" \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"";
                return;
            }

            if (GlobalMergeTool.Text.Equals("Araxis", StringComparison.CurrentCultureIgnoreCase))
            {
                if (MergetoolPath.Text.Contains("kdiff3") || MergetoolPath.Text.Contains("TortoiseMerge"))
                    MergetoolPath.Text = "";
                if (string.IsNullOrEmpty(MergetoolPath.Text) || !File.Exists(MergetoolPath.Text))
                {
                    MergetoolPath.Text = FindFileInFolders("Compare.exe",
                                                           @"C:\Program Files (x86)\Araxis\Araxis Merge\",
                                                           @"C:\Program Files\Araxis\Araxis Merge\");

                    if (!File.Exists(MergetoolPath.Text))
                    {
                        MergetoolPath.Text = "";
                        MessageBox.Show("Please enter the path to Compare.exe and press suggest.", "Suggest mergetool cmd");
                        return;
                    }
                }

                MergeToolCmd.Text = "\"" + MergetoolPath.Text + "\" -wait -merge -3 -a1 \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"";
                return;
            }

            if (GlobalMergeTool.Text.Equals("TortoiseMerge", StringComparison.CurrentCultureIgnoreCase))
            {
                if (MergetoolPath.Text.Contains("kdiff3") || MergetoolPath.Text.Contains("p4merge"))
                    MergetoolPath.Text = "";
                if (string.IsNullOrEmpty(MergetoolPath.Text) || !File.Exists(MergetoolPath.Text))
                {
                    MergetoolPath.Text = FindFileInFolders("TortoiseMerge.exe",
                                       @"c:\Program Files (x86)\TortoiseSVN\bin\",
                                       @"c:\Program Files\TortoiseSVN\bin\",
                                       @"c:\Program Files (x86)\TortoiseGit\bin\",
                                       @"c:\Program Files\TortoiseGit\bin\");

                    if (!File.Exists(MergetoolPath.Text))
                    {
                        MergetoolPath.Text = "";
                        MessageBox.Show("Please enter the path to TortoiseMerge.exe and press suggest.", "Suggest mergetool cmd");
                        return;
                    }
                }

                MergeToolCmd.Text = "\"TortoiseMerge.exe\" /base:\"$BASE\" /mine:\"$LOCAL\" /theirs:\"$REMOTE\" /merged:\"$MERGED\"";
                return;
            }

            if (GlobalMergeTool.Text.Equals("DiffMerge", StringComparison.CurrentCultureIgnoreCase))
            {
                if (MergetoolPath.Text.Contains("kdiff3") || MergetoolPath.Text.Contains("p4merge"))
                    MergetoolPath.Text = "";
                if (string.IsNullOrEmpty(MergetoolPath.Text) || !File.Exists(MergetoolPath.Text))
                {
                    MergetoolPath.Text = FindFileInFolders("DiffMerge.exe",
                                       @"C:\Program Files (x86)\SourceGear\DiffMerge\",
                                       @"C:\Program Files\SourceGear\DiffMerge\");

                    if (!File.Exists(MergetoolPath.Text))
                    {
                        MergetoolPath.Text = "";
                        MessageBox.Show("Please enter the path to DiffMerge.exe and press suggest.", "Suggest mergetool cmd");
                        return;
                    }
                }

                ///m /r=%merged /t1=%yname /t2=%bname /t3=%tname /c=%mname %mine %base %theirs
                MergeToolCmd.Text = "\"" + MergetoolPath.Text + "\" /m /r=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"";
                return;
            }
        }
开发者ID:PProvost,项目名称:gitextensions,代码行数:96,代码来源:FormSettings.cs

示例14: CheckMergeTool

        private bool CheckMergeTool()
        {
            DiffTool.Visible = true;
            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
            if (string.IsNullOrEmpty(gitCommands.GetGlobalSetting("merge.tool")))
            {
                DiffTool.BackColor = Color.LightSalmon;
                DiffTool.Text = "You need to configure merge tool in order to solve mergeconflicts (kdiff3 for example).";
                return false;
            }

            if (Settings.RunningOnWindows())
            {
                if (gitCommands.GetGlobalSetting("merge.tool").Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
                {
                    string p = gitCommands.GetGlobalSetting("mergetool.kdiff3.path");
                    if (string.IsNullOrEmpty(p) || !File.Exists(p))
                    {
                        DiffTool.BackColor = Color.LightSalmon;
                        DiffTool.Text = "KDiff3 is configured as mergetool, but the path to kdiff.exe is not configured.";
                        return false;
                    }
                    DiffTool.BackColor = Color.LightGreen;
                    DiffTool.Text = "KDiff3 is configured as mergetool.";
                    return true;
                }
                string mergetool = gitCommands.GetGlobalSetting("merge.tool");
                if (mergetool.Equals("p4merge", StringComparison.CurrentCultureIgnoreCase) ||
                    mergetool.Equals("TortoiseMerge", StringComparison.CurrentCultureIgnoreCase))
                {
                    string p = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".cmd");
                    if (string.IsNullOrEmpty(p))
                    {
                        DiffTool.BackColor = Color.LightSalmon;
                        DiffTool.Text = mergetool + " is configured as mergetool, this is a custom mergetool and needs a custom cmd to be configured.";
                        return false;
                    }
                    DiffTool.BackColor = Color.LightGreen;
                    DiffTool.Text = "There is a custom mergetool configured: " + mergetool;
                    return true;
                }
            }
            DiffTool.BackColor = Color.LightGreen;
            DiffTool.Text = "There is a mergetool configured.";
            return true;
        }
开发者ID:X-Coder,项目名称:gitextensions,代码行数:46,代码来源:FormSettings.cs

示例15: DiffToolCmdSuggest_Click

        private void DiffToolCmdSuggest_Click(object sender, EventArgs e)
        {
            if (!Settings.RunningOnWindows())
                return;

            GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();

            if (GlobalDiffTool.Text.Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
            {
                string kdiff3path = gitCommands.GetGlobalSetting("difftool.kdiff3.path");
                string regkdiff3path = GetRegistryValue(Registry.LocalMachine, "SOFTWARE\\KDiff3", "") + "\\kdiff3.exe";

                DifftoolPath.Text = FindFileInFolders("kdiff3.exe", kdiff3path,
                                                                    @"c:\Program Files\KDiff3\",
                                                                    @"c:\Program Files (x86)\KDiff3\",
                                                                    regkdiff3path);
            }
            if (GlobalDiffTool.Text.Equals("winmerge", StringComparison.CurrentCultureIgnoreCase))
            {
                string winmergepath = gitCommands.GetGlobalSetting("difftool.winmerge.path");

                DifftoolPath.Text = FindFileInFolders("winmergeu.exe", winmergepath,
                                                                    @"c:\Program Files\winmerge\",
                                                                    @"c:\Program Files (x86)\winmerge\");
            }
            if (File.Exists(DifftoolPath.Text))
                DifftoolCmd.Text = "\"" + DifftoolPath.Text + "\" \"$LOCAL\" \"$REMOTE\"";
        }
开发者ID:X-Coder,项目名称:gitextensions,代码行数:28,代码来源:FormSettings.cs


注:本文中的GitCommands.GitCommands类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。