Beispiel #1
0
        private void launchDiffTool(string leftSHA, string rightSHA, ILocalCommitStorage storage,
                                    MergeRequestKey mrk, DataCache dataCache)
        {
            addOperationRecord("Launching diff tool has started");

            int?pid = null;

            try
            {
                DiffToolArguments arg = new DiffToolArguments(true, Constants.GitDiffToolName, leftSHA, rightSHA);
                pid = storage.Git?.LaunchDiffTool(arg) ?? null;
            }
            catch (DiffToolLaunchException)
            {
                string message = "Cannot launch diff tool";
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                addOperationRecord(message);
            }

            if (!pid.HasValue)
            {
                Trace.TraceInformation(String.Format("[MainForm] Cannot launch Diff Tool for MR with IId {0}", mrk.IId));
                return; // e.g. storage.Git got disposed
            }

            Trace.TraceInformation(String.Format("[MainForm] Launched DiffTool for SHA {0} vs SHA {1} (at {2}). PID {3}",
                                                 leftSHA, rightSHA, storage.Path, pid.Value.ToString()));

            if (pid == -1)
            {
                addOperationRecord("Diff tool was not launched. Most likely the difference is empty.");
            }
            else
            {
                addOperationRecord("Diff tool has launched");
                saveInterprocessSnapshot(pid.Value, leftSHA, rightSHA, mrk, dataCache);
            }
        }
Beispiel #2
0
        private void launchDiffTool(string leftSHA, string rightSHA, ILocalCommitStorage storage,
                                    MergeRequestKey mrk, string accessToken, string sessionName)
        {
            labelWorkflowStatus.Text = "Launching diff tool...";

            int?pid = null;

            try
            {
                DiffToolArguments arg = new DiffToolArguments(true, Constants.GitDiffToolName, leftSHA, rightSHA);
                pid = storage.Git?.LaunchDiffTool(arg) ?? null;
            }
            catch (DiffToolLaunchException)
            {
                MessageBox.Show("Cannot launch diff tool", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                labelWorkflowStatus.Text = String.Empty;
            }

            if (!pid.HasValue)
            {
                return; // e.g. storage.Git got disposed
            }

            Trace.TraceInformation(String.Format("[MainForm] Launched DiffTool for SHA {0} vs SHA {1} (at {2}). PID {3}",
                                                 leftSHA, rightSHA, storage.Path, pid.Value.ToString()));

            if (pid == -1)
            {
                labelWorkflowStatus.Text = "Diff tool was not launched. Most likely the difference is empty.";
            }
            else
            {
                labelWorkflowStatus.Text = "Diff tool launched";
                saveInterprocessSnapshot(pid.Value, leftSHA, rightSHA, mrk, accessToken, sessionName);
            }
        }