Пример #1
0
 public SvnExporter(WorkQueue workQueue, Logger logger,
                    RevisionAnalyzer revisionAnalyzer, ChangesetBuilder changesetBuilder)
     : base(workQueue, logger)
 {
     this.database         = revisionAnalyzer.Database;
     this.revisionAnalyzer = revisionAnalyzer;
     this.changesetBuilder = changesetBuilder;
 }
Пример #2
0
 public GitExporter(WorkQueue workQueue, Logger logger,
     RevisionAnalyzer revisionAnalyzer, ChangesetBuilder changesetBuilder)
     : base(workQueue, logger)
 {
     this.database = revisionAnalyzer.Database;
     this.revisionAnalyzer = revisionAnalyzer;
     this.changesetBuilder = changesetBuilder;
 }
Пример #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)
            {
                revisionAnalyzer = null;
                changesetBuilder = null;

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

            var exceptions = workQueue.FetchExceptions();

            if (exceptions != null)
            {
                foreach (var exception in exceptions)
                {
                    ShowException(exception);
                }
            }
        }
Пример #4
0
        private void goButton_Click(object sender, EventArgs e)
        {
            try
            {
                OpenLog(logTextBox.Text);

                logger.WriteLine("VSS2Svn 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("Transcode comments to UTF-8: {0}",
                                 transcodeCheckBox.Checked ? "enabled" : "disabled");
                logger.WriteLine("Use SVN standard dir structure: {0}",
                                 useSvnDirStructureCheckBox.Checked ? "enabled" : "disabled");
                logger.WriteLine("Exclude all destroyed items: {0}",
                                 excludeAllDestroyedItemsCheckBox.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);
                    return;
                }

                var project = item as VssProject;
                if (project == null)
                {
                    MessageBox.Show(path + " is not a project", "Invalid project path",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                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.ExcludeAllDestroyedItems = excludeAllDestroyedItemsCheckBox.Checked;
                changesetBuilder.BuildChangesets();

                if (!string.IsNullOrEmpty(outDirTextBox.Text))
                {
                    var svnExporter = new SvnExporter(workQueue, logger,
                                                      revisionAnalyzer, changesetBuilder);
                    if (!transcodeCheckBox.Checked)
                    {
                        svnExporter.CommitEncoding = encoding;
                    }
                    svnExporter.ForceAnnotatedTags = forceAnnotatedCheckBox.Checked;

                    svnExporter.ParentWindow = this;
                    svnExporter.ExportToSvn(outDirTextBox.Text, InheritProjectDirCheckBox.Checked, useSvnDirStructureCheckBox.Checked);
                }

                workQueue.Idle += delegate
                {
                    logger.Dispose();
                    logger = Logger.Null;
                };

                statusTimer.Enabled = true;
                goButton.Enabled    = false;
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }
        }
Пример #5
0
        private void goButton_Click(object sender, EventArgs e)
        {
            try
            {
                OpenLog(logTextBox.Text);

                logger.WriteLine("VSS2Svn 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("Transcode comments to UTF-8: {0}",
                    transcodeCheckBox.Checked ? "enabled" : "disabled");
                logger.WriteLine("Use SVN standard dir structure: {0}",
                    useSvnDirStructureCheckBox.Checked ? "enabled" : "disabled");
                logger.WriteLine("Exclude all destroyed items: {0}",
                    excludeAllDestroyedItemsCheckBox.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);
                    return;
                }

                var project = item as VssProject;
                if (project == null)
                {
                    MessageBox.Show(path + " is not a project", "Invalid project path",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                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.ExcludeAllDestroyedItems = excludeAllDestroyedItemsCheckBox.Checked;
                changesetBuilder.BuildChangesets();

                if (!string.IsNullOrEmpty(outDirTextBox.Text))
                {
                    var svnExporter = new SvnExporter(workQueue, logger,
                        revisionAnalyzer, changesetBuilder);
                    if (!transcodeCheckBox.Checked)
                    {
                        svnExporter.CommitEncoding = encoding;
                    }
                    svnExporter.ForceAnnotatedTags = forceAnnotatedCheckBox.Checked;

                    svnExporter.ParentWindow = this;
                    svnExporter.ExportToSvn(outDirTextBox.Text, InheritProjectDirCheckBox.Checked, useSvnDirStructureCheckBox.Checked);
                }

                workQueue.Idle += delegate
                {
                    logger.Dispose();
                    logger = Logger.Null;
                };

                statusTimer.Enabled = true;
                goButton.Enabled = false;
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }
        }
Пример #6
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)
            {
                revisionAnalyzer = null;
                changesetBuilder = null;

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

            var exceptions = workQueue.FetchExceptions();
            if (exceptions != null)
            {
                foreach (var exception in exceptions)
                {
                    ShowException(exception);
                }
            }
        }
Пример #7
0
 public ChangesetBuilder(WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer)
     : base(workQueue, logger)
 {
     this.revisionAnalyzer = revisionAnalyzer;
 }
Пример #8
0
 public ChangesetBuilder(WorkQueue workQueue, Logger logger, RevisionAnalyzer revisionAnalyzer)
     : base(workQueue, logger)
 {
     this.revisionAnalyzer = revisionAnalyzer;
 }