Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.LogCommand


    }

    @Override
    public List<Revision> getMatrixHistory(final int start,
                                                   final int limit) throws StoreException {
        final LogCommand logCommand;
        try {
            final ObjectId branchHead = git.getRepository().resolve(getGitCore().getRefName());
            logCommand = git.log()
                .add(branchHead)
                .setSkip(start)
View Full Code Here


                                             final String revision,
                                             final int start,
                                             final int limit) throws StoreException {
        try {
            final ObjectId commitId = ObjectId.fromString(revision);
            final LogCommand logCommand = git.log()
                // TODO: create path to definition.json file, sanitize test name for invalid / relative characters
                .addPath("test-definitions/" + test + "/definition.json")
                .add(commitId)
                .setSkip(start)
                .setMaxCount(limit);
View Full Code Here

            }
            JSONObject branch = children.getJSONObject(i);
            if (commitsSize == 0) {
              newChildren.put(branch);
            } else {
              LogCommand lc = git.log();
              String branchName = branch.getString(ProtocolConstants.KEY_ID);
              ObjectId toObjectId = db.resolve(branchName);
              Ref toRefId = db.getRef(branchName);
              if (toObjectId == null) {
                String msg = NLS.bind("No ref or commit found: {0}", branchName);
                return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, msg, null);
              }
              toObjectId = getCommitObjectId(db, toObjectId);

              // set the commit range
              lc.add(toObjectId);
              lc.setMaxCount(this.commitsSize);
              Iterable<RevCommit> commits = lc.call();
              Log log = new Log(cloneLocation, db, commits, null, null, toRefId);
              log.setPaging(1, commitsSize);
              branch.put(GitConstants.KEY_TAG_COMMIT, log.toJSON());
              newChildren.put(branch);
            }
View Full Code Here

        Tag tag = tags.get(i);
        if (this.commitsSize == 0) {
          children.put(tag.toJSON());
        } else {
          // add info about commits if requested
          LogCommand lc = git.log();
          String toCommitName = tag.getRevCommitName();
          ObjectId toCommitId = db.resolve(toCommitName);
          Ref toCommitRef = db.getRef(toCommitName);
          toCommitId = getCommitObjectId(db, toCommitId);
          lc.add(toCommitId);
          lc.setMaxCount(this.commitsSize);
          Iterable<RevCommit> commits = lc.call();
          Log log = new Log(cloneLocation, db, commits, null, null, toCommitRef);
          log.setPaging(1, commitsSize);
          children.put(tag.toJSON(log.toJSON()));
        }
      }
View Full Code Here

          Log log = null;
          // single commit is requested and we already know it, no need for LogCommand
          if (commitsSize == 1 && toObjectId instanceof RevCommit) {
            log = new Log(cloneLocation, db, Collections.singleton((RevCommit) toObjectId), null, null, toRefId);
          } else {
            LogCommand lc = git.log();
            // set the commit range
            lc.add(toObjectId);
            lc.setMaxCount(this.commitsSize);
            Iterable<RevCommit> commits = lc.call();
            log = new Log(cloneLocation, db, commits, null, null, toRefId);
          }
          log.setPaging(1, commitsSize);
          children.put(branch.toJSON(log.toJSON()));
        }
View Full Code Here

        testRepository.getRepository(), commits, messageHandler);
    op.execute(new NullProgressMonitor());

    assertEquals(2, countCommitsInHead());

    LogCommand log = new Git(testRepository.getRepository()).log();
    Iterable<RevCommit> logCommits = log.call();
    RevCommit latestCommit = logCommits.iterator().next();
    assertEquals("squashed", latestCommit.getFullMessage());
  }
View Full Code Here

    RevCommit latestCommit = logCommits.iterator().next();
    assertEquals("squashed", latestCommit.getFullMessage());
  }

  private int countCommitsInHead() throws GitAPIException {
    LogCommand log = new Git(testRepository.getRepository()).log();
    Iterable<RevCommit> commits = log.call();
    int result = 0;
    for (Iterator i = commits.iterator(); i.hasNext();) {
      i.next();
      result++;
    }
View Full Code Here

        ref = repository.peel(ref);
        RevWalk walker = new RevWalk(repository);
        walker.setRetainBody(true);
        try {
            RevCommit commit = walker.parseCommit(ref.getObjectId());
            LogCommand command = git.log();
            command.add(commit.getId());
            command.setMaxCount(12);
            for (RevCommit rev : command.call()) {
                commit = walker.parseCommit(rev);
                print(commit);
            }
        } finally {
            walker.dispose();
View Full Code Here

    protected void addCommitsAsChildren( Git git,
                                         CallSpecification spec,
                                         DocumentWriter writer,
                                         int pageSize ) throws GitAPIException {
        // Add commits in the log ...
        LogCommand command = git.log();
        command.setSkip(0);
        command.setMaxCount(pageSize);

        // Add the first set of commits ...
        int actual = 0;
        String commitId = null;
        for (RevCommit commit : command.call()) {
            commitId = commit.getName();
            writer.addChild(spec.childId(commitId), commitId);
            ++actual;
        }
        if (actual == pageSize) {
View Full Code Here

            // The offset is the ID of the last commit we read, so we'll need to skip the first commit
            String lastCommitIdName = pageKey.getOffsetString();
            ObjectId lastCommitId = repository.resolve(lastCommitIdName);
            int pageSize = (int)pageKey.getBlockSize();

            LogCommand command = git.log();
            command.add(lastCommitId);
            command.setMaxCount(pageSize + 1);
            // Add the first set of commits ...
            int actual = 0;
            String commitId = null;
            for (RevCommit commit : command.call()) {
                commitId = commit.getName();
                if (commitId.equals(lastCommitIdName)) continue;
                writer.addChild(spec.childId(commitId), commitId);
                ++actual;
            }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.LogCommand

Copyright © 2018 www.massapicom. 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.