Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.Repository.resolve()


    public static void main(String[] args) throws IOException, InvalidRemoteException, TransportException, GitAPIException {
        Repository repository = cloneRepository();

        System.out.println("Having repository: " + repository.getDirectory() + " with head: " +
                repository.getRef(Constants.HEAD) + "/" + repository.resolve("HEAD") + "/" +
                repository.resolve("refs/heads/master"));

        // TODO: why do we get null here for HEAD?!? See also
// http://stackoverflow.com/questions/17979660/jgit-pull-noheadexception

        PullResult call = new Git(repository).pull().call();
View Full Code Here


        if (workTreePath.isPrefixOf(project.getLocation())) {
          IPath makeRelativeTo = project.getLocation()
              .makeRelativeTo(workTreePath);
          String repoRelativePath = makeRelativeTo
              .append("/.project").toPortableString(); //$NON-NLS-1$
          ObjectId headCommitId = repo.resolve(Constants.HEAD);
          if (headCommitId != null) {
            // Not an empty repo
            RevWalk revWalk = new RevWalk(repo);
            RevCommit headCommit = revWalk
                .parseCommit(headCommitId);
View Full Code Here

      return;
    final RevCommit baseCommit;
    final RevCommit compareCommit;
    RevWalk rw = new RevWalk(repo);
    try {
      ObjectId commitId = repo.resolve(compareVersion);
      compareCommit = commitId != null ? rw.parseCommit(commitId) : null;
      if (baseVersion == null)
        baseCommit = null;
      else {
        commitId = repo.resolve(baseVersion);
View Full Code Here

      ObjectId commitId = repo.resolve(compareVersion);
      compareCommit = commitId != null ? rw.parseCommit(commitId) : null;
      if (baseVersion == null)
        baseCommit = null;
      else {
        commitId = repo.resolve(baseVersion);
        baseCommit = rw.parseCommit(commitId);
      }
    } catch (IOException e) {
      Activator.handleError(e.getMessage(), e, true);
      return;
View Full Code Here

      PushBranchWizard wizard = null;
      Ref ref = getBranchRef(repository);
      if (ref != null) {
        wizard = new PushBranchWizard(repository, ref);
      } else {
        ObjectId id = repository.resolve(repository.getFullBranch());
        wizard = new PushBranchWizard(repository, id);
      }
      WizardDialog dlg = new WizardDialog(getShell(event), wizard);
      dlg.open();
    } catch (IOException ex) {
View Full Code Here

          target = readFile(repo.getDirectory(),
              RebaseCommand.REBASE_MERGE + File.separatorChar
                  + RebaseCommand.STOPPED_SHA);
        else
          target = Constants.ORIG_HEAD;
        ObjectId mergeHead = repo.resolve(target);
        if (mergeHead == null)
          throw new IOException(NLS.bind(
              UIText.ValidationUtils_CanNotResolveRefMessage,
              target));
        rightCommit = rw.parseCommit(mergeHead);
View Full Code Here

      // we need the HEAD, also to determine the common
      // ancestor
      final RevCommit headCommit;
      try {
        ObjectId head = repo.resolve(Constants.HEAD);
        if (head == null)
          throw new IOException(NLS.bind(
              UIText.ValidationUtils_CanNotResolveRefMessage,
              Constants.HEAD));
        headCommit = rw.parseCommit(head);
View Full Code Here

    TagBuilder tag = new TagBuilder();
    tag.setTag("SomeTag");
    tag.setTagger(RawParseUtils.parsePersonIdent(TestUtil.TESTAUTHOR));
    tag.setMessage("I'm just a little tag");
    tag.setObjectId(repo.resolve(repo.getFullBranch()), Constants.OBJ_COMMIT);
    TagOperation top = new TagOperation(repo, tag, false);
    top.execute(null);
    touchAndSubmit(null);
  }
View Full Code Here

  private void pushTo(String destination, boolean withConfirmPage)
      throws Exception, MissingObjectException,
      IncorrectObjectTypeException, IOException {
    Repository repo = lookupRepository(remoteRepositoryFile);
    RevWalk rw = new RevWalk(repo);
    String previous = rw.parseCommit(repo.resolve("HEAD")).name();

    touchAndSubmit(null);
    SWTBotShell pushDialog = openPushDialog();

    SWTBotCombo destinationCombo = pushDialog.bot().comboBox();
View Full Code Here

    // the integrity of the repository here. Only a few basic properties
    // we'd expect from a clone made this way, that would possibly
    // not hold true given other parameters in the GUI.
    Repository repository = FileRepositoryBuilder.create(new File(destRepo,
        Constants.DOT_GIT));
    assertNotNull(repository.resolve("src/" + SampleTestRepository.FIX));
    // we didn't clone that one
    assertNull(repository.resolve("src/master"));
    // and a local master initialized from origin/master (default!)
    assertEquals(repository.resolve("stable"), repository
        .resolve("src/stable"));
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.