本文整理汇总了C#中EmptyRepositoryFixture.CloneRepository方法的典型用法代码示例。如果您正苦于以下问题:C# EmptyRepositoryFixture.CloneRepository方法的具体用法?C# EmptyRepositoryFixture.CloneRepository怎么用?C# EmptyRepositoryFixture.CloneRepository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmptyRepositoryFixture
的用法示例。
在下文中一共展示了EmptyRepositoryFixture.CloneRepository方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
}
示例2: 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);
}
}
}
示例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: NormalisationOfPullRequestsWithoutFetch
public void NormalisationOfPullRequestsWithoutFetch()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
fixture.Repository.MakeACommit();
var commit = fixture.Repository.CreatePullRequestRef("feature/foo", "master", prNumber: 3, allowFastFowardMerge: true);
using (var localFixture = fixture.CloneRepository())
{
localFixture.Checkout(commit.Sha);
GitRepositoryHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new AuthenticationInfo(), noFetch: true, currentBranch: "refs/pull/3/merge");
var normalisedPullBranch = localFixture.Repository.FindBranch("pull/3/merge");
normalisedPullBranch.ShouldNotBe(null);
}
}
}
示例5: NormalisationOfPullRequestsWithFetch
public void NormalisationOfPullRequestsWithFetch()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
fixture.Repository.MakeACommit();
var commit = fixture.Repository.CreatePullRequestRef("feature/foo", "master", prNumber: 3);
using (var localFixture = fixture.CloneRepository())
{
localFixture.Checkout(commit.Sha);
GitHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new Authentication(), noFetch: false, currentBranch: string.Empty);
var normalisedPullBranch = localFixture.Repository.FindBranch("pull/3/merge");
normalisedPullBranch.ShouldNotBe(null);
}
}
}
示例6: UpdatesLocalBranchesWhen
public void UpdatesLocalBranchesWhen()
{
using (var fixture = new EmptyRepositoryFixture(new Config()))
{
fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
fixture.Repository.MakeACommit();
using (var localFixture = fixture.CloneRepository())
{
localFixture.Checkout("feature/foo");
// Advance remote
var advancedCommit = fixture.Repository.MakeACommit();
GitHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new Authentication(), noFetch: false, currentBranch: null);
var normalisedBranch = localFixture.Repository.FindBranch("feature/foo");
normalisedBranch.ShouldNotBe(null);
normalisedBranch.Tip.Sha.ShouldBe(advancedCommit.Sha);
}
}
}
示例7: UpdatesCurrentBranch
public void UpdatesCurrentBranch()
{
using (var fixture = new EmptyRepositoryFixture())
{
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();
Commands.Fetch((Repository)localFixture.Repository, localFixture.Repository.Network.Remotes["origin"].Name, new string[0], null, null);
localFixture.Repository.Checkout(advancedCommit.Sha);
GitRepositoryHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new AuthenticationInfo(), noFetch: false, currentBranch: "refs/heads/develop");
var normalisedBranch = localFixture.Repository.Branches["develop"];
normalisedBranch.ShouldNotBe(null);
normalisedBranch.Tip.Sha.ShouldBe(advancedCommit.Sha);
localFixture.Repository.Head.Tip.Sha.ShouldBe(advancedCommit.Sha);
}
}
}
示例8: CheckedOutShaShouldNotChanged
public void CheckedOutShaShouldNotChanged()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeACommit();
var commitToBuild = fixture.Repository.MakeACommit();
fixture.Repository.MakeACommit();
using (var localFixture = fixture.CloneRepository())
{
localFixture.Repository.Checkout(commitToBuild);
GitRepositoryHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new AuthenticationInfo(), noFetch: false, currentBranch: "refs/heads/master");
var normalisedBranch = localFixture.Repository.Branches["master"];
normalisedBranch.Tip.Sha.ShouldBe(commitToBuild.Sha);
}
}
}
示例9: ShouldNotMoveLocalBranchWhenRemoteAdvances
public void ShouldNotMoveLocalBranchWhenRemoteAdvances()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
fixture.Repository.MakeACommit();
using (var localFixture = fixture.CloneRepository())
{
localFixture.Checkout("feature/foo");
var expectedTip = localFixture.Repository.Head.Tip;
// Advance remote
fixture.Repository.MakeACommit();
GitRepositoryHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new AuthenticationInfo(), noFetch: false, currentBranch: null);
var normalisedBranch = localFixture.Repository.Branches["feature/foo"];
normalisedBranch.ShouldNotBe(null);
normalisedBranch.Tip.Sha.ShouldBe(expectedTip.Sha);
}
}
}
示例10: ShouldNotChangeBranchWhenNormalizingTheDirectory
public void ShouldNotChangeBranchWhenNormalizingTheDirectory()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeATaggedCommit("v1.0.0");
fixture.Repository.Checkout(fixture.Repository.CreateBranch("develop"));
var lastCommitOnDevelop = fixture.Repository.MakeACommit();
fixture.Repository.Checkout(fixture.Repository.CreateBranch("feature/foo"));
fixture.Repository.MakeACommit();
using (var localFixture = fixture.CloneRepository())
{
localFixture.Repository.Checkout("origin/develop");
// Another commit on feature/foo will force an update
fixture.Checkout("feature/foo");
fixture.Repository.MakeACommit();
GitRepositoryHelper.NormalizeGitDirectory(localFixture.RepositoryPath, new AuthenticationInfo(), noFetch: false, currentBranch: null);
localFixture.Repository.Head.Tip.Sha.ShouldBe(lastCommitOnDevelop.Sha);
}
}
}