Пример #1
0
        public void TakesVersionFromNameOfRemoteReleaseBranchInOrigin()
        {
            using var fixture = new RemoteRepositoryFixture();
            fixture.BranchTo("release/2.0.0");
            fixture.MakeACommit();
            Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null);

            fixture.LocalRepositoryFixture.Checkout("origin/release/2.0.0");

            fixture.LocalRepositoryFixture.AssertFullSemver("2.0.0-beta.1+1");
        }
    public void TakesVersionFromNameOfRemoteReleaseBranchInOrigin()
    {
        using var fixture = new RemoteRepositoryFixture();
        fixture.BranchTo("release/2.0.0");
        fixture.MakeACommit();
        Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, Array.Empty <string>(), new FetchOptions(), null);

        fixture.LocalRepositoryFixture.MergeNoFF("origin/release/2.0.0");

        fixture.LocalRepositoryFixture.AssertFullSemver("2.0.0+0");
    }
Пример #3
0
        public void DoesNotTakeVersionFromNameOfRemoteReleaseBranchInCustomRemote()
        {
            using var fixture = new RemoteRepositoryFixture();
            fixture.LocalRepositoryFixture.Repository.Network.Remotes.Rename("origin", "upstream");
            fixture.BranchTo("release/2.0.0");
            fixture.MakeACommit();
            Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null);

            fixture.LocalRepositoryFixture.Checkout("upstream/release/2.0.0");

            fixture.LocalRepositoryFixture.AssertFullSemver("0.1.0-beta.1+5");
        }
    public void FindCommitBranchWasBranchedFromShouldReturnNullIfTheRemoteIsTheOnlySource()
    {
        using var fixture = new RemoteRepositoryFixture();
        fixture.MakeACommit("initial");

        var localRepository = fixture.LocalRepositoryFixture.Repository.ToGitRepository();

        var gitRepoMetadataProvider = new RepositoryStore(this.log, localRepository, this.incrementStrategyFinder);

        var branchedCommit = gitRepoMetadataProvider.FindCommitBranchWasBranchedFrom(localRepository.FindBranch("main"), new Model.Configuration.Config(), Array.Empty <IBranch>());

        Assert.IsNull(branchedCommit.Branch);
        Assert.IsNull(branchedCommit.Commit);
    }
        public void CanTakeVersionFromNameOfRemoteReleaseBranch(string branchName, string expectedBaseVersion)
        {
            using var fixture = new RemoteRepositoryFixture();
            var branch = fixture.Repository.CreateBranch(branchName);

            Commands.Checkout(fixture.Repository, branch);
            fixture.MakeACommit();

            Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null);
            fixture.LocalRepositoryFixture.Checkout($"origin/{branchName}");

            var strategy    = GetVersionStrategy(fixture.RepositoryPath, fixture.Repository, branchName);
            var baseVersion = strategy.GetVersions().Single();

            baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion);
        }
        public void CanTakeVersionFromNameOfRemoteReleaseBranch(string branchName, string expectedBaseVersion)
        {
            using var fixture = new RemoteRepositoryFixture();
            var branch = fixture.Repository.CreateBranch(branchName);

            Commands.Checkout(fixture.Repository, branch);
            fixture.MakeACommit();

            Commands.Fetch((Repository)fixture.LocalRepositoryFixture.Repository, fixture.LocalRepositoryFixture.Repository.Network.Remotes.First().Name, new string[0], new FetchOptions(), null);
            fixture.LocalRepositoryFixture.Checkout($"origin/{branchName}");

            var sut = new VersionInBranchNameVersionStrategy();
            var gitVersionContext = new GitVersionContext(fixture.Repository, new NullLog(), branch, new Config().ApplyDefaults());
            var baseVersion       = sut.GetVersions(gitVersionContext).Single();

            baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion);
        }