private async Task OpenLog(String path, IEnumerable <String>?references = null)
        {
            AddToRecentRepos(path);

            Process p = GitAction.Log(path, references);

            await AddNewLogProcess(p, path);
        }
Beispiel #2
0
        private async void TabbedTortoiseGitForm_Shown(object?sender, EventArgs e)
        {
            LOG.Debug($"{nameof( TabbedTortoiseGitForm_Shown )}");

            if (!_skipUpdateCheck)
            {
                DateTime lastUpdatePromptTime = Settings.Default.LastUpdatePromptTime;
                DateTime now        = DateTime.Now;
                TimeSpan difference = now - lastUpdatePromptTime;
                LOG.Debug($"{nameof( TabbedTortoiseGitForm_Shown )} - Last Update Prompt Time: {lastUpdatePromptTime} - Now: {now} - Difference: {difference}");
                if (difference >= TimeSpan.FromDays(1))
                {
                    Version?newestVersion = await TTG.IsUpToDate();

                    if (newestVersion != null)
                    {
                        LOG.Debug($"Newest Version: {newestVersion}");

                        if (DialogResult.Yes == MessageBox.Show($"Version {newestVersion} of Tabbed TortoiseGit is available. Update now?\n\nNote: This will exit Tabbed TortoiseGit.", "New Update", MessageBoxButtons.YesNo))
                        {
                            LOG.Debug("Update Prompt: Yes");
                            Settings.Default.LastUpdatePromptTime = DateTime.MinValue;
                            Settings.Default.Save();

                            if (await TTG.UpdateApplication(newestVersion))
                            {
                                LOG.Debug("Update - Exiting Application");
                                Application.Exit();
                            }
                            else
                            {
                                LOG.Debug("Update - Error occurred");
                                MessageBox.Show("There was an error updating Tabbed TortoiseGit. Try again later.");
                            }
                        }
                        else
                        {
                            LOG.Debug("Update Prompt: No");
                            Settings.Default.LastUpdatePromptTime = now;
                            Settings.Default.Save();

                            MessageBox.Show("To update Tabbed TortoiseGit at a later date, go to Options->About and click Update.", "New Update", MessageBoxButtons.OK);
                        }
                    }
                }
            }

            if (Settings.Default.CheckTortoiseGitOnPath)
            {
                if (!(await GitAction.CanAccessTortoiseGit()))
                {
                    using ConfirmationDialog dialog = new ConfirmationDialog("Cannot access TortoiseGit", "TortoiseGit does not appear to be on PATH (this will prevent Tabbed TortoiseGit from being able to open logs). Update PATH environment variable to include directory for TortoiseGitProc.exe.");
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        if (dialog.DoNotAskAgain)
                        {
                            Settings.Default.CheckTortoiseGitOnPath = false;
                            Settings.Default.Save();
                        }
                    }
                }
            }

            if (_showStartUpRepos)
            {
                await OpenStartupRepos();
            }

            if (Settings.Default.ShouldShowChangelog)
            {
                Settings.Default.ShouldShowChangelog = false;

                if (Settings.Default.ShowChangelogOnUpdate)
                {
                    ChangelogDialog.ShowChangelog();
                }
            }
        }