public async Task GenerateMigrationTaskAsync(GitMigrationRow row)
        {
            var processDictionaryResult = _processFactory.GenerateProcessDictionary(row);

            row.ProcessDictionary = processDictionaryResult;

            foreach (var proc in row.ProcessDictionary.OrderBy(r => (int)r.Key))
            {
                _logger.Debug($"Beltin out command for {row.BranchName} at Stage: {proc.Key}");
                _logger.Debug($"Slather ma timbers am runnin: {proc.Value.StartInfo.Arguments}");
                Thread.Sleep(50);
                await BeginChildJob(proc.Value);
            }
        }
        public Dictionary <GitTFSCommandsEnum, Process> GenerateProcessDictionary(GitMigrationRow migrationRow)
        {
            var processDictionary = new Dictionary <GitTFSCommandsEnum, Process>();

            _cmdDictionary = _cmdFactory.GenerateGitTFSCommandDictionary(migrationRow);

            foreach (GitTFSCommandsEnum cmd in Enum.GetValues(typeof(GitTFSCommandsEnum)))
            {
                var cmdProcess = GenerateProcess(cmd, migrationRow);
                processDictionary.Add(cmd, cmdProcess);
            }

            return(processDictionary);
        }
        private Process GenerateProcess(GitTFSCommandsEnum cmd, GitMigrationRow migrationRow)
        {
            var argument   = "/C " + _cmdDictionary[cmd];
            var workingDir = cmd == GitTFSCommandsEnum.CloneFromTFS ?
                             WORKING_DIRECTORY : $"{WORKING_DIRECTORY}{migrationRow.BranchName}\\";

            Process          process   = new Process();
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            startInfo.WorkingDirectory       = workingDir;
            startInfo.FileName               = "cmd.exe";
            startInfo.Arguments              = argument;
            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError  = true;
            startInfo.UseShellExecute        = false;

            process.StartInfo = startInfo;

            return(process);
        }
        public Dictionary <GitTFSCommandsEnum, string> GenerateGitTFSCommandDictionary(GitMigrationRow migrationRow)
        {
            _gitTFSCommandKVP = new Dictionary <GitTFSCommandsEnum, string>
            {
                {
                    GitTFSCommandsEnum.CloneFromTFS,
                    $"git tfs clone {TFS_SERVER} \"{migrationRow.OldTFSRepository}\" {migrationRow.BranchName} --branches=none"
                },

                {
                    GitTFSCommandsEnum.AddOriginRemote,
                    $"git remote add origin {migrationRow.NewGitRepository}"
                },

                {
                    GitTFSCommandsEnum.GenerateDevelopBranch,
                    $"git checkout -b develop"
                },

                {
                    GitTFSCommandsEnum.GenerateGitIgnore,
                    @"COPY ""C:\.gitignore\"" "".\"""
                },

                {
                    GitTFSCommandsEnum.AddGitIgnoreToRepository,
                    @"git add ."
                },

                {
                    GitTFSCommandsEnum.CommitGitIgnore,
                    "git commit -m \"Added git ignore\""
                },

                {
                    GitTFSCommandsEnum.PushOriginRemote,
                    $"git push -u origin --all"
                }
            };

            return(_gitTFSCommandKVP);
        }