Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevCommit


        //merge into base
        git.checkout().setName(gfConfig.getDevelop()).call();

        Ref featureBranch = GitHelper.getLocalBranch(git, prefixedBranchName);

        RevCommit developCommit = GitHelper.getLatestCommit(git,gfConfig.getDevelop());
        RevCommit featureCommit = GitHelper.getLatestCommit(git, prefixedBranchName);

        List<RevCommit> commitList = ImmutableList.copyOf(git.log().setMaxCount(2).addRange(developCommit,featureCommit).call());
       
        MergeResult mergeResult = null;
               
View Full Code Here


        {
            requireLocalBranchNotBehindRemote(gfConfig.getDevelop());
        }

        Ref releaseBranch = GitHelper.getLocalBranch(git, prefixedReleaseName);
        RevCommit releaseCommit = GitHelper.getLatestCommit(git,prefixedReleaseName);
       
        /*
        try to merge into master
        in case a previous attempt to finish this release branch has failed,
        but the merge into master was successful, we skip it now
View Full Code Here

    this.entry = patchList.get(fileName);

    final ObjectReader reader = repo.newObjectReader();
    try {
      final RevWalk rw = new RevWalk(reader);
      final RevCommit bCommit = rw.parseCommit(patchList.getNewId());

      if (Patch.COMMIT_MSG.equals(fileName)) {
        if (patchList.isAgainstParent()) {
          a = Text.EMPTY;
        } else {
          a = Text.forCommit(repo, reader, patchList.getOldId());
        }
        b = Text.forCommit(repo, reader, bCommit);

        aTree = null;
        bTree = null;

      } else {
        if (patchList.getOldId() != null) {
          aTree = rw.parseTree(patchList.getOldId());
        } else {
          final RevCommit p = bCommit.getParent(0);
          rw.parseHeaders(p);
          aTree = p.getTree();
        }
        bTree = bCommit.getTree();
      }
    } finally {
      reader.release();
View Full Code Here

    try {
      final RevWalk revWalk = new RevWalk(repo);
      final ObjectInserter inserter = repo.newObjectInserter();
      try {
        NoteMap baseNoteMap = null;
        RevCommit baseCommit = null;
        final Ref notesBranch = repo.getRef(REF_REJECT_COMMITS);
        if (notesBranch != null) {
          baseCommit = revWalk.parseCommit(notesBranch.getObjectId());
          baseNoteMap = NoteMap.read(revWalk.getObjectReader(), baseCommit);
        }
View Full Code Here

          throw new MergeException("Failed to lock the ref: "
              + REF_REJECT_COMMITS);
        }

      } else if (result == Result.REJECTED) {
        final RevCommit theirsCommit =
            revWalk.parseCommit(refUpdate.getOldObjectId());
        final NoteMap theirNoteMap =
            NoteMap.read(revWalk.getObjectReader(), theirsCommit);
        final NoteMapMerger merger = new NoteMapMerger(repo);
        final NoteMap merged =
View Full Code Here

    try {
      boolean sameAuthorForAll = true;

      for (final Map.Entry<Branch.NameKey, ObjectId> me : modules.entrySet()) {
        RevCommit c = rw.parseCommit(me.getValue());

        msgbuf.append("\nProject: ");
        msgbuf.append(me.getKey().getParentKey().get());
        msgbuf.append("  " + me.getValue().getName());
        msgbuf.append("\n");
        if (modules.size() == 1 && msg != null) {
          msgbuf.append(msg);
        } else {
          msgbuf.append(c.getShortMessage());
        }
        msgbuf.append("\n");

        if (author == null) {
          author = c.getAuthorIdent();
        } else if (!author.equals(c.getAuthorIdent())) {
          sameAuthorForAll = false;
        }
      }

      if (!sameAuthorForAll || author == null) {
View Full Code Here

      throw new PatchSetInfoNotAvailableException(e);
    }
    try {
      final RevWalk rw = new RevWalk(repo);
      try {
        final RevCommit src =
            rw.parseCommit(ObjectId.fromString(patchSet.getRevision().get()));
        PatchSetInfo info = get(src, patchSet.getId());
        info.setParents(toParentInfos(src.getParents(), rw));
        return info;
      } finally {
        rw.release();
      }
    } catch (IOException e) {
View Full Code Here

  protected Change.Id updateProjectConfig(ProjectConfig config, MetaDataUpdate md)
      throws IOException, NoSuchProjectException, ConfigInvalidException, OrmException {
    int nextChangeId = db.nextChangeId();
    PatchSet.Id patchSetId = new PatchSet.Id(new Change.Id(nextChangeId), 1);
    final PatchSet ps = new PatchSet(patchSetId);
    RevCommit commit = config.commitToNewRef(md, ps.getRefName());
    if (commit.getId().equals(base)) {
      return null;
    }
    Change.Key changeKey = new Change.Key("I" + commit.name());
    final Change change =
        new Change(changeKey, new Change.Id(nextChangeId), user.getAccountId(),
            new Branch.NameKey(config.getProject().getNameKey(),
                GitRepositoryManager.REF_CONFIG));
    change.nextPatchSetId();

    ps.setCreatedOn(change.getCreatedOn());
    ps.setUploader(user.getAccountId());
    ps.setRevision(new RevId(commit.name()));

    db.patchSets().insert(Collections.singleton(ps));

    final PatchSetInfo info = patchSetInfoFactory.get(commit, ps.getId());
    change.setCurrentPatchSet(info);
View Full Code Here

      final Repository repo) throws IOException {
    final RawTextComparator cmp = comparatorFor(key.getWhitespace());
    final ObjectReader reader = repo.newObjectReader();
    try {
      final RevWalk rw = new RevWalk(reader);
      final RevCommit b = rw.parseCommit(key.getNewId());
      final RevObject a = aFor(key, repo, rw, b);

      if (a == null) {
        // TODO(sop) Remove this case.
        // This is a merge commit, compared to its ancestor.
        //
        final PatchListEntry[] entries = new PatchListEntry[1];
        entries[0] = newCommitMessage(cmp, repo, reader, null, b);
        return new PatchList(a, b, true, entries);
      }

      final boolean againstParent =
          b.getParentCount() > 0 && b.getParent(0) == a;

      RevCommit aCommit;
      RevTree aTree;
      if (a instanceof RevCommit) {
        aCommit = (RevCommit) a;
        aTree = aCommit.getTree();
      } else if (a instanceof RevTree) {
        aCommit = null;
        aTree = (RevTree) a;
      } else {
        throw new IOException("Unexpected type: " + a.getClass());
View Full Code Here

    switch (b.getParentCount()) {
      case 0:
        return rw.parseAny(emptyTree(repo));
      case 1: {
        RevCommit r = b.getParent(0);
        rw.parseBody(r);
        return r;
      }
      case 2:
        return automerge(repo, rw, b);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.revwalk.RevCommit

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.