Package org.eclipse.jgit.api

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


            }
            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);
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);
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);
View Full Code Here

    // TODO replace with tests methods from GitLogTest, bug 340051
    Repository db1 = getRepositoryForContentLocation(contentLocation1);
    ObjectId master = db1.resolve(Constants.MASTER);
    ObjectId originMaster = db1.resolve(Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + '/' + Constants.MASTER);
    Git git = new Git(db1);
    Iterable<RevCommit> commits = git.log().addRange(master, originMaster).call();
    int c = 0;
    for (RevCommit commit : commits) {
      assertEquals("incoming change commit", commit.getFullMessage());
      c++;
    }
View Full Code Here

    // TODO replace with tests methods from GitLogTest, bug 340051
    Repository db1 = getRepositoryForContentLocation(cloneContentLocation1);
    ObjectId master = db1.resolve(Constants.MASTER);
    ObjectId originMaster = db1.resolve(Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + '/' + Constants.MASTER);
    Git git = new Git(db1);
    Iterable<RevCommit> commits = git.log().addRange(master, originMaster).call();
    int c = 0;
    for (RevCommit commit : commits) {
      assertEquals("incoming change commit", commit.getFullMessage());
      c++;
    }
View Full Code Here

        final Repository repository = getRepository();
        final Git git = new Git(repository);
        try {
            int counter = 0;
            LOGGER.warning("---------- Start Git log ----------");
            for (final RevCommit commit : git.log().call()) {
                LOGGER.info("commit id: " + commit.getName());
                LOGGER.info("message:   " + commit.getFullMessage());
                LOGGER.info("");
                if (++counter >= maxHistory) {
                    break;
View Full Code Here

    commitOperation.setCommitAll(true);
    commitOperation.setRepository(repository);
    commitOperation.execute(null);

    Git git = new Git(repository);
    Iterator<RevCommit> commits = git.log().call().iterator();
    RevCommit firstCommit = commits.next();
    assertTrue(firstCommit.getCommitTime() > 0);

    assertEquals("first commit", firstCommit.getFullMessage());
View Full Code Here

    commitOperation.setCommitAll(true);
    commitOperation.setRepository(repository);
    commitOperation.execute(null);

    git = new Git(repository);
    commits = git.log().call().iterator();
    RevCommit secondCommit = commits.next();
    assertTrue(secondCommit.getCommitTime() > 0);

    assertEquals("second commit", secondCommit.getFullMessage());
    secondCommit.getParent(0).equals(firstCommit);
View Full Code Here

    commitOperation.setCommitAll(true);
    commitOperation.setRepository(repository);
    commitOperation.execute(null);

    Git git = new Git(repository);
    Iterator<RevCommit> commits = git.log().call().iterator();
    RevCommit secondCommit = commits.next();
    TreeWalk treeWalk = new TreeWalk(repository);
    treeWalk.addTree(secondCommit.getTree().getId());
    treeWalk.setRecursive(true);
    treeWalk.setPostOrderTraversal(true);
View Full Code Here

    commitOperation = new CommitOperation(filesToCommit, notTracked, TestUtils.AUTHOR, TestUtils.COMMITTER, "second commit");
    commitOperation.setCommitAll(false);
    commitOperation.execute(null);

    git = new Git(repository);
    commits = git.log().call().iterator();
    secondCommit = commits.next();
    treeWalk = new TreeWalk(repository);
    treeWalk.addTree(secondCommit.getTree().getId());
    treeWalk.setRecursive(true);
    treeWalk.setPostOrderTraversal(true);
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.