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); } } }
private void goButton_Click(object sender, EventArgs e) { try { OpenLog(logTextBox.Text); logger.WriteLine("VSS2Git version {0}", Assembly.GetExecutingAssembly().GetName().Version); WriteSettings(); Encoding encoding = Encoding.Default; EncodingInfo encodingInfo; if (codePages.TryGetValue(encodingComboBox.SelectedIndex, out encodingInfo)) { encoding = encodingInfo.GetEncoding(); } logger.WriteLine("VSS encoding: {0} (CP: {1}, IANA: {2})", encoding.EncodingName, encoding.CodePage, encoding.WebName); logger.WriteLine("Comment transcoding: {0}", transcodeCheckBox.Checked ? "enabled" : "disabled"); var df = new VssDatabaseFactory(vssDirTextBox.Text); df.Encoding = encoding; var db = df.Open(); var path = vssProjectTextBox.Text; VssItem item; try { item = db.GetItem(path); } catch (VssPathException ex) { MessageBox.Show(ex.Message, "Invalid project path", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Dispose(); logger = Logger.Null; return; } var project = item as VssProject; if (project == null) { MessageBox.Show(path + " is not a project", "Invalid project path", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Dispose(); logger = Logger.Null; return; } if (!alternateLogicCheckBox.Checked) { fileAnalyzer = null; } else { projectAnalyzer = new ProjectAnalyzer(workQueue, logger, project); if (!string.IsNullOrEmpty(excludeTextBox.Text)) { projectAnalyzer.ExcludeFiles = excludeTextBox.Text; } projectAnalyzer.AnalyzeProject(); fileAnalyzer = new FileAnalyzer(workQueue, logger, projectAnalyzer); if (!string.IsNullOrEmpty(excludeTextBox.Text)) { fileAnalyzer.ExcludeFiles = excludeTextBox.Text; } fileAnalyzer.AddItem(project); } revisionAnalyzer = new RevisionAnalyzer(workQueue, logger, db); if (!string.IsNullOrEmpty(excludeTextBox.Text)) { revisionAnalyzer.ExcludeFiles = excludeTextBox.Text; } revisionAnalyzer.AddItem(project); changesetBuilder = new ChangesetBuilder(workQueue, logger, revisionAnalyzer); changesetBuilder.AnyCommentThreshold = TimeSpan.FromSeconds((double)anyCommentUpDown.Value); changesetBuilder.SameCommentThreshold = TimeSpan.FromSeconds((double)sameCommentUpDown.Value); changesetBuilder.BuildChangesets(); if (!string.IsNullOrEmpty(outDirTextBox.Text)) { var gitExporter = new GitExporter(workQueue, logger, revisionAnalyzer, changesetBuilder, outDirTextBox.Text, fileAnalyzer); if (!string.IsNullOrEmpty(domainTextBox.Text)) { gitExporter.EmailDomain = domainTextBox.Text; } if (!transcodeCheckBox.Checked) { gitExporter.CommitEncoding = encoding; } gitExporter.ExportToGit(); } workQueue.Idle += delegate { logger.Dispose(); logger = Logger.Null; }; statusTimer.Enabled = true; goButton.Enabled = false; } catch (Exception ex) { ShowException(ex); } }
public FileAnalyzer(WorkQueue workQueue, Logger logger, ProjectAnalyzer projectAnalyzer) : base(workQueue, logger) { this.projectAnalyzer = projectAnalyzer; }
private void goButton_Click(object sender, EventArgs e) { try { OpenLog(logTextBox.Text); logger.WriteLine("VSS2Git version {0}", Assembly.GetExecutingAssembly().GetName().Version); WriteSettings(); Encoding encoding = Encoding.Default; EncodingInfo encodingInfo; if (codePages.TryGetValue(encodingComboBox.SelectedIndex, out encodingInfo)) { encoding = encodingInfo.GetEncoding(); } logger.WriteLine("VSS encoding: {0} (CP: {1}, IANA: {2})", encoding.EncodingName, encoding.CodePage, encoding.WebName); logger.WriteLine("Comment transcoding: {0}", transcodeCheckBox.Checked ? "enabled" : "disabled"); var df = new VssDatabaseFactory(vssDirTextBox.Text); df.Encoding = encoding; var db = df.Open(); var path = vssProjectTextBox.Text; VssItem item; try { item = db.GetItem(path); } catch (VssPathException ex) { MessageBox.Show(ex.Message, "Invalid project path", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Dispose(); logger = Logger.Null; return; } var project = item as VssProject; if (project == null) { MessageBox.Show(path + " is not a project", "Invalid project path", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Dispose(); logger = Logger.Null; return; } if (!alternateLogicCheckBox.Checked) fileAnalyzer = null; else { projectAnalyzer = new ProjectAnalyzer(workQueue, logger, project); if (!string.IsNullOrEmpty(excludeTextBox.Text)) { projectAnalyzer.ExcludeFiles = excludeTextBox.Text; } projectAnalyzer.AnalyzeProject(); fileAnalyzer = new FileAnalyzer(workQueue, logger, projectAnalyzer); if (!string.IsNullOrEmpty(excludeTextBox.Text)) { fileAnalyzer.ExcludeFiles = excludeTextBox.Text; } fileAnalyzer.AddItem(project); } revisionAnalyzer = new RevisionAnalyzer(workQueue, logger, db); if (!string.IsNullOrEmpty(excludeTextBox.Text)) { revisionAnalyzer.ExcludeFiles = excludeTextBox.Text; } revisionAnalyzer.AddItem(project); changesetBuilder = new ChangesetBuilder(workQueue, logger, revisionAnalyzer); changesetBuilder.AnyCommentThreshold = TimeSpan.FromSeconds((double)anyCommentUpDown.Value); changesetBuilder.SameCommentThreshold = TimeSpan.FromSeconds((double)sameCommentUpDown.Value); changesetBuilder.BuildChangesets(); if (!string.IsNullOrEmpty(outDirTextBox.Text)) { var gitExporter = new GitExporter(workQueue, logger, revisionAnalyzer, changesetBuilder, outDirTextBox.Text, fileAnalyzer); if (!string.IsNullOrEmpty(domainTextBox.Text)) { gitExporter.EmailDomain = domainTextBox.Text; } if (!transcodeCheckBox.Checked) { gitExporter.CommitEncoding = encoding; } gitExporter.ExportToGit(); } workQueue.Idle += delegate { logger.Dispose(); logger = Logger.Null; }; statusTimer.Enabled = true; goButton.Enabled = false; } catch (Exception ex) { ShowException(ex); } }