Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.Commit


        .getObjectId(0));
  }

  private ObjectId commit(final ObjectInserter odi, final DirCache treeB,
      final ObjectId[] parentIds) throws Exception {
    final Commit c = new Commit(db);
    c.setTreeId(treeB.writeTree(odi));
    c.setAuthor(new PersonIdent("A U Thor", "a.u.thor", 1L, 0));
    c.setCommitter(c.getAuthor());
    c.setParentIds(parentIds);
    c.setMessage("Tree " + c.getTreeId().name());
    ObjectId id = odi.insert(OBJ_COMMIT, odi.format(c));
    odi.flush();
    return id;
  }
View Full Code Here


          // fail for example when the index contains unmerged paths
          // (unresolved conflicts)
          ObjectId indexTreeId = index.writeTree(odi);

          // Create a Commit object, populate it and write it
          Commit commit = new Commit(repo);
          commit.setCommitter(committer);
          commit.setAuthor(author);
          commit.setMessage(message);

          commit.setParentIds(parents.toArray(new ObjectId[] {}));
          commit.setTreeId(indexTreeId);
          ObjectId commitId = odi.insert(Constants.OBJ_COMMIT, odi
              .format(commit));
          odi.flush();

          RevWalk revWalk = new RevWalk(repo);
View Full Code Here

   *            revision walker owning this reference.
   * @return parsed commit.
   */
  public final Commit asCommit(final RevWalk walk) {
    // TODO(spearce) Remove repository when this method dies.
    return new Commit(walk.repository, this, buffer);
  }
View Full Code Here

        if (!updateRef(ru, id))
            logger.output("Failed to update " + ru.getName() + " to commit " + id + ".");
    }

    private ObjectId writeCommit(ObjectId treeId, ObjectId[] parentIds) throws IOException {
        Commit commit = new Commit(repository, parentIds);

        commit.setTreeId(treeId);
        commit.setMessage(message.replaceAll("\r", "\n"));
        commit.setAuthor(personIdent);
        commit.setCommitter(personIdent);

        ObjectWriter writer = new ObjectWriter(repository);
        return writer.writeCommit(commit);
    }
View Full Code Here

    }

    public static void doCheckout(Repository repo, Ref branch, OutputLogger logger) throws IOException {

        final GitIndex index = new GitIndex(repo);
        final Commit mapCommit = repo.mapCommit(branch.getObjectId());
        final Tree tree = mapCommit.getTree();
        final RefUpdate u;
        final WorkDirCheckout co;

        u = repo.updateRef(Constants.HEAD);
        u.setNewObjectId(mapCommit.getCommitId());
        u.forceUpdate();

        // checking out files
        co = new WorkDirCheckout(repo, repo.getWorkDir(), index, tree);
        co.checkout();
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.Commit

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.