Ejemplo n.º 1
0
        private void FinishFeatureBranchCommand(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(EnvHelper.SolutionDir))
            {
                return;
            }
            var featureBranch = GitHelper.GetCurrentBranchName(false);
            var featureName   = GitHelper.GetCurrentBranchName(true);

            EnvHelper.GetGitConfig();
            var flowOptions       = GitHelper.GetGitConfig();
            var mainFeatureBranch = flowOptions.LastFeatureBranchFullName;

            /* 1. Switch to the main feature branch
             * 2. Pull latest changes on main feature branch
             * 3. Merge the feature branch to main feature branch
             * 4. Push all changes to main feature branch
             * 5. Delete the local feature branch
             * 6. Delete the remote feature branch
             */

            ProcessHelper.StartProcessGui(
                "cmd.exe",
                $"/c cd \"{EnvHelper.SolutionDir}\" && " +
                GitHelper.GetSshSetup() +
                FormatCliCommand($"checkout {mainFeatureBranch}") +
                FormatCliCommand("pull") +
                FormatCliCommand($"merge --no-ff {featureBranch}", false),
                $"Finishing feature-branch into main: {featureName}",
                featureBranch, null, _options, FormatCliCommand($"push origin {mainFeatureBranch}")
                );
        }
Ejemplo n.º 2
0
 private void PreCommand()
 {
     EnvHelper.GetGitConfig();
     EnvHelper.GetBranchName();
     EnvHelper.GetStash();
     FileHelper.SaveAllFiles(_dte);
 }
Ejemplo n.º 3
0
 public void SolutionEvents_Opened()
 {
     EnvHelper.GetTortoiseGitProc();
     EnvHelper.GetGit();
     EnvHelper.GetSolutionDir(_dte);
     EnvHelper.GetGitConfig();
     EnvHelper.GetBranchName();
     EnvHelper.GetStash();
 }
Ejemplo n.º 4
0
        private void FinishHotfixCommand(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(EnvHelper.SolutionDir))
            {
                return;
            }
            var hotfixBranch = GitHelper.GetCurrentBranchName(false);
            var hotfixName   = GitHelper.GetCurrentBranchName(true);

            EnvHelper.GetGitConfig();

            /* 1. Switch to the master branch
             * 2. Pull latest changes on master
             * 3. Merge the hotfix branch to master
             * 4. Tag the hotfix
             * 5. Switch to the develop branch
             * 6. Pull latest changes on develop
             * 7. Merge the hotfix branch to develop
             * 8. Push all changes to develop
             * 9. Push all changes to master
             * 10. Push the tag
             * 11. Delete the local hotfix branch
             * 12. Delete the remote hotfix branch
             */
            ProcessHelper.StartProcessGui(
                "cmd.exe",
                $"/c cd \"{EnvHelper.SolutionDir}\" && " +
                GitHelper.GetSshSetup() +
                FormatCliCommand($"checkout {EnvHelper.GitConfig.MasterBranch}") +
                FormatCliCommand("pull") +
                FormatCliCommand($"merge --no-ff {hotfixBranch}") +
                FormatCliCommand($"tag {EnvHelper.GitConfig.TagPrefix}{hotfixName}") +
                FormatCliCommand($"checkout {EnvHelper.GitConfig.DevelopBranch}") +
                FormatCliCommand("pull") +
                FormatCliCommand($"merge --no-ff {hotfixBranch}", false),
                $"Finishing hotfix {hotfixName}",
                hotfixBranch, null, _options,
                FormatCliCommand($"push origin {EnvHelper.GitConfig.DevelopBranch}") +
                FormatCliCommand($"push origin {EnvHelper.GitConfig.MasterBranch}") +
                FormatCliCommand($"push origin {EnvHelper.GitConfig.TagPrefix}{hotfixName}")
                );
        }
Ejemplo n.º 5
0
        private void InitCommand(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(EnvHelper.SolutionDir))
            {
                return;
            }

            var flowDialog = new FlowDialog();

            if (flowDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var versionTag = string.IsNullOrEmpty(flowDialog.GitConfig.TagPrefix) ? "\"\"" : flowDialog.GitConfig.TagPrefix;

            /* 1. Add GitFlow config options
             * 2. Checkout develop branch (create if it doesn't exist, reset if it does)
             * 3. Push develop branch
             */
            var process = ProcessHelper.StartProcessGui(
                "cmd.exe",
                $"/c cd \"{EnvHelper.SolutionDir}\" && " +
                GitHelper.GetSshSetup() +
                FormatCliCommand($"config --add gitflow.branch.master {flowDialog.GitConfig.MasterBranch}") +
                FormatCliCommand($"config --add gitflow.branch.develop {flowDialog.GitConfig.DevelopBranch}") +
                FormatCliCommand($"config --add gitflow.prefix.feature {flowDialog.GitConfig.FeaturePrefix}") +
                FormatCliCommand($"config --add gitflow.prefix.release {flowDialog.GitConfig.ReleasePrefix}") +
                FormatCliCommand($"config --add gitflow.prefix.hotfix {flowDialog.GitConfig.HotfixPrefix}") +
                FormatCliCommand($"config --add gitflow.prefix.versiontag {versionTag}") +
                (GitHelper.RemoteBranchExists(flowDialog.GitConfig.DevelopBranch) ?
                 "echo." :
                 FormatCliCommand($"checkout -b {flowDialog.GitConfig.DevelopBranch}", false)),
                "Initializing GitFlow"
                );

            process.WaitForExit();

            EnvHelper.GetGitConfig();
            EnvHelper.GetBranchName();
        }