public void Execute(IGitUIEventArgs gitUiCommands)
        {
            if (string.IsNullOrEmpty(gitUiCommands.GitWorkingDir))
                return;

            var formGitStatistics =
                new FormGitStatistics(Settings.GetSetting("Code files"))
                    {
                        DirectoriesToIgnore =
                            Settings.GetSetting("Directories to ignore (EndsWith)")
                    };

            if (Settings.GetSetting("Ignore submodules (true/false)")
                .Equals("true", StringComparison.InvariantCultureIgnoreCase))
            {
                foreach (var submodule in gitUiCommands.GitCommands.GetSubmodules())
                {
                    formGitStatistics.DirectoriesToIgnore += ";";
                    formGitStatistics.DirectoriesToIgnore += gitUiCommands.GitWorkingDir + submodule.LocalPath;
                }
            }

            formGitStatistics.DirectoriesToIgnore = formGitStatistics.DirectoriesToIgnore.Replace("/", "\\");
            formGitStatistics.WorkingDir = new DirectoryInfo(gitUiCommands.GitWorkingDir);

            formGitStatistics.ShowDialog();
        }
        public void Execute(IGitUIEventArgs gitUiCommands)
        {
            int days;
            if (!int.TryParse(Settings.GetSetting("Delete obsolete branches older than (days)"), out days))
                days = 30;

            new DeleteUnusedBranchesForm(days, gitUiCommands.GitCommands).ShowDialog();
        }
        public void Execute(IGitUIEventArgs gitUICommands)
        {
            try
            {
                if (!string.IsNullOrEmpty(gitUICommands.GitWorkingDir))
                {
                    FormGitStatistics formGitStatistics = new FormGitStatistics(gitUICommands);

                    formGitStatistics.CodeFilePattern = Settings.GetSetting("Code files");
                    formGitStatistics.WorkingDir = new DirectoryInfo(gitUICommands.GitWorkingDir);

                    formGitStatistics.ShowDialog();
                }
            }
            catch
            {
            }
        }
        void gitUICommands_PreBrowse(IGitUIEventArgs e)
        {
            //Only check at startup when plugin is enabled
            if (Settings.GetSetting("Enabled (true / false)").Equals("true", StringComparison.InvariantCultureIgnoreCase))
            {
                int days = 0;
                if (!int.TryParse(Settings.GetSetting("Check every # days"), out days))
                    days = 0;

                if (DateTime.ParseExact(Settings.GetSetting("Last check (yyyy/M/dd)"), "yyyy/M/dd", CultureInfo.InvariantCulture).AddDays(7) < DateTime.Now)
                {
                    Settings.SetSetting("Last check (yyyy/M/dd)", DateTime.Now.ToString("yyyy/M/dd", CultureInfo.InvariantCulture));

                    Updates updateForm = new Updates(e.GitVersion);
                    updateForm.AutoClose = true;
                    updateForm.ShowDialog();
                }
            }
        }
예제 #5
0
        private void InitializeCommitCount(IGitUIEventArgs gitUIEventArgs)
        {
            CommitCounter commitCounter = new CommitCounter(gitUIEventArgs);
            commitCounter.Count();
            TotalCommits.Text = commitCounter.TotalCommits + " Commits";

            StringBuilder commitStatisticsTest = new StringBuilder();

            Decimal[] commitCountValues = new Decimal[commitCounter.UserCommitCount.Count];
            string[] CommitCountLabels = new string[commitCounter.UserCommitCount.Count];
            int n = 0;
            foreach (KeyValuePair<string, int> keyValuePair in commitCounter.UserCommitCount)
            {
                commitStatisticsTest.AppendLine(keyValuePair.Value + " " + keyValuePair.Key);

                commitCountValues[n] = keyValuePair.Value;
                CommitCountLabels[n] = keyValuePair.Value + " Commits by " + keyValuePair.Key;
                n++;
            }
            CommitCountPie.Values = commitCountValues;
            CommitCountPie.ToolTips = CommitCountLabels;

            CommitStatistics.Text = commitStatisticsTest.ToString();
        }
        public void Execute(IGitUIEventArgs e)
        {
            // Only build when plugin is enabled
            if (string.IsNullOrEmpty(e.GitWorkingDir))
                return;

            var arguments = Settings.GetSetting("msbuild.exe arguments");
            var msbuildpath = Settings.GetSetting("Path to msbuild.exe");

            var workingDir = new DirectoryInfo(e.GitWorkingDir);
            var solutionFiles = workingDir.GetFiles("*.sln", SearchOption.AllDirectories);

            for (var n = solutionFiles.Length - 1; n > 0; n--)
            {
                var solutionFile = solutionFiles[n];

                var result =
                    MessageBox.Show(
                        string.Format("Do you want to build {0}?\n\n{1}",
                                      solutionFile.Name,
                                      SolutionFilesToString(solutionFiles)),
                        "Build",
                        MessageBoxButtons.YesNoCancel);

                if (result == DialogResult.Cancel)
                    return;

                if (result != DialogResult.Yes)
                    continue;

                if (string.IsNullOrEmpty(msbuildpath) || !File.Exists(msbuildpath))
                    MessageBox.Show("Please enter correct MSBuild path in the plugin settings dialog and try again.");
                else
                    e.GitUICommands.StartCommandLineProcessDialog(msbuildpath, solutionFile.FullName + " " + arguments);
            }
        }
예제 #7
0
 public CommitCounter(IGitUIEventArgs gitUIEventArgs)
 {
     GitUIEventArgs = gitUIEventArgs;
 }
예제 #8
0
        public void Execute(IGitUIEventArgs gitUiCommands)
        {
            if (!gitUiCommands.IsValidGitWorkingDir(gitUiCommands.GitWorkingDir))
            {
                MessageBox.Show("The current directory is not a valid git repository." + Environment.NewLine +
                                Environment.NewLine + "Gource can be only be started from a valid git repository.");
                return;
            }

            var pathToGource = Settings.GetSetting("Path to \"gource\"");

            if (!string.IsNullOrEmpty(pathToGource))
            {
                if (!File.Exists(pathToGource))
                {
                    if (
                        MessageBox.Show(
                            "Cannot find \"gource\" in the configured path: " + pathToGource +
                            ".\n\n.Do you want to reset the configured path?", "Gource", MessageBoxButtons.YesNo) ==
                        DialogResult.Yes)
                    {
                        Settings.SetSetting("Path to \"gource\"", "");
                        pathToGource = Settings.GetSetting("Path to \"gource\"");
                    }
                }
            }

            if (string.IsNullOrEmpty(pathToGource))
            {
                if (
                    MessageBox.Show(
                        "There is no path to \"gource\" configured.\n\nDo you want to automaticly download \"gource\"?",
                        "Download", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    var gourceUrl = SearchForGourceUrl();

                    if (string.IsNullOrEmpty(gourceUrl))
                    {
                        MessageBox.Show(
                            "Cannot find \"gource\".\nPlease download \"gource\" and set the path in the plugins settings dialog.");
                        return;
                    }
                    var downloadDir = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
                    var fileName = downloadDir + "\\gource.zip";
                    var downloadSize = DownloadFile(gourceUrl, fileName);
                    if (downloadSize > 0)
                    {
                        MessageBox.Show(downloadSize + " bytes downloaded.");
                        Directory.CreateDirectory(downloadDir + "\\gource");
                        UnZipFiles(fileName, downloadDir + "\\gource", true);

                        var newGourcePath = downloadDir + "\\gource\\gource.exe";
                        if (File.Exists(newGourcePath))
                        {
                            Settings.SetSetting("Path to \"gource\"", newGourcePath);
                            MessageBox.Show("\"gource\" has been downloaded and unzipped.");
                            pathToGource = newGourcePath;
                        }
                    }
                    else
                    {
                        MessageBox.Show(
                            "Downloading failed.\nPlease download \"gource\" and set the path in the plugins settings dialog.");
                    }
                }
            }

            var gourceStart = new GourceStart(pathToGource, gitUiCommands.GitWorkingDir,
                                              Settings.GetSetting("Arguments"));
            gourceStart.ShowDialog();

            Settings.SetSetting("Arguments", gourceStart.GourceArguments);
            Settings.SetSetting("Path to \"gource\"", gourceStart.PathToGource);
        }
 public void Execute(IGitUIEventArgs e)
 {
     Updates updateForm = new Updates(e.GitVersion);
     updateForm.AutoClose = false;
     updateForm.ShowDialog();
 }
예제 #10
0
 public void Initialize(IGitUIEventArgs gitUIEventArgs)
 {
     InitializeCommitCount(gitUIEventArgs);
     InitializeLinesOfCode();
 }
예제 #11
0
 public FormGitStatistics(IGitUIEventArgs gitUIEventArgs)
 {
     this.GitUIEventArgs = gitUIEventArgs;
     InitializeComponent();
 }
 private void GitUiCommandsPostUpdateSubmodulesRecursive(IGitUIEventArgs e)
 {
     if (Settings.GetSetting("Enabled (true / false)")
         .Equals("true", StringComparison.InvariantCultureIgnoreCase))
         Execute(e);
 }