コード例 #1
0
ファイル: Program.cs プロジェクト: siemandelc/tfs2svn
        private static void AddUserMappings(Tfs2SvnConverter tfs2svnConverter, string fileContents)
        {
            Regex regex = new Regex(@"(?<usermapping>(usermapping:\s+(?<regex>\w+), (?<username>\w+), (?<password>\w+)))", RegexOptions.IgnoreCase);

            foreach (Match match in regex.Matches(fileContents))
                tfs2svnConverter.AddUsernameMapping(match.Groups["regex"].Value, match.Groups["username"].Value);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: siemandelc/tfs2svn
 private static void Convert(string tfsPath, string svnPath)
 {
     string workingCopyPath = Path.GetTempPath() + "tfs2svn";
     //string svnBinFolder = @"C:\Program Files\Subversion\bin";
     string svnBinFolder = Settings.Default.SvnBinFolder;
     Tfs2SvnConverter tfs2svnConverter = new Tfs2SvnConverter(tfsPath, svnPath, true, 1, workingCopyPath, svnBinFolder, true);
     HookupEventHandlers(tfs2svnConverter);
     tfs2svnConverter.Convert();
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: siemandelc/tfs2svn
 private static void HookupEventHandlers(Tfs2SvnConverter tfs2svnConverter)
 {
     tfs2svnConverter.BeginChangeSet += BeginChangeSet;
     tfs2svnConverter.EndChangeSet += EndChangeSet;
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: siemandelc/tfs2svn
        private static Tfs2SvnConverter ParseConfigurationFile(string path)
        {
            string fileContents = new StreamReader(path).ReadToEnd();

            string svnPath = GetSvnPath(fileContents);
            string tfsPath = GetTfsPath(fileContents);
            bool overwrite = GetOverwriteOption(fileContents);
            string workingCopyPath = Path.GetTempPath() + "tfs2svn";
            //string svnBinFolder = @"C:\Program Files\Subversion\bin";
            string svnBinFolder = Settings.Default.SvnBinFolder;
            Tfs2SvnConverter tfs2svnConverter = new Tfs2SvnConverter(tfsPath, svnPath, overwrite, 1, workingCopyPath, svnBinFolder, true);

            AddUserMappings(tfs2svnConverter, fileContents);

            return tfs2svnConverter;
        }
コード例 #5
0
ファイル: frmMain.cs プロジェクト: siemandelc/tfs2svn
        private void AddUsernameMappings(Tfs2SvnConverter tfs2svnConverter)
        {
            StringCollection mappings = Settings.Default.TFS2SVNUserMappings;
            foreach (string mapping in mappings)
            {
                string tfsUserName = mapping.Split(';')[0];
                string svnUserName = mapping.Split(';')[1];

                tfs2svnConverter.AddUsernameMapping(tfsUserName, svnUserName);
            }
        }
コード例 #6
0
ファイル: frmMain.cs プロジェクト: siemandelc/tfs2svn
 private void HookupEventHandlers(Tfs2SvnConverter tfs2svnConverter)
 {
     tfs2svnConverter.BeginChangeSet += tfs2svnConverter_BeginChangeSet;
     tfs2svnConverter.EndChangeSet += tfs2svnConverter_EndChangeSet;
     tfs2svnConverter.ChangeSetsFound += tfs2svnConverter_ChangeSetsFound;
     tfs2svnConverter.SvnAdminEvent += tfs2svnConverter_SvnAdminEvent;
     tfs2svnConverter.FileAdded += tfs2svnConverter_FileAdded;
     tfs2svnConverter.FileBranched +=  tfs2svnConverter_FileBranched;
     tfs2svnConverter.FileDeleted += tfs2svnConverter_FileDeleted;
     tfs2svnConverter.FileEdited += tfs2svnConverter_FileEdited;
     tfs2svnConverter.FileRenamed += tfs2svnConverter_FileRenamed;
     tfs2svnConverter.FolderAdded += tfs2svnConverter_FolderAdded;
     tfs2svnConverter.FolderBranched +=  tfs2svnConverter_FolderBranched;
     tfs2svnConverter.FolderDeleted +=  tfs2svnConverter_FolderDeleted;
     tfs2svnConverter.FolderRenamed +=  tfs2svnConverter_FolderRenamed;
     tfs2svnConverter.FolderUndeleted += tfs2svnConverter_FolderUndeleted;
 }
コード例 #7
0
ファイル: frmMain.cs プロジェクト: siemandelc/tfs2svn
        private void DoWork(object obj)
        {
            try
            {
                string tfsUrl = Settings.Default.TFSUrl = tbTFSUrl.Text;
                string svnUrl = Settings.Default.SVNUrl = tbSVNUrl.Text;
                int startChangeset = Settings.Default.FromChangeset = int.Parse(tbChangesetStart.Text);
                string workingCopyFolder = Settings.Default.WorkingCopyPath = tbWorkingCopyFolder.Text;
                workingCopyFolder = workingCopyFolder.Replace("[MyDocuments]", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
                bool doInitialCheckout = Settings.Default.DoInitialCheckout = cbDoInitialCheckout.Checked;
                string tfsUsername = Settings.Default.TFSUsername = tbTFSUsername.Text;
                string tfsDomain = Settings.Default.TFSDomain = tbTFSDomain.Text;
                string tfsPassword = tbTFSPassword.Text;
                Settings.Default.Save(); //save settings

                //starting converting
                log.Info(String.Format("======== Starting tfs2svn converting from {0} to {1}", tfsUrl, svnUrl));
                this.BeginInvoke(
                    new MethodInvoker(delegate() { AddListboxLine("Starting converting from TFS to SVN"); }));

                Tfs2SvnConverter tfs2svnConverter = new Tfs2SvnConverter(tfsUrl, svnUrl, cbCreateRepository.Enabled && cbCreateRepository.Checked, startChangeset, workingCopyFolder, Settings.Default.SvnBinFolder, doInitialCheckout, tfsUsername, tfsPassword, tfsDomain);
                HookupEventHandlers(tfs2svnConverter);
                AddUsernameMappings(tfs2svnConverter);
                tfs2svnConverter.Convert();

                //done converting
                log.Info("======== Finished tfs2svn converting");
                this.BeginInvoke(
                    new MethodInvoker(delegate() { AddListboxLine("Finished converting!"); }));
            }
            catch (Exception ex)
            {
                log.Error("Exception while converting", ex);
                this.BeginInvoke(
                    new MethodInvoker(delegate() { AddListboxLine("!!!ERROR(S) FOUND"); MessageBox.Show(ex.ToString(), "Error found"); }));
            }
            finally
            {
                this.BeginInvoke(
                    new MethodInvoker(delegate() { button1.Enabled = true; }));

                this.BeginInvoke(
                    new MethodInvoker(delegate() {
                        if (_lastSuccesfulChangeset > -1 && Settings.Default.FromChangeset > 1 && MessageBox.Show("Update 'Start on Changeset#' for next incremental update (#" + (_lastSuccesfulChangeset + 1).ToString() + ")?", "Update starting Changeset#?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            Settings.Default.FromChangeset = _lastSuccesfulChangeset + 1;
                            tbChangesetStart.Text = Settings.Default.FromChangeset.ToString();
                            Settings.Default.Save();
                        }
                    }));
            }
        }