本文整理汇总了C#中NGit.Api.Git.Pull方法的典型用法代码示例。如果您正苦于以下问题:C# Git.Pull方法的具体用法?C# Git.Pull怎么用?C# Git.Pull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NGit.Api.Git
的用法示例。
在下文中一共展示了Git.Pull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Pull
public ICommandResponse Pull (string path, string destPath)
{
var git = new Git(new FileRepository(ToGitDirString(path)));
var pullCommand = git.Pull();
ICommandResponse result = new NGitPullResultAdapter(pullCommand);
return result;
}
示例2: LogRepository
//private void UpdateRepositoryAllBranches(Git repository)
//{
// string currentBranch = repository.GetRepository().GetBranch();
// gitLog.AppendLine("Currently on branch " + currentBranch + "...");
// var branches = repository.BranchList().Call().Select(x => x.GetName()).ToList();
// foreach (string branch in branches)
// {
// gitLog.AppendLine("Currently on branch " + branch + "...");
// //repository.Checkout().SetName(branch).Call();
// //repository.Pull().SetCredentialsProvider(credentials).Call();
// }
// //repository.Checkout().SetName(currentBranch).Call();
//}
public void LogRepository(Git repository)
{
gitLog.AppendLine("Recent changes:");
var commits = repository.Pull().SetCredentialsProvider(credentials).Call().GetMergeResult().GetMergedCommits().Select(x=>x.Name).ToList();
foreach (var commit in commits)
{
gitLog.AppendLine(commit);
}
}
示例3: Pull
public void Pull(Git git, BusyIndicatorProgressMonitor monitor)
{
PullCommand command = git.Pull();
command.SetProgressMonitor(monitor);
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += (s, evt) =>
{
monitor.StartAction();
try
{
command.Call();
}
catch (JGitInternalException)
{
// TODO:
}
};
bw.RunWorkerCompleted += (s, evt) =>
{
monitor.CompleteAction();
};
bw.RunWorkerAsync();
}
示例4: SetUp
public override void SetUp()
{
base.SetUp();
dbTarget = CreateWorkRepository();
source = new Git(db);
target = new Git(dbTarget);
// put some file in the source repo
sourceFile = new FilePath(db.WorkTree, "SomeFile.txt");
WriteToFile(sourceFile, "Hello world");
// and commit it
source.Add().AddFilepattern("SomeFile.txt").Call();
source.Commit().SetMessage("Initial commit for source").Call();
// configure the target repo to connect to the source via "origin"
StoredConfig targetConfig = ((FileBasedConfig)dbTarget.GetConfig());
targetConfig.SetString("branch", "master", "remote", "origin");
targetConfig.SetString("branch", "master", "merge", "refs/heads/master");
RemoteConfig config = new RemoteConfig(targetConfig, "origin");
config.AddURI(new URIish(source.GetRepository().WorkTree.GetPath()));
config.AddFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
config.Update(targetConfig);
targetConfig.Save();
targetFile = new FilePath(dbTarget.WorkTree, "SomeFile.txt");
// make sure we have the same content
target.Pull().Call();
target.Checkout().SetStartPoint("refs/remotes/origin/master").SetName("master").Call
();
targetConfig.SetString("branch", "master", "merge", "refs/heads/master");
targetConfig.SetBoolean("branch", "master", "rebase", true);
targetConfig.Save();
AssertFileContentsEqual(targetFile, "Hello world");
}
示例5: UpdateSingleRepository
private void UpdateSingleRepository(Git repository)
{
repository.Pull().SetCredentialsProvider(credentials).Call();
gitLog.AppendLine("Pull completed.");
}
示例6: PerformPull
public void PerformPull(string gitFolder)
{
if (string.IsNullOrEmpty(gitFolder)) { throw new ArgumentNullException("gitFolder"); }
if (!Directory.Exists(gitFolder)) { throw new DirectoryNotFoundException(string.Format("git directory not found at [{0}]", gitFolder)); }
string pathToDotGitFolder = gitFolder;
// if this is not pointing to .git then add that to the path
DirectoryInfo di = new DirectoryInfo(pathToDotGitFolder);
if (string.Compare(".git", di.Name, StringComparison.OrdinalIgnoreCase) != 0) {
pathToDotGitFolder = Path.Combine(gitFolder, @".git\");
}
// ensure that there is no \ at the end of the path
pathToDotGitFolder = pathToDotGitFolder.Trim().TrimEnd('\\');
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Repository repo = builder
.SetGitDir(pathToDotGitFolder)
.ReadEnvironment()
.FindGitDir()
.Build();
Git git = new Git(repo);
PullCommand pullCommand = git.Pull();
PullResult pullResult = null;
// TODO: need to cover this in a try/catch and log errors
pullResult = pullCommand.Call();
}
示例7: GitOutput
/// http://o2platform.wordpress.com/category/github/
public string GitOutput(Entry entry)
{
var git = new Git(new FileRepository(ToGitDirString(entry.Local)));
//var git = Git.Open(testRepository);
// var repository = git.GetRepository();
var stringWriter = new StringWriter();
var textMonitor = new TextProgressMonitor(stringWriter);
var pullCommand= git.Pull();
pullCommand.SetProgressMonitor(textMonitor);
var pullResponse = pullCommand.Call();
return stringWriter.ToString() + " \n\n.........\n\n " + pullResponse.ToString();
}