Exemplo n.º 1
0
        public void TakesVersionFromNameOfBranchThatIsReleaseByConfig()
        {
            var config = new Config
            {
                Branches = new Dictionary <string, BranchConfig> {
                    { "support", new BranchConfig {
                          IsReleaseBranch = true
                      } }
                }
            };

            using (var fixture = new BaseGitFlowRepositoryFixture("1.0.0"))
            {
                fixture.BranchTo("support/2.0.0");

                fixture.AssertFullSemver(config, "2.0.0+1");
            }
        }
Exemplo n.º 2
0
    public void BranchCreatedAfterFinishReleaseShouldInheritAndIncrementFromLastMasterCommitTag()
    {
        using (var fixture = new BaseGitFlowRepositoryFixture("0.1.0"))
        {
            //validate current version
            fixture.AssertFullSemver("0.2.0-alpha.1");
            fixture.Repository.CreateBranch("release/0.2.0");
            Commands.Checkout(fixture.Repository, "release/0.2.0");

            //validate release version
            fixture.AssertFullSemver("0.2.0-beta.1+0");

            fixture.Checkout("master");
            fixture.Repository.MergeNoFF("release/0.2.0");
            fixture.Repository.ApplyTag("0.2.0");

            //validate master branch version
            fixture.AssertFullSemver("0.2.0");

            fixture.Checkout("develop");
            fixture.Repository.MergeNoFF("release/0.2.0");
            fixture.Repository.Branches.Remove("release/2.0.0");

            fixture.Repository.MakeACommit();

            //validate develop branch version after merging release 0.2.0 to master and develop (finish release)
            fixture.AssertFullSemver("0.3.0-alpha.1");

            //create a feature branch from develop
            fixture.BranchTo("feature/TEST-1");
            fixture.Repository.MakeACommit();

            //I'm not entirely sure what the + value should be but I know the semvar major/minor/patch should be 0.3.0
            fixture.AssertFullSemver("0.3.0-TEST-1.1+2");
        }
    }
Exemplo n.º 3
0
    public void BranchCreatedAfterFinishReleaseShouldInheritAndIncrementFromLastMasterCommitTag()
    {
        using (var fixture = new BaseGitFlowRepositoryFixture("0.1.0"))
        {
            //validate current version
            fixture.AssertFullSemver("0.2.0-alpha.1");
            fixture.Repository.CreateBranch("release/0.2.0");
            Commands.Checkout(fixture.Repository, "release/0.2.0");

            //validate release version
            fixture.AssertFullSemver("0.2.0-beta.1+0");

            fixture.Checkout("master");
            fixture.Repository.MergeNoFF("release/0.2.0");
            fixture.Repository.ApplyTag("0.2.0");

            //validate master branch version
            fixture.AssertFullSemver("0.2.0");

            fixture.Checkout("develop");
            fixture.Repository.MergeNoFF("release/0.2.0");
            fixture.Repository.Branches.Remove("release/2.0.0");

            fixture.Repository.MakeACommit();

            //validate develop branch version after merging release 0.2.0 to master and develop (finish release)
            fixture.AssertFullSemver("0.3.0-alpha.1");

            //create a feature branch from develop
            fixture.BranchTo("feature/TEST-1");
            fixture.Repository.MakeACommit();

            //I'm not entirely sure what the + value should be but I know the semvar major/minor/patch should be 0.3.0
            fixture.AssertFullSemver("0.3.0-TEST-1.1+2");
        }
    }
Exemplo n.º 4
0
        public void GitflowComplexExample()
        {
            const string developBranch  = "develop";
            const string feature1Branch = "feature/f1";
            const string feature2Branch = "feature/f2";
            const string release1Branch = "release/1.1.0";
            const string release2Branch = "release/1.2.0";
            const string hotfixBranch   = "hotfix/hf";

            using var fixture = new BaseGitFlowRepositoryFixture("1.0.0");
            fixture.AssertFullSemver("1.1.0-alpha.1");

            // Feature 1
            fixture.BranchTo(feature1Branch);
            fixture.MakeACommit("added feature 1");
            fixture.AssertFullSemver("1.1.0-f1.1+2");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(feature1Branch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[feature1Branch]);
            fixture.AssertFullSemver("1.1.0-alpha.3");

            // Release 1.1.0
            fixture.BranchTo(release1Branch);
            fixture.MakeACommit("release stabilization");
            fixture.AssertFullSemver("1.1.0-beta.1+1");
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF(release1Branch);
            fixture.AssertFullSemver("1.1.0+0");
            fixture.ApplyTag("1.1.0");
            fixture.AssertFullSemver("1.1.0");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(release1Branch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[release1Branch]);
            fixture.AssertFullSemver("1.2.0-alpha.1");

            // Feature 2
            fixture.BranchTo(feature2Branch);
            fixture.MakeACommit("added feature 2");
            fixture.AssertFullSemver("1.2.0-f2.1+2");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(feature2Branch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[feature2Branch]);
            fixture.AssertFullSemver("1.2.0-alpha.3");

            // Release 1.2.0
            fixture.BranchTo(release2Branch);
            fixture.MakeACommit("release stabilization");
            fixture.AssertFullSemver("1.2.0-beta.1+1");
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF(release2Branch);
            fixture.AssertFullSemver("1.2.0+0");
            fixture.ApplyTag("1.2.0");
            fixture.AssertFullSemver("1.2.0");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(release2Branch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[release2Branch]);
            fixture.AssertFullSemver("1.3.0-alpha.1");

            // Hotfix
            fixture.Checkout(MainBranch);
            fixture.BranchTo(hotfixBranch);
            fixture.MakeACommit("added hotfix");
            fixture.AssertFullSemver("1.2.1-beta.1+1");
            fixture.Checkout(MainBranch);
            fixture.MergeNoFF(hotfixBranch);
            fixture.AssertFullSemver("1.2.1+2");
            fixture.ApplyTag("1.2.1");
            fixture.AssertFullSemver("1.2.1");
            fixture.Checkout(developBranch);
            fixture.MergeNoFF(hotfixBranch);
            fixture.Repository.Branches.Remove(fixture.Repository.Branches[hotfixBranch]);
            fixture.AssertFullSemver("1.3.0-alpha.3");
        }