当前位置: 首页>>代码示例>>C#>>正文


C# Git.Pull方法代码示例

本文整理汇总了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;
		}
开发者ID:draptik,项目名称:RepoSync,代码行数:7,代码来源:NGitStrategy.cs

示例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);
     }
 }
开发者ID:RobertLippens,项目名称:GitUpdater,代码行数:22,代码来源:GitRepoPuller.cs

示例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();
        }
开发者ID:SatoKazuto,项目名称:BluePlumGit,代码行数:27,代码来源:MainWindowModel.cs

示例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");
 }
开发者ID:nnieslan,项目名称:ngit,代码行数:31,代码来源:PullCommandWithRebaseTest.cs

示例5: UpdateSingleRepository

 private void UpdateSingleRepository(Git repository)
 {
     repository.Pull().SetCredentialsProvider(credentials).Call();
     gitLog.AppendLine("Pull completed.");
 }
开发者ID:RobertLippens,项目名称:GitUpdater,代码行数:5,代码来源:GitRepoPuller.cs

示例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();
        }
开发者ID:sayedihashimi,项目名称:fainting-goat,代码行数:29,代码来源:GitClient.cs

示例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();
		}
开发者ID:draptik,项目名称:RepoSync,代码行数:14,代码来源:GitTests.cs


注:本文中的NGit.Api.Git.Pull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。