當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。