Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.Git.pull()


            repository.incrementOpen();

            Git git = Git.wrap(repository);

            // Pull remote repository
            PullResult pullResult = git.pull().call();

            // Check result
            if (pullResult.getMergeResult().getMergeStatus() == MergeStatus.CONFLICTING || pullResult.getMergeResult().getMergeStatus() == MergeStatus.FAILED) {

                // TODO: How to report failure
View Full Code Here


                }
                checkout.setName(branch);
                checkout.call();
            }
            if (pull) {
                git.pull().call();
            } else {
                git.fetch().call();
            }
        } catch (Exception e) {
            if (!(e.getCause() instanceof TransportException)) {
View Full Code Here

        new File("target/git/local/test.git/readme.txt").createNewFile();
        git.add().addFilepattern("readme.txt").call();
        git.commit().setMessage("readme").setCommitter("sshd", "sshd@apache.org").call();
        git.push().call();

        git.pull().setRebase(true).call();

        sshd.stop();
    }

}
View Full Code Here

                    git.fetch().setCredentialsProvider( credentials ).setProgressMonitor( monitor ).call();
                }
                else
                {
                    getLogger().debug( "pull..." );
                    git.pull().setCredentialsProvider( credentials ).setProgressMonitor( monitor ).call();

                }
            }

            Set<String> localBranchNames = JGitBranchCommand.getShortLocalBranchNames( git );
View Full Code Here

      assertEquals(true, pushStatus.isOK());

      // TODO: replace with RESTful API for git pull when available
      // try to pull - up to date status is expected
      Git git = new Git(getRepositoryForContentLocation(cloneContentLocation));
      PullResult pullResults = git.pull().call();
      assertEquals(Constants.DEFAULT_REMOTE_NAME, pullResults.getFetchedFrom());
      assertEquals(MergeStatus.ALREADY_UP_TO_DATE, pullResults.getMergeResult().getMergeStatus());
      assertNull(pullResults.getRebaseResult());

      // checkout branch which was created a moment ago
View Full Code Here

      response = checkoutBranch(cloneLocation, BRANCH_NAME);
      assertEquals(HttpURLConnection.HTTP_OK, response.getResponseCode());

      // TODO: replace with RESTful API for git pull when available
      // try to pull again - now fast forward update is expected
      pullResults = git.pull().call();
      assertEquals(Constants.DEFAULT_REMOTE_NAME, pullResults.getFetchedFrom());
      assertEquals(MergeStatus.FAST_FORWARD, pullResults.getMergeResult().getMergeStatus());
      assertNull(pullResults.getRebaseResult());
    }
  }
View Full Code Here

    ProgressMonitor gitMonitor = new EclipseGitProgressTransformer(monitor);
    Repository db = null;
    try {
      db = FileRepositoryBuilder.create(GitUtils.getGitDir(path));
      Git git = new Git(db);
      PullCommand pc = git.pull();
      pc.setProgressMonitor(gitMonitor);
      pc.setCredentialsProvider(credentials);
      pc.setTransportConfigCallback(new TransportConfigCallback() {
        @Override
        public void configure(Transport t) {
View Full Code Here

    cfg.setBoolean(ConfigConstants.CONFIG_BRANCH_SECTION, Constants.MASTER, ConfigConstants.CONFIG_KEY_REBASE, false);
    cfg.save();

    // TODO: replace with RESTful API when ready, see bug 339114
    Git git = new Git(r);
    PullResult pullResult = git.pull().call();
    assertEquals(pullResult.getMergeResult().getMergeStatus(), MergeStatus.ALREADY_UP_TO_DATE);
    assertEquals(RepositoryState.SAFE, git.getRepository().getRepositoryState());
  }

  @Test
View Full Code Here

    // clone2: pull
    // TODO: replace with REST API for git pull once bug 339114 is fixed
    Repository db2 = getRepositoryForContentLocation(contentLocation2);
    git = new Git(db2);
    PullResult pullResult = git.pull().call();
    assertEquals(pullResult.getMergeResult().getMergeStatus(), MergeStatus.CONFLICTING);

    // this is how EGit checks for conflicts
    cache = db2.readDirCache();
    entry = cache.getEntry("test.txt");
View Full Code Here

                    git.fetch().setCredentialsProvider( credentials ).setProgressMonitor( monitor ).call();
                }
                else
                {
                    getLogger().debug( "pull..." );
                    git.pull().setCredentialsProvider( credentials ).setProgressMonitor( monitor ).call();
                }
            }

            Set<String> localBranchNames = JGitBranchCommand.getShortLocalBranchNames( git );
            if ( version instanceof ScmTag )
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.