FetchExceptions() public method

public FetchExceptions ( ) : ICollection
return ICollection
Esempio n. 1
0
        private void statusTimer_Tick(object sender, EventArgs e)
        {
            statusLabel.Text = workQueue.LastStatus ?? "Idle";
            timeLabel.Text   = string.Format("Elapsed: {0:HH:mm:ss}",
                                             new DateTime(workQueue.ActiveTime.Ticks));

            if (revisionAnalyzer != null)
            {
                fileLabel.Text     = "Files: " + revisionAnalyzer.FileCount;
                revisionLabel.Text = "Revisions: " + revisionAnalyzer.RevisionCount;
            }

            if (changesetBuilder != null)
            {
                changeLabel.Text = "Changesets: " + changesetBuilder.Changesets.Count;
                if (changesetBuilder.Changesets.Count > 1)
                {
                    AdvancedTaskbar.EnableProgress((uint)changesetBuilder.Changesets.Count);
                }
            }

            if (workQueue.IsIdle)
            {
                revisionAnalyzer = null;
                changesetBuilder = null;

                statusTimer.Enabled = false;
                if (!goButton.Enabled)
                {
                    LoadRepoSettings();
                }
                emailMap.Enabled = true;
                goButton.Enabled = true;
                AdvancedTaskbar.Disable();
                cancelButton.Text = "Close";
                if (goAndExit && exitOnComplete)
                {
                    exitOnComplete = false;
                    Close();
                }
            }

            var exceptions = workQueue.FetchExceptions();

            if (exceptions != null)
            {
                foreach (var exception in exceptions)
                {
                    ShowException(exception);
                }
            }
        }
Esempio n. 2
0
        private void statusTimer_Tick(object sender, EventArgs e)
        {
            progressBar1.Value = workQueue.LastProgress;
            statusLabel.Text   = workQueue.LastStatus ?? "Idle";
            timeLabel.Text     = string.Format("Elapsed: {0:HH:mm:ss}",
                                               new DateTime(workQueue.ActiveTime.Ticks));

            if (revisionAnalyzer != null)
            {
                fileLabel.Text     = "Files: " + revisionAnalyzer.FileCount;
                revisionLabel.Text = "Revisions: " + revisionAnalyzer.RevisionCount;
            }

            if (changesetBuilder != null)
            {
                changeLabel.Text     = "Changesets: " + changesetBuilder.Changesets.Count;
                progressBar1.Maximum = changesetBuilder.Changesets.Count;
                progressBar1.Visible = true;
            }

            if (workQueue.IsIdle)
            {
                revisionAnalyzer = null;
                changesetBuilder = null;

                statusTimer.Enabled  = false;
                goButton.Enabled     = true;
                progressBar1.Visible = false;
                string[] args = Environment.GetCommandLineArgs();

                if (autostart)
                {
                    {
                        Application.Exit();
                    }
                }
            }

            var exceptions = workQueue.FetchExceptions();

            if (exceptions != null)
            {
                foreach (var exception in exceptions)
                {
                    ShowException(exception);
                }
            }
        }
Esempio n. 3
0
        private void statusTimer_Tick(object sender, EventArgs e)
        {
            statusLabel.Text = workQueue.LastStatus ?? "Idle";
            timeLabel.Text   = string.Format("Elapsed: {0:HH:mm:ss}",
                                             new DateTime(workQueue.ActiveTime.Ticks));

            if (revisionAnalyzer != null)
            {
                fileLabel.Text     = "Files: " + revisionAnalyzer.FileCount;
                revisionLabel.Text = "Revisions: " + revisionAnalyzer.RevisionCount;
            }

            if (changesetBuilder != null)
            {
                changeLabel.Text = "Changesets: " + changesetBuilder.Changesets.Count;
            }

            if (workQueue.IsIdle)
            {
                projectAnalyzer  = null;
                fileAnalyzer     = null;
                revisionAnalyzer = null;
                changesetBuilder = null;

                statusTimer.Enabled = false;
                goButton.Enabled    = true;
            }

            var exceptions = workQueue.FetchExceptions();

            if (exceptions != null)
            {
                foreach (var exception in exceptions)
                {
                    ShowException(exception);
                }
            }
        }
Esempio n. 4
0
        private static void RunFromCommandLine(ProgramOptions options)
        {
            var logger            = string.IsNullOrEmpty(options.LogFile) ? Logger.Null : new Logger(options.LogFile);
            var workQueue         = new WorkQueue(1);
            var messageDispatcher = new ConsoleLoggerMessageDispatcher(logger, options.IgnoreErrors);

            messageDispatcher.Dispatch(MessageType.Info, workQueue.LastStatus ?? "Idle", MessageChoice.Ok);

            var encoding = Encoding.GetEncoding(options.CodePage);
            var df       = new VssDatabaseFactory(options.VssDirectory)
            {
                Encoding = encoding
            };
            var db   = df.Open();
            var item = db.GetItem(options.VssProject);

            if (!(item is VssProject project))
            {
                logger.WriteLine("Error: Not a vss project.");
                return;
            }

            var revisionAnalyzer = new RevisionAnalyzer(workQueue, logger, db, messageDispatcher);

            var changesetBuilder = new ChangesetBuilder(workQueue, logger, revisionAnalyzer, messageDispatcher)
            {
                AnyCommentThreshold  = TimeSpan.FromSeconds(options.AnyCommentSeconds),
                SameCommentThreshold = TimeSpan.FromSeconds(options.SameCommentSeconds)
            };

            void OnTimer(object state)
            {
                messageDispatcher.Dispatch(MessageType.Info, workQueue.LastStatus ?? "Idle", MessageChoice.Ok);
                messageDispatcher.Dispatch(MessageType.Info, $"Files: {revisionAnalyzer.FileCount}, Revisions: {revisionAnalyzer.RevisionCount}", MessageChoice.Ok);
                messageDispatcher.Dispatch(MessageType.Info, $"Changesets: {changesetBuilder.Changesets.Count}", MessageChoice.Ok);

                var exceptions = workQueue.FetchExceptions();

                if (exceptions != null)
                {
                    foreach (var exception in exceptions)
                    {
                        var message = ExceptionFormatter.Format(exception);
                        logger.WriteLine("ERROR: {0}", message);
                        logger.WriteLine(exception);
                    }
                }
            }

            var timer = new Timer(OnTimer, null, TimeSpan.Zero, TimeSpan.FromSeconds(1));

            if (!string.IsNullOrWhiteSpace(options.VssExcludePaths))
            {
                revisionAnalyzer.ExcludeFiles = options.VssExcludePaths;
            }
            revisionAnalyzer.AddItem(project);

            changesetBuilder.BuildChangesets();

            if (!string.IsNullOrEmpty(options.GitDirectory))
            {
                var gitExporter = new GitExporter(workQueue, logger,
                                                  revisionAnalyzer, changesetBuilder, messageDispatcher);
                if (!string.IsNullOrEmpty(options.DefaultEmailDomain))
                {
                    gitExporter.EmailDomain = options.DefaultEmailDomain;
                }
                if (!string.IsNullOrEmpty(options.EmailMapFile))
                {
                    if (File.Exists(options.EmailMapFile))
                    {
                        gitExporter.EmailMapFile = options.EmailMapFile;
                    }
                    else
                    {
                        logger.WriteLine($"Warn: {options.EmailMapFile} does not exist.");
                    }
                }
                if (!string.IsNullOrEmpty(options.DefaultComment))
                {
                    gitExporter.DefaultComment = options.DefaultComment;
                }
                if (!options.TranscodeComments)
                {
                    gitExporter.CommitEncoding = encoding;
                }
                gitExporter.IgnoreErrors = options.IgnoreErrors;
                gitExporter.ExportToGit(options.GitDirectory);
            }

            workQueue.WaitIdle();
            timer.Dispose();

            messageDispatcher.Dispatch(MessageType.Info, "Done", MessageChoice.Ok);

            Application.Exit();
        }