public void CanTakeVersionFromHotfixesBranch() { using (var fixture = new BaseGitFlowRepositoryFixture(r => { r.MakeATaggedCommit("1.0.0"); r.MakeATaggedCommit("1.1.0"); r.MakeATaggedCommit("2.0.0"); })) { // Merge hotfix branch to support fixture.Repository.Checkout("master"); fixture.Repository.Checkout(fixture.Repository.CreateBranch("support-1.1", (Commit)fixture.Repository.Tags.Single(t => t.FriendlyName == "1.1.0").Target)); fixture.AssertFullSemver("1.1.0"); // create hotfix branch fixture.Repository.Checkout(fixture.Repository.CreateBranch("hotfixes/1.1.1")); fixture.AssertFullSemver("1.1.0"); // We are still on a tagged commit fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+2"); } }
public void BetaBranchCreatedButStillOnTaggedAlphaCommitShouldCreateBetaVersion() { // Arrange var config = new Config { Branches = { { "release", new BranchConfig { Tag = "beta" } }, { "develop", new BranchConfig { Tag = "alpha" } } } }; // Act using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.Checkout("develop"); fixture.MakeATaggedCommit("1.1.0-alpha.1"); // assuming this has been build as 1.1.0-alpha.1 fixture.BranchTo("release/1.1.0"); // about to be released, no additional empty commit in this scenario! fixture.Checkout("release/1.1.0"); // still on the same commit, but another branch, choosing to build same code as beta now // Assert fixture.AssertFullSemver("1.1.0-beta.1", config); //will be 1.1.0-alpha.1, should be 1.1.0-beta.1. Tag is an "alpha" tag from develop branch, only "beta" tags should count when on release branch. If no beta tag found, build new beta version on release branch. fixture.Checkout("develop"); // back to develop fixture.AssertFullSemver("1.1.0-alpha.1", config); //will be 1.1.0-alpha.1 based on tag (as before) }
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"); }
public void PatchLatestReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture("1.2.0")) { // create hotfix fixture.Repository.CreateBranch("hotfix-1.2.1").Checkout(); fixture.AssertFullSemver("1.2.1-beta.1+0"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+1"); fixture.Repository.ApplyTag("1.2.1-beta.1"); fixture.AssertFullSemver("1.2.1-beta.1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.2+2"); // Merge hotfix branch to master fixture.Repository.Checkout("master"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.2.1+0"); fixture.Repository.ApplyTag("1.2.1"); fixture.AssertFullSemver("1.2.1"); // Verify develop version fixture.Repository.Checkout("develop"); fixture.AssertFullSemver("1.3.0-unstable.1"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.3.0-unstable.0"); } }
public void PatchLatestReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture("1.2.0")) { // create hotfix fixture.Repository.Checkout("master"); fixture.Repository.CreateBranch("hotfix-1.2.1").Checkout(); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+2"); fixture.Repository.ApplyTag("1.2.1-beta.1"); fixture.AssertFullSemver("1.2.1-beta.1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.2+3"); // Merge hotfix branch to master fixture.Repository.Checkout("master"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.2.1+4"); fixture.Repository.ApplyTag("1.2.1"); fixture.AssertFullSemver("1.2.1"); // Verify develop version fixture.Repository.Checkout("develop"); fixture.AssertFullSemver("1.3.0-unstable.1"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.3.0-unstable.5"); } }
// This test actually validates #465 as well public void PatchLatestReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture("1.2.0")) { // create hotfix Commands.Checkout(fixture.Repository, "master"); Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("hotfix-1.2.1")); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+2"); fixture.Repository.ApplyTag("1.2.1-beta.1"); fixture.AssertFullSemver("1.2.1-beta.1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.2+3"); // Merge hotfix branch to master Commands.Checkout(fixture.Repository, "master"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Generate.SignatureNow()); fixture.AssertFullSemver("1.2.1+4"); fixture.Repository.ApplyTag("1.2.1"); fixture.AssertFullSemver("1.2.1"); // Verify develop version Commands.Checkout(fixture.Repository, "develop"); fixture.AssertFullSemver("1.3.0-alpha.1"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Generate.SignatureNow()); fixture.AssertFullSemver("1.3.0-alpha.5"); } }
public void PatchLatestReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture("1.2.0")) { // create hotfix Commands.Checkout(fixture.Repository, "master"); Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("hotfix-1.2.1")); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+2"); fixture.Repository.ApplyTag("1.2.1-beta.1"); fixture.AssertFullSemver("1.2.1-beta.1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.2+3"); // Merge hotfix branch to master Commands.Checkout(fixture.Repository, "master"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Generate.SignatureNow()); fixture.AssertFullSemver("1.2.1+4"); fixture.Repository.ApplyTag("1.2.1"); fixture.AssertFullSemver("1.2.1"); // Verify develop version Commands.Checkout(fixture.Repository, "develop"); fixture.AssertFullSemver("1.3.0-alpha.1"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Generate.SignatureNow()); fixture.AssertFullSemver("1.3.0-alpha.5"); } }
public void TagOnHotfixShouldNotAffectDevelop() { using var fixture = new BaseGitFlowRepositoryFixture("1.2.0"); Commands.Checkout(fixture.Repository, "master"); var hotfix = fixture.Repository.CreateBranch("hotfix-1.2.1"); Commands.Checkout(fixture.Repository, hotfix); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+1"); fixture.Repository.ApplyTag("1.2.1-beta.1"); fixture.AssertFullSemver("1.2.1-beta.1"); Commands.Checkout(fixture.Repository, "develop"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.3.0-alpha.2"); }
public void PatchOlderReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture(r => { r.MakeATaggedCommit("1.0.0"); r.MakeATaggedCommit("1.1.0"); r.MakeATaggedCommit("2.0.0"); })) { // Merge hotfix branch to support fixture.Repository.CreateBranch("support-1.1", (Commit)fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout(); fixture.AssertFullSemver("1.1.0"); // create hotfix branch fixture.Repository.CreateBranch("hotfix-1.1.1").Checkout(); fixture.AssertFullSemver("1.1.0"); // We are still on a tagged commit fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+2"); // Create feature branch off hotfix branch and complete fixture.Repository.CreateBranch("feature/fix").Checkout(); fixture.AssertFullSemver("1.1.1-fix.1+2"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-fix.1+3"); fixture.Repository.CreatePullRequest("feature/fix", "hotfix-1.1.1", isRemotePr: false); fixture.AssertFullSemver("1.1.1-PullRequest.2+4"); fixture.Repository.Checkout("hotfix-1.1.1"); fixture.Repository.MergeNoFF("feature/fix", Constants.SignatureNow()); fixture.AssertFullSemver("1.1.1-beta.1+1"); // Merge hotfix into support branch to complete hotfix fixture.Repository.Checkout("support-1.1"); fixture.Repository.MergeNoFF("hotfix-1.1.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.1.1+0"); fixture.Repository.ApplyTag("1.1.1"); fixture.AssertFullSemver("1.1.1"); // Verify develop version fixture.Repository.Checkout("develop"); fixture.AssertFullSemver("2.1.0-unstable.1"); fixture.Repository.MergeNoFF("support-1.1", Constants.SignatureNow()); fixture.AssertFullSemver("2.1.0-unstable.7"); } }
public void TakesVersionFromNameOfReleaseBranch() { using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.CreateAndMergeBranchIntoDevelop("release/2.0.0"); fixture.AssertFullSemver("2.1.0-alpha.2"); }
public void TakesVersionFromNameOfReleaseBranch() { using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.BranchTo("release/2.0.0"); fixture.AssertFullSemver("2.0.0-beta.1+0"); }
public void DoesNotTakeVersionFromNameOfNonReleaseBranch() { using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.BranchTo("feature/upgrade-power-level-to-9000.0.1"); fixture.AssertFullSemver("1.1.0-upgrade-power-level-to-9000-0-1.1+1"); }
public void TagPreReleaseWeightIsConfigured_GitFlowReleaseIsFinished_WeightedPreReleaseNumberShouldBeTheSameAsTheTagPreReleaseWeight() { // Arrange var config = new TestableConfig() { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}", TagPreReleaseWeight = 65535, VersioningMode = VersioningMode.ContinuousDeployment }; config.ApplyDefaults(); // Act using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.Checkout("master"); fixture.MergeNoFF("develop"); fixture.Checkout("develop"); fixture.MakeACommit("Feature commit 1"); fixture.BranchTo("release/1.1.0"); fixture.MakeACommit("Release commit 1"); fixture.AssertFullSemver("1.1.0-beta.1", config); fixture.ApplyTag("1.1.0"); var version = fixture.GetVersion(config); // Assert version.AssemblySemFileVer.ShouldBe("1.1.0.65535"); }
public void TagPreReleaseWeightIsNotConfigured_GitFlowReleaseIsFinished_WeightedPreReleaseNumberShouldBeTheDefaultValue() { // Arrange var config = new ConfigurationBuilder() .Add(new Config { AssemblyFileVersioningFormat = "{Major}.{Minor}.{Patch}.{WeightedPreReleaseNumber}", VersioningMode = VersioningMode.ContinuousDeployment }) .Build(); // Act using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.Checkout(TestBase.MainBranch); fixture.MergeNoFF("develop"); fixture.Checkout("develop"); fixture.MakeACommit("Feature commit 1"); fixture.BranchTo("release/1.1.0"); fixture.MakeACommit("Release commit 1"); fixture.AssertFullSemver("1.1.0-beta.1", config); fixture.ApplyTag("1.1.0"); var version = fixture.GetVersion(config); // Assert version.AssemblySemFileVer.ShouldBe("1.1.0.60000"); }
public void DoesNotTakeVersionFromNameOfNonReleaseBranch() { using var fixture = new BaseGitFlowRepositoryFixture("1.0.0"); fixture.CreateAndMergeBranchIntoDevelop("pull-request/improved-by-upgrading-some-lib-to-4.5.6"); fixture.CreateAndMergeBranchIntoDevelop("hotfix/downgrade-some-lib-to-3.2.1-to-avoid-breaking-changes"); fixture.AssertFullSemver("1.1.0-alpha.5"); }
public void PatchOlderReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture(r => { r.MakeATaggedCommit("1.0.0"); r.MakeATaggedCommit("1.1.0"); r.MakeATaggedCommit("1.2.0"); })) { // create hotfix branch fixture.Repository.CreateBranch("hotfix-1.1.1", (Commit)fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout(); fixture.AssertFullSemver("1.1.1-beta.1+0"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+1"); // Merge hotfix branch to support fixture.Repository.CreateBranch("support-1.2", (Commit)fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout(); fixture.AssertFullSemver("1.1.0"); fixture.Repository.MergeNoFF("hotfix-1.1.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.1.1"); fixture.Repository.ApplyTag("1.1.1"); fixture.AssertFullSemver("1.1.1"); // Verify develop version fixture.Repository.Checkout("develop"); fixture.AssertFullSemver("1.3.0-unstable.0+0"); } }
public void PatchOlderReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture(r => { r.MakeATaggedCommit("1.0.0"); r.MakeATaggedCommit("1.1.0"); r.MakeATaggedCommit("1.2.0"); })) { // create hotfix branch fixture.Repository.CreateBranch("hotfix-1.1.1", (Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout(); fixture.AssertFullSemver("1.1.1-beta.1+0"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+1"); // Merge hotfix branch to support fixture.Repository.CreateBranch("support-1.2", (Commit) fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target).Checkout(); fixture.AssertFullSemver("1.1.0"); fixture.Repository.MergeNoFF("hotfix-1.1.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.1.1"); fixture.Repository.ApplyTag("1.1.1"); fixture.AssertFullSemver("1.1.1"); // Verify develop version fixture.Repository.Checkout("develop"); fixture.AssertFullSemver("1.3.0-unstable.0+0"); } }
public void CanTakeVersionFromHotfixesBranch() { using var fixture = new BaseGitFlowRepositoryFixture(r => { r.MakeATaggedCommit("1.0.0"); r.MakeATaggedCommit("1.1.0"); r.MakeATaggedCommit("2.0.0"); }); // Merge hotfix branch to support Commands.Checkout(fixture.Repository, "master"); Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("support-1.1", (Commit)fixture.Repository.Tags.Single(t => t.FriendlyName == "1.1.0").Target)); fixture.AssertFullSemver("1.1.0"); // create hotfix branch Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("hotfixes/1.1.1")); fixture.AssertFullSemver("1.1.0"); // We are still on a tagged commit fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+2"); }
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"); } }
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.CreateAndMergeBranchIntoDevelop("support/2.0.0"); fixture.AssertFullSemver("2.1.0-alpha.2", config); }
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"); }
public void PatchLatestReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture("1.2.0")) { // create hotfix fixture.Repository.CreateBranch("hotfix-1.2.1").Checkout(); fixture.AssertFullSemver("1.2.1-beta.1+0"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+1"); fixture.Repository.ApplyTag("1.2.1-beta.1"); fixture.AssertFullSemver("1.2.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.2+2"); // Merge hotfix branch to master fixture.Repository.Checkout("master"); fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.2.1"); fixture.Repository.ApplyTag("1.2.1"); fixture.AssertFullSemver("1.2.1"); // Verify develop version fixture.Repository.Checkout("develop"); fixture.AssertFullSemver("1.3.0-unstable.0+0"); // Warning: Hack-ish hack // // Ensure the merge commit is done at a different time than the previous one // Otherwise, as they would have the same content and signature, the same sha would be generated. // Thus 'develop' and 'master' would point at the same exact commit and the Assert below would fail. Thread.Sleep(1000); fixture.Repository.MergeNoFF("hotfix-1.2.1", Constants.SignatureNow()); fixture.AssertFullSemver("1.3.0-unstable.1+1"); } }
public void SupportIsCalculatedCorrectly() { using (var fixture = new BaseGitFlowRepositoryFixture("1.1.0")) { // Create 2.0.0 release fixture.Repository.CreateBranch("release-2.0.0").Checkout(); fixture.Repository.MakeCommits(2); // Merge into develop and master fixture.Repository.Checkout("master"); fixture.Repository.MergeNoFF("release-2.0.0"); fixture.Repository.ApplyTag("2.0.0"); fixture.Repository.Checkout("develop"); fixture.Repository.MergeNoFF("release-2.0.0"); fixture.AssertFullSemver("2.1.0-unstable.0+0"); // Now lets support 1.x release fixture.Repository.Checkout("1.1.0"); fixture.Repository.CreateBranch("support/1.0.0").Checkout(); fixture.AssertFullSemver("1.1.0"); // Create release branch from support branch fixture.Repository.CreateBranch("release/1.2.0").Checkout(); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.0-beta.1+1"); // Create 1.2.0 release fixture.Repository.Checkout("support/1.0.0"); fixture.Repository.MergeNoFF("release/1.2.0"); fixture.AssertFullSemver("1.2.0"); fixture.Repository.ApplyTag("1.2.0"); // Create 1.2.1 hotfix fixture.Repository.CreateBranch("hotfix/1.2.1").Checkout(); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.2.1-beta.1+3"); // TODO This should be +1 fixture.Repository.Checkout("support/1.0.0"); fixture.Repository.MergeNoFF("hotfix/1.2.1"); fixture.AssertFullSemver("1.2.1"); } }
public void PatchOlderReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture(r => { r.MakeATaggedCommit("1.0.0"); r.MakeATaggedCommit("1.1.0"); r.MakeATaggedCommit("2.0.0"); })) { // Merge hotfix branch to support Commands.Checkout(fixture.Repository, "master"); var tag = fixture.Repository.Tags.Single(t => t.FriendlyName == "1.1.0"); var supportBranch = fixture.Repository.CreateBranch("support-1.1", (Commit)tag.Target); Commands.Checkout(fixture.Repository, supportBranch); fixture.AssertFullSemver("1.1.0"); // create hotfix branch Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("hotfix-1.1.1")); fixture.AssertFullSemver("1.1.0"); // We are still on a tagged commit fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+2"); // Create feature branch off hotfix branch and complete Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("feature/fix")); fixture.AssertFullSemver("1.1.1-fix.1+2"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-fix.1+3"); fixture.Repository.CreatePullRequestRef("feature/fix", "hotfix-1.1.1", normalise: true, prNumber: 8); fixture.AssertFullSemver("1.1.1-PullRequest0008.4"); Commands.Checkout(fixture.Repository, "hotfix-1.1.1"); fixture.Repository.MergeNoFF("feature/fix", Generate.SignatureNow()); fixture.AssertFullSemver("1.1.1-beta.1+4"); // Merge hotfix into support branch to complete hotfix Commands.Checkout(fixture.Repository, "support-1.1"); fixture.Repository.MergeNoFF("hotfix-1.1.1", Generate.SignatureNow()); fixture.AssertFullSemver("1.1.1+5"); fixture.Repository.ApplyTag("1.1.1"); fixture.AssertFullSemver("1.1.1"); // Verify develop version Commands.Checkout(fixture.Repository, "develop"); fixture.AssertFullSemver("2.1.0-alpha.1"); fixture.Repository.MergeNoFF("support-1.1", Generate.SignatureNow()); fixture.AssertFullSemver("2.1.0-alpha.7"); } }
public void PatchOlderReleaseExample() { using (var fixture = new BaseGitFlowRepositoryFixture(r => { r.MakeATaggedCommit("1.0.0"); r.MakeATaggedCommit("1.1.0"); r.MakeATaggedCommit("2.0.0"); })) { // Merge hotfix branch to support fixture.Repository.Checkout("master"); var tag = fixture.Repository.Tags.Single(t => t.FriendlyName == "1.1.0"); var supportBranch = fixture.Repository.CreateBranch("support-1.1", (Commit) tag.Target); fixture.Repository.Checkout(supportBranch); fixture.AssertFullSemver("1.1.0"); // create hotfix branch fixture.Repository.Checkout(fixture.Repository.CreateBranch("hotfix-1.1.1")); fixture.AssertFullSemver("1.1.0"); // We are still on a tagged commit fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+1"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-beta.1+2"); // Create feature branch off hotfix branch and complete fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/fix")); fixture.AssertFullSemver("1.1.1-fix.1+2"); fixture.Repository.MakeACommit(); fixture.AssertFullSemver("1.1.1-fix.1+3"); fixture.Repository.CreatePullRequestRef("feature/fix", "hotfix-1.1.1", normalise: true); fixture.AssertFullSemver("1.1.1-PullRequest.2+4"); fixture.Repository.Checkout("hotfix-1.1.1"); fixture.Repository.MergeNoFF("feature/fix", Generate.SignatureNow()); fixture.AssertFullSemver("1.1.1-beta.1+4"); // Merge hotfix into support branch to complete hotfix fixture.Repository.Checkout("support-1.1"); fixture.Repository.MergeNoFF("hotfix-1.1.1", Generate.SignatureNow()); fixture.AssertFullSemver("1.1.1+5"); fixture.Repository.ApplyTag("1.1.1"); fixture.AssertFullSemver("1.1.1"); // Verify develop version fixture.Repository.Checkout("develop"); fixture.AssertFullSemver("2.1.0-alpha.1"); fixture.Repository.MergeNoFF("support-1.1", Generate.SignatureNow()); fixture.AssertFullSemver("2.1.0-alpha.7"); } }
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"); }