Examples of RevCommit


Examples of org.eclipse.jgit.revwalk.RevCommit

              throw new RevisionSyntaxException(
                  JGitText.get().invalidCommitParentNumber,
                  revstr);
            }
            if (pnum != 0) {
              RevCommit commit = (RevCommit) ref;
              if (pnum > commit.getParentCount())
                ref = null;
              else
                ref = commit.getParent(pnum - 1);
            }
            i = j - 1;
            break;
          case '{':
            int k;
            String item = null;
            for (k = i + 2; k < rev.length; ++k) {
              if (rev[k] == '}') {
                item = new String(rev, i + 2, k - i - 2);
                break;
              }
            }
            i = k;
            if (item != null)
              if (item.equals("tree")) {
                ref = rw.parseTree(ref);
              } else if (item.equals("commit")) {
                ref = rw.parseCommit(ref);
              } else if (item.equals("blob")) {
                ref = rw.peel(ref);
                if (!(ref instanceof RevBlob))
                  throw new IncorrectObjectTypeException(ref,
                      Constants.TYPE_BLOB);
              } else if (item.equals("")) {
                ref = rw.peel(ref);
              } else
                throw new RevisionSyntaxException(revstr);
            else
              throw new RevisionSyntaxException(revstr);
            break;
          default:
            ref = rw.parseAny(ref);
            if (ref instanceof RevCommit) {
              RevCommit commit = ((RevCommit) ref);
              if (commit.getParentCount() == 0)
                ref = null;
              else
                ref = commit.getParent(0);
            } else
              throw new IncorrectObjectTypeException(ref,
                  Constants.TYPE_COMMIT);

          }
        } else {
          ref = rw.peel(ref);
          if (ref instanceof RevCommit) {
            RevCommit commit = ((RevCommit) ref);
            if (commit.getParentCount() == 0)
              ref = null;
            else
              ref = commit.getParent(0);
          } else
            throw new IncorrectObjectTypeException(ref,
                Constants.TYPE_COMMIT);
        }
        break;
      case '~':
        if (ref == null) {
          ref = parseSimple(rw, new String(rev, 0, i));
          if (ref == null)
            return null;
        }
        ref = rw.peel(ref);
        if (!(ref instanceof RevCommit))
          throw new IncorrectObjectTypeException(ref,
              Constants.TYPE_COMMIT);
        int l;
        for (l = i + 1; l < rev.length; ++l) {
          if (!Character.isDigit(rev[l]))
            break;
        }
        String distnum = new String(rev, i + 1, l - i - 1);
        int dist;
        try {
          dist = Integer.parseInt(distnum);
        } catch (NumberFormatException e) {
          throw new RevisionSyntaxException(
              JGitText.get().invalidAncestryLength, revstr);
        }
        while (dist > 0) {
          RevCommit commit = (RevCommit) ref;
          if (commit.getParentCount() == 0) {
            ref = null;
            break;
          }
          commit = commit.getParent(0);
          rw.parseHeaders(commit);
          ref = commit;
          --dist;
        }
        i = l - 1;
View Full Code Here

Examples of org.locationtech.geogig.api.RevCommit

    private RevCommit createCommits(int numCommits, String branchName) {
        int largeStep = numCommits / 10;
        int smallStep = numCommits / 100;

        RevCommit commit = null;
        for (int i = 1; i <= numCommits; i++) {
            if (i % largeStep == 0) {
                System.err.print(i);
                System.err.flush();
            } else if (i % smallStep == 0) {
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.