本文整理汇总了C#中EmptyRepositoryFixture类的典型用法代码示例。如果您正苦于以下问题:C# EmptyRepositoryFixture类的具体用法?C# EmptyRepositoryFixture怎么用?C# EmptyRepositoryFixture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EmptyRepositoryFixture类属于命名空间,在下文中一共展示了EmptyRepositoryFixture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GitFlowPullRequestBranch
public void GitFlowPullRequestBranch()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Participant("master");
fixture.Participant("develop");
// GitFlow setup
fixture.Repository.MakeACommit();
fixture.ApplyTag("1.2.0");
fixture.BranchTo("develop");
// Branch to develop
fixture.MakeACommit();
fixture.AssertFullSemver("1.3.0-unstable.1");
// Open Pull Request
fixture.BranchTo("pull/2/merge", "pr");
fixture.Activate("pull/2/merge");
fixture.AssertFullSemver("1.3.0-PullRequest.2+1");
fixture.MakeACommit();
fixture.AssertFullSemver("1.3.0-PullRequest.2+2");
// Merge into develop
fixture.Checkout("develop");
fixture.MergeNoFF("pull/2/merge");
fixture.Destroy("pull/2/merge");
fixture.NoteOver("Feature branches/pr's should\r\n" +
"be deleted once merged", "pull/2/merge");
fixture.AssertFullSemver("1.3.0-unstable.3");
}
}
示例2: RepositoryScope
string RepositoryScope(ExecuteCore executeCore = null, Action<EmptyRepositoryFixture, VersionVariables> fixtureAction = null)
{
// Make sure GitVersion doesn't trigger build server mode when we are running the tests
Environment.SetEnvironmentVariable("APPVEYOR", null);
var infoBuilder = new StringBuilder();
Action<string> infoLogger = s => { infoBuilder.AppendLine(s); };
executeCore = executeCore ?? new ExecuteCore(fileSystem);
Logger.SetLoggers(infoLogger, s => { }, s => { });
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeACommit();
var vv = executeCore.ExecuteGitVersion(null, null, null, null, false, fixture.RepositoryPath, null);
vv.AssemblySemVer.ShouldBe("0.1.0.0");
vv.FileName.ShouldNotBeNullOrEmpty();
if (fixtureAction != null)
{
fixtureAction(fixture, vv);
}
}
return infoBuilder.ToString();
}
示例3: NormalisationOfTag
public void NormalisationOfTag()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
fixture.Repository.MakeACommit();
fixture.BranchTo("release/2.0.0");
fixture.MakeACommit();
fixture.MakeATaggedCommit("2.0.0-rc.1");
fixture.Checkout("master");
fixture.MergeNoFF("release/2.0.0");
fixture.Repository.Branches.Remove(fixture.Repository.FindBranch("release/2.0.0"));
var remoteTagSha = fixture.Repository.Tags["2.0.0-rc.1"].Target.Sha;
using (var localFixture = fixture.CloneRepository())
{
localFixture.Checkout(remoteTagSha);
GitHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new Authentication(), noFetch: false, currentBranch: string.Empty);
localFixture.AssertFullSemver("2.0.0-rc.1");
}
}
}
示例4: GitFlowFeatureBranch
public void GitFlowFeatureBranch()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.SequenceDiagram.Participant("master");
fixture.SequenceDiagram.Participant("develop");
// GitFlow setup
fixture.Repository.MakeACommit();
fixture.ApplyTag("1.2.0");
fixture.BranchTo("develop");
// Branch to develop
fixture.MakeACommit();
fixture.AssertFullSemver("1.3.0-unstable.1");
// Open Pull Request
fixture.BranchTo("feature/myfeature", "feature");
fixture.SequenceDiagram.Activate("feature/myfeature");
fixture.AssertFullSemver("1.3.0-myfeature.1+1");
fixture.MakeACommit();
fixture.AssertFullSemver("1.3.0-myfeature.1+2");
// Merge into develop
fixture.Checkout("develop");
fixture.MergeNoFF("feature/myfeature");
fixture.SequenceDiagram.Destroy("feature/myfeature");
fixture.SequenceDiagram.NoteOver("Feature branches should\r\n" +
"be deleted once merged", "feature/myfeature");
fixture.AssertFullSemver("1.3.0-unstable.3");
}
}
示例5: GitFlowPullRequestBranch
public void GitFlowPullRequestBranch()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.SequenceDiagram.Participant("master");
fixture.SequenceDiagram.Participant("develop");
// GitFlow setup
fixture.Repository.MakeACommit();
fixture.ApplyTag("1.2.0");
fixture.BranchTo("develop");
// Branch to develop
fixture.MakeACommit();
fixture.AssertFullSemver("1.3.0-alpha.1");
// Open Pull Request
fixture.BranchTo("pull/2/merge", "pr");
fixture.SequenceDiagram.Activate("pull/2/merge");
fixture.AssertFullSemver("1.3.0-PullRequest0002.1");
fixture.MakeACommit();
fixture.AssertFullSemver("1.3.0-PullRequest0002.2");
// Merge into develop
fixture.Checkout("develop");
fixture.MergeNoFF("pull/2/merge");
fixture.SequenceDiagram.Destroy("pull/2/merge");
fixture.SequenceDiagram.NoteOver("Feature branches/pr's should\r\n" +
"be deleted once merged", "pull/2/merge");
fixture.AssertFullSemver("1.3.0-alpha.3");
Console.WriteLine(fixture.SequenceDiagram.GetDiagram());
}
}
示例6: WhenMergingReleaseBackToDevShouldNotResetBetaVersion
public void WhenMergingReleaseBackToDevShouldNotResetBetaVersion()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
const string TaggedVersion = "1.0.3";
fixture.Repository.MakeATaggedCommit(TaggedVersion);
fixture.Repository.CreateBranch("develop");
fixture.Repository.Checkout("develop");
fixture.Repository.MakeCommits(1);
fixture.Repository.CreateBranch("release-2.0.0");
fixture.Repository.Checkout("release-2.0.0");
fixture.Repository.MakeCommits(1);
fixture.AssertFullSemver("2.0.0-beta.1+1");
//tag it to bump to beta 2
fixture.Repository.ApplyTag("2.0.0-beta1");
fixture.Repository.MakeCommits(1);
fixture.AssertFullSemver("2.0.0-beta.2+0");
//merge down to develop
fixture.Repository.Checkout("develop");
fixture.Repository.MergeNoFF("release-2.0.0", Constants.SignatureNow());
//but keep working on the release
fixture.Repository.Checkout("release-2.0.0");
fixture.AssertFullSemver("2.0.0-beta.2+0");
}
}
示例7: ShouldBePossibleToMergeDevelopForALongRunningBranchWhereDevelopAndMasterAreEqual
public void ShouldBePossibleToMergeDevelopForALongRunningBranchWhereDevelopAndMasterAreEqual()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeATaggedCommit("v1.0.0");
fixture.Repository.CreateBranch("develop");
fixture.Repository.Checkout("develop");
fixture.Repository.CreateBranch("feature/longrunning");
fixture.Repository.Checkout("feature/longrunning");
fixture.Repository.MakeACommit();
fixture.Repository.Checkout("develop");
fixture.Repository.MakeACommit();
fixture.Repository.Checkout("master");
fixture.Repository.Merge(fixture.Repository.Branches["develop"], Generate.SignatureNow());
fixture.Repository.ApplyTag("v1.1.0");
fixture.Repository.Checkout("feature/longrunning");
fixture.Repository.Merge(fixture.Repository.Branches["develop"], Generate.SignatureNow());
var configuration = new Config { VersioningMode = VersioningMode.ContinuousDeployment };
fixture.AssertFullSemver(configuration, "1.2.0-longrunning.2");
}
}
示例8: UsesGitVersionConfigWhenCreatingDynamicRepository
public void UsesGitVersionConfigWhenCreatingDynamicRepository()
{
var localRepoPath = PathHelper.GetTempPath();
var repoBasePath = Path.GetDirectoryName(PathHelper.GetTempPath());
Directory.CreateDirectory(localRepoPath);
try
{
using (var remote = new EmptyRepositoryFixture(new Config()))
{
remote.Repository.MakeACommit();
var configFile = Path.Combine(localRepoPath, "GitVersionConfig.yaml");
File.WriteAllText(configFile, "next-version: 1.0.0");
var arguments = string.Format(" /url {0} /dynamicRepoLocation {1} /b master", remote.RepositoryPath, repoBasePath);
var results = GitVersionHelper.ExecuteIn(localRepoPath, arguments, false);
results.OutputVariables.SemVer.ShouldBe("1.0.0");
}
}
finally
{
DeleteHelper.DeleteGitRepository(localRepoPath);
DeleteHelper.DeleteGitRepository(repoBasePath);
}
}
示例9: NormalisationOfTag
public void NormalisationOfTag()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
fixture.Repository.MakeACommit();
fixture.BranchTo("release/2.0.0");
fixture.MakeACommit();
fixture.MakeATaggedCommit("2.0.0-rc.1");
fixture.Checkout("master");
fixture.MergeNoFF("release/2.0.0");
fixture.Repository.Branches.Remove(fixture.Repository.Branches["release/2.0.0"]);
var remoteTagSha = fixture.Repository.Tags["2.0.0-rc.1"].Target.Sha;
using (var localFixture = fixture.CloneRepository())
{
localFixture.Checkout(remoteTagSha);
GitRepositoryHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new AuthenticationInfo(), noFetch: false, currentBranch: string.Empty);
localFixture.Repository.Head.FriendlyName.ShouldBe("(no branch)");
localFixture.Repository.Head.Tip.Sha.ShouldBe(remoteTagSha);
}
}
}
示例10: BranchCreatedAfterFastForwardMergeShouldInheritCorrectly
public void BranchCreatedAfterFastForwardMergeShouldInheritCorrectly()
{
var config = new Config();
config.Branches.Add("unstable", config.Branches["develop"]);
using (var fixture = new EmptyRepositoryFixture(config))
{
fixture.Repository.MakeATaggedCommit("1.0.0");
fixture.Repository.CreateBranch("unstable");
fixture.Repository.Checkout("unstable");
//Create an initial feature branch
var feature123 = fixture.Repository.CreateBranch("feature/JIRA-123");
fixture.Repository.Checkout("feature/JIRA-123");
fixture.Repository.MakeCommits(1);
//Merge it
fixture.Repository.Checkout("unstable");
fixture.Repository.Merge(feature123, SignatureBuilder.SignatureNow());
//Create a second feature branch
fixture.Repository.CreateBranch("feature/JIRA-124");
fixture.Repository.Checkout("feature/JIRA-124");
fixture.Repository.MakeCommits(1);
fixture.AssertFullSemver("1.1.0-JIRA-124.1+2");
}
}
示例11: BranchCreatedAfterFastForwardMergeShouldInheritCorrectly
public void BranchCreatedAfterFastForwardMergeShouldInheritCorrectly()
{
var config = new Config
{
Branches =
{
{ "unstable", new BranchConfig { Increment = IncrementStrategy.Minor } }
}
};
using (var fixture = new EmptyRepositoryFixture(config))
{
fixture.Repository.MakeATaggedCommit("1.0.0");
fixture.Repository.CreateBranch("unstable");
fixture.Repository.Checkout("unstable");
//Create an initial feature branch
var feature123 = fixture.Repository.CreateBranch("feature/JIRA-123");
fixture.Repository.Checkout("feature/JIRA-123");
fixture.Repository.MakeCommits(1);
//Merge it
fixture.Repository.Checkout("unstable");
fixture.Repository.Merge(feature123, Constants.SignatureNow());
//Create a second feature branch
fixture.Repository.CreateBranch("feature/JIRA-124");
fixture.Repository.Checkout("feature/JIRA-124");
fixture.Repository.MakeCommits(1);
fixture.AssertFullSemver("1.1.0-JIRA-124.1+2");
}
}
示例12: ShouldInheritIncrementCorrectlyWithMultiplePossibleParentsAndWeirdlyNamedDevelopBranch
public void ShouldInheritIncrementCorrectlyWithMultiplePossibleParentsAndWeirdlyNamedDevelopBranch()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeATaggedCommit("1.0.0");
fixture.Repository.CreateBranch("development");
fixture.Repository.Checkout("development");
//Create an initial feature branch
var feature123 = fixture.Repository.CreateBranch("feature/JIRA-123");
fixture.Repository.Checkout("feature/JIRA-123");
fixture.Repository.MakeCommits(1);
//Merge it
fixture.Repository.Checkout("development");
fixture.Repository.Merge(feature123, Constants.SignatureNow());
//Create a second feature branch
fixture.Repository.CreateBranch("feature/JIRA-124");
fixture.Repository.Checkout("feature/JIRA-124");
fixture.Repository.MakeCommits(1);
fixture.AssertFullSemver("1.1.0-JIRA-124.1+2");
}
}
示例13: UpdatesCurrentBranch
public void UpdatesCurrentBranch()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("develop"));
fixture.Repository.MakeACommit();
fixture.Repository.Checkout("master");
using (var localFixture = fixture.CloneRepository())
{
// Advance remote
fixture.Repository.Checkout("develop");
var advancedCommit = fixture.Repository.MakeACommit();
localFixture.Repository.Network.Fetch(localFixture.Repository.Network.Remotes["origin"]);
localFixture.Repository.Checkout(advancedCommit.Sha);
localFixture.Repository.DumpGraph();
GitHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new Authentication(), noFetch: false, currentBranch: "ref/heads/develop");
var normalisedBranch = localFixture.Repository.FindBranch("develop");
normalisedBranch.ShouldNotBe(null);
fixture.Repository.DumpGraph();
localFixture.Repository.DumpGraph();
normalisedBranch.Tip.Sha.ShouldBe(advancedCommit.Sha);
localFixture.Repository.Head.Tip.Sha.ShouldBe(advancedCommit.Sha);
}
}
}
示例14: NoMergeBacksToDevelopInCaseThereAreChangesInReleaseBranch
public void NoMergeBacksToDevelopInCaseThereAreChangesInReleaseBranch()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("develop"));
fixture.Repository.MakeCommits(3);
var releaseBranch = fixture.Repository.CreateBranch("release/1.0.0");
fixture.Repository.Checkout(releaseBranch);
fixture.Repository.MakeACommit();
// Merge to master
fixture.Repository.Checkout("master");
fixture.Repository.MergeNoFF("release/1.0.0");
fixture.Repository.ApplyTag("1.0.0");
// Merge to develop
fixture.Repository.Checkout("develop");
fixture.Repository.MergeNoFF("release/1.0.0");
fixture.AssertFullSemver("1.1.0-alpha.2");
fixture.Repository.MakeACommit();
fixture.Repository.Branches.Remove(releaseBranch);
fixture.AssertFullSemver("1.1.0-alpha.2");
}
}
示例15: GitFlowHotfixBranch
public void GitFlowHotfixBranch()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.SequenceDiagram.Participant("develop");
fixture.SequenceDiagram.Participant("master");
fixture.Repository.MakeACommit();
fixture.ApplyTag("1.2.0");
// Create hotfix branch
fixture.Checkout("master");
fixture.BranchTo("hotfix/1.2.1", "hotfix");
fixture.SequenceDiagram.Activate("hotfix/1.2.1");
fixture.MakeACommit();
fixture.MakeACommit();
fixture.AssertFullSemver("1.2.1-beta.1+2");
// Apply beta.1 tag should be exact tag
fixture.ApplyTag("1.2.1-beta.1");
fixture.AssertFullSemver("1.2.1-beta.1");
fixture.Checkout("master");
fixture.MergeNoFF("hotfix/1.2.1");
fixture.SequenceDiagram.Destroy("hotfix/1.2.1");
fixture.SequenceDiagram.NoteOver("Hotfix branches are deleted once merged", "hotfix/1.2.1");
fixture.ApplyTag("1.2.1");
}
}