public VcsExporter(WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer, ChangesetBuilder changesetBuilder, IVcsWrapper vcsWrapper, IDictionary<string, string> usersmap) : base(workQueue, logger) { this.database = revisionAnalyzer.Database; this.revisionAnalyzer = revisionAnalyzer; this.changesetBuilder = changesetBuilder; this.vcsWrapper = vcsWrapper; this.emailDictionary = new Dictionary<string, string>(); this.usernameDictionary = new Dictionary<string, string>(); Regex emailRegex = new Regex("(\\S.*?)\\s*<(.+)>"); foreach (var e in usersmap) { string key = e.Key.ToLower(); string email = e.Value.Trim(); if (email == "") continue; Match m = emailRegex.Match(email); if (m.Success) { this.usernameDictionary.Add(key, m.Groups[1].Value); email = m.Groups[2].Value; } this.emailDictionary.Add(key, email); } }
public GitExporter(WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer, ChangesetBuilder changesetBuilder) : base(workQueue, logger) { this.database = revisionAnalyzer.Database; this.revisionAnalyzer = revisionAnalyzer; this.changesetBuilder = changesetBuilder; }
public VcsExporter(WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer, ChangesetBuilder changesetBuilder, IVcsWrapper vcsWrapper, IDictionary<string, string> emailDictionary) : base(workQueue, logger) { this.database = revisionAnalyzer.Database; this.revisionAnalyzer = revisionAnalyzer; this.changesetBuilder = changesetBuilder; this.vcsWrapper = vcsWrapper; this.emailDictionary = emailDictionary; }
public GitExporter(WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer, ChangesetBuilder changesetBuilder, string repoPath, FileAnalyzer fileAnalyzer, bool inheritProjectDir = false) : base(workQueue, logger) { this.database = revisionAnalyzer.Database; this.revisionAnalyzer = revisionAnalyzer; this.changesetBuilder = changesetBuilder; this.repoPath = repoPath; this.fileAnalyzer = fileAnalyzer; this.inheritProjectDir = inheritProjectDir; }
public GitExporter( WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer, ChangesetBuilder changesetBuilder, IMessageDispatcher messageDispatcher) : base(workQueue, logger, messageDispatcher) { database = revisionAnalyzer.Database; this.revisionAnalyzer = revisionAnalyzer; this.changesetBuilder = changesetBuilder; this.messageDispatcher = messageDispatcher; }
public RunInfo( MainForm form, string outputDir, Logger commonLogger, VssDatabase db, Encoding selectedEncoding, Logger errorLogger, WorkQueue workQueue, Queue <ProjectInfo> toProcess) { this.form = form; this.outputDir = outputDir; this.processDir = Path.Combine(outputDir, PROCESS_DIR_NAME); this.logFile = Path.Combine(this.outputDir, PROCESS_DIR_NAME + ".log"); this.commonLogger = commonLogger; this.db = db; this.selectedEncoding = selectedEncoding; this.errorLogger = errorLogger; this.workQueue = workQueue; this.toProcess = toProcess; }
public Worker(WorkQueue workQueue, Logger logger) { this.workQueue = workQueue; this.logger = logger; }
public ProjectAnalyzer(WorkQueue workQueue, Logger logger, VssProject vssRootProject) : base(workQueue, logger) { this.vssRootProject = vssRootProject; }
public RevisionAnalyzer(WorkQueue workQueue, Logger logger, VssDatabase database) : base(workQueue, logger) { this.database = database; }
public RevisionAnalyzer(WorkQueue workQueue, Logger logger, VssDatabase database, IMessageDispatcher messageDispatcher) : base(workQueue, logger, messageDispatcher) { this.Database = database; }
public FileAnalyzer(WorkQueue workQueue, Logger logger, ProjectAnalyzer projectAnalyzer) : base(workQueue, logger) { this.projectAnalyzer = projectAnalyzer; }
public ChangesetBuilder(WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer) : base(workQueue, logger) { this.revisionAnalyzer = revisionAnalyzer; }
protected Worker(WorkQueue workQueue, Logger logger, IMessageDispatcher messageDispatcher) { this.workQueue = workQueue; this.logger = logger; this.messageDispatcher = messageDispatcher; }
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(); }
public ChangesetBuilder(WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer, IMessageDispatcher messageDispatcher) : base(workQueue, logger, messageDispatcher) { this.revisionAnalyzer = revisionAnalyzer; }