WriteLine() публичный Метод

public WriteLine ( ) : void
Результат void
Пример #1
0
        private void CreateLocalRepo()
        {
            if (string.IsNullOrEmpty(localRepoPath))
            {
                return;
            }
            Logger.WriteLine("creating local repo at " + localRepoPath);
            Exec(svnAdmin, "create " + Quote(localRepoPath));
            // write pre-revprop-change.bat to repo\hooks\pre-revprop-change.bat
            string hookContent = "REM PRE-REVPROP-CHANGE HOOK\nREM exit 0 to allow changing all revision properties\n\nexit 0";

            WriteStringToFile(localRepoPath + "\\hooks\\pre-revprop-change.bat", hookContent);

            /*
             * string confDir = localRepoPath + "\\conf";
             * string hooksDir = localRepoPath + "\\hooks";
             * // write svnserve.conf to repo\conf\svnserve.conf
             * // write password file to repo\conf\passwd
             */
            // create base path if necessary
            string parentPath = repoUrl;

            if (!string.IsNullOrEmpty(projectPath))
            {
                string[] fragments = projectPath.Split('/');
                foreach (string fragment in fragments)
                {
                    CreateSvnDir(parentPath, fragment);
                    parentPath += "/" + fragment;
                }
            }
            // create trunk, tags, branches
            CreateSvnDir(parentPath, trunk);
            CreateSvnDir(parentPath, tags);
            CreateSvnDir(parentPath, branches);
        }
Пример #2
0
        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);
                    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.BuildChangesets();

                if (!string.IsNullOrEmpty(outDirTextBox.Text))
                {
                    var gitExporter = new GitExporter(workQueue, logger,
                                                      revisionAnalyzer, changesetBuilder);
                    if (!string.IsNullOrEmpty(domainTextBox.Text))
                    {
                        gitExporter.EmailDomain = domainTextBox.Text;
                    }
                    if (!transcodeCheckBox.Checked)
                    {
                        gitExporter.CommitEncoding = encoding;
                    }
                    gitExporter.ExportToGit(outDirTextBox.Text);
                }

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

                statusTimer.Enabled = true;
                goButton.Enabled    = false;
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }
        }
Пример #3
0
        private void goButton_Click(object sender, EventArgs e)
        {
            try
            {
                AdvancedTaskbar.EnableItermediate();
                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");
                logger.WriteLine("Ignore VCS errors: {0}",
                                 ignoreVcsErrorsCheckBox.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;
                }
                // read the emails dictionary
                var emailDictionary = ReadDictionaryFile("e-mail dictionary", db.BasePath, emailPropertiesFileName);

                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))
                {
                    IVcsWrapper vcsWrapper = CreateVcsWrapper(encoding);

                    var vcsExporter = new VcsExporter(workQueue, logger,
                                                      revisionAnalyzer, changesetBuilder, vcsWrapper, emailDictionary);
                    if (!string.IsNullOrEmpty(domainTextBox.Text))
                    {
                        vcsExporter.EmailDomain = domainTextBox.Text;
                    }
                    if (!string.IsNullOrEmpty(commentTextBox.Text))
                    {
                        vcsExporter.DefaultComment = commentTextBox.Text;
                    }
                    if (!transcodeCheckBox.Checked)
                    {
                        vcsExporter.CommitEncoding = encoding;
                    }
                    vcsExporter.TryGenerateCommitMessage = tryGenerateCommitMessageCheckBox.Checked;
                    vcsExporter.IgnoreVcsErrors          = ignoreVcsErrorsCheckBox.Checked;
                    vcsExporter.ResetRepo = resetRepoCheckBox.Checked;
                    if (vcsExporter.ResetRepo)
                    {
                        vcsExporter.ExportToVcs(outDirTextBox.Text, null);
                    }
                    else
                    {
                        vcsExporter.ExportToVcs(outDirTextBox.Text, continueAfter);
                    }
                }

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

                statusTimer.Enabled = true;
                emailMap.Enabled    = false;
                goButton.Enabled    = false;
                cancelButton.Text   = "Cancel";
            }
            catch (Exception ex)
            {
                logger.Dispose();
                logger = Logger.Null;
                ShowException(ex);
            }
        }