本文整理汇总了C#中IRepository.Stage方法的典型用法代码示例。如果您正苦于以下问题:C# IRepository.Stage方法的具体用法?C# IRepository.Stage怎么用?C# IRepository.Stage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRepository
的用法示例。
在下文中一共展示了IRepository.Stage方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUpSimpleDiffContext
private static void SetUpSimpleDiffContext(IRepository repo)
{
var fullpath = Touch(repo.Info.WorkingDirectory, "file.txt", "hello\n");
repo.Stage(fullpath);
repo.Commit("Initial commit", Constants.Signature, Constants.Signature);
File.AppendAllText(fullpath, "world\n");
repo.Stage(fullpath);
File.AppendAllText(fullpath, "!!!\n");
}
示例2: AddCommitToRepo
private static Commit AddCommitToRepo(IRepository repo)
{
string relativeFilepath = "test.txt";
Touch(repo.Info.WorkingDirectory, relativeFilepath, content);
repo.Stage(relativeFilepath);
var ie = repo.Index[relativeFilepath];
Assert.NotNull(ie);
Assert.Equal("9daeafb9864cf43055ae93beb0afd6c7d144bfa4", ie.Id.Sha);
var author = new Signature("nulltoken", "[email protected]", DateTimeOffset.Parse("Wed, Dec 14 2011 08:29:03 +0100"));
var commit = repo.Commit("Initial commit", author, author);
relativeFilepath = "big.txt";
var zeros = new string('0', 32*1024 + 3);
Touch(repo.Info.WorkingDirectory, relativeFilepath, zeros);
repo.Stage(relativeFilepath);
ie = repo.Index[relativeFilepath];
Assert.NotNull(ie);
Assert.Equal("6518215c4274845a759cb498998fe696c42e3e0f", ie.Id.Sha);
return commit;
}
示例3: AssertNormalization
private static void AssertNormalization(IRepository repo, string filename, bool shouldHaveBeenNormalized, string expectedSha)
{
var sb = new StringBuilder();
sb.Append("I'm going to be dynamically processed\r\n");
sb.Append("And my line endings...\r\n");
sb.Append("...are going to be\n");
sb.Append("normalized!\r\n");
Touch(repo.Info.WorkingDirectory, filename, sb.ToString());
repo.Stage(filename);
IndexEntry entry = repo.Index[filename];
Assert.NotNull(entry);
Assert.Equal(expectedSha, entry.Id.Sha);
var blob = repo.Lookup<Blob>(entry.Id);
Assert.NotNull(blob);
Assert.Equal(!shouldHaveBeenNormalized, blob.GetContentText().Contains("\r"));
}
示例4: PopulateBasicRepository
/// <summary>
/// Helper method to populate a simple repository with
/// a single file and two branches.
/// </summary>
/// <param name="repo">Repository to populate</param>
private void PopulateBasicRepository(IRepository repo)
{
// Generate a .gitignore file.
string gitIgnoreFilePath = Touch(repo.Info.WorkingDirectory, ".gitignore", "bin");
repo.Stage(gitIgnoreFilePath);
string fullPathFileA = Touch(repo.Info.WorkingDirectory, originalFilePath, originalFileContent);
repo.Stage(fullPathFileA);
repo.Commit("Initial commit", Constants.Signature, Constants.Signature);
repo.CreateBranch(otherBranchName);
}
示例5: CommitFile
public static Commit CommitFile(IRepository repo, string filePath, string comment)
{
repo.Stage(filePath);
return repo.Commit(comment, SignatureNow(), SignatureNow());
}
示例6: AddFileCommitToRepo
private Commit AddFileCommitToRepo(IRepository repository, string filename, string content = null)
{
Touch(repository.Info.WorkingDirectory, filename, content);
repository.Stage(filename);
return repository.Commit("New commit", Constants.Signature, Constants.Signature);
}
示例7: FeedTheRepository
private static void FeedTheRepository(IRepository repo)
{
string fullPath = Touch(repo.Info.WorkingDirectory, "a.txt", "Hello\n");
repo.Stage(fullPath);
repo.Commit("Initial commit", Constants.Signature, Constants.Signature);
repo.ApplyTag("mytag");
File.AppendAllText(fullPath, "World\n");
repo.Stage(fullPath);
Signature shiftedSignature = Constants.Signature.TimeShift(TimeSpan.FromMinutes(1));
repo.Commit("Update file", shiftedSignature, shiftedSignature);
repo.CreateBranch("mybranch");
repo.Checkout("mybranch");
Assert.False(repo.RetrieveStatus().IsDirty);
}
示例8: AddCommitToRepo
private Commit AddCommitToRepo(IRepository repository)
{
string random = Path.GetRandomFileName();
string filename = random + ".txt";
Touch(repository.Info.WorkingDirectory, filename, random);
repository.Stage(filename);
return repository.Commit("New commit", Constants.Signature, Constants.Signature);
}
示例9: AssertStage
private static void AssertStage(bool? ignorecase, IRepository repo, string path)
{
try
{
repo.Stage(path);
Assert.Equal(FileStatus.Added, repo.RetrieveStatus(path));
repo.Reset();
Assert.Equal(FileStatus.Untracked, repo.RetrieveStatus(path));
}
catch (ArgumentException)
{
Assert.False(ignorecase ?? true);
}
}
示例10: CreateAndStageANewFile
private static void CreateAndStageANewFile(IRepository repo)
{
string relativeFilepath = string.Format("new-file-{0}.txt", Guid.NewGuid());
Touch(repo.Info.WorkingDirectory, relativeFilepath, "brand new content\n");
repo.Stage(relativeFilepath);
}