Package org.eclipse.jgit.revwalk

Examples of org.eclipse.jgit.revwalk.RevWalk.lookupCommit()


   * @return the commit id of the merge base or null if there is no common base
   */
  public static String getMergeBase(Repository repository, ObjectId commitIdA, ObjectId commitIdB) {
    RevWalk rw = new RevWalk(repository);
    try {
      RevCommit a = rw.lookupCommit(commitIdA);
      RevCommit b = rw.lookupCommit(commitIdB);

      rw.setRevFilter(RevFilter.MERGE_BASE);
      rw.markStart(a);
      rw.markStart(b);
View Full Code Here


   */
  public static String getMergeBase(Repository repository, ObjectId commitIdA, ObjectId commitIdB) {
    RevWalk rw = new RevWalk(repository);
    try {
      RevCommit a = rw.lookupCommit(commitIdA);
      RevCommit b = rw.lookupCommit(commitIdB);

      rw.setRevFilter(RevFilter.MERGE_BASE);
      rw.markStart(a);
      rw.markStart(b);
      RevCommit mergeBase = rw.next();
View Full Code Here

   */
  public static MergeStatus canMerge(Repository repository, String src, String toBranch) {
    RevWalk revWalk = null;
    try {
      revWalk = new RevWalk(repository);
      RevCommit branchTip = revWalk.lookupCommit(repository.resolve(toBranch));
      RevCommit srcTip = revWalk.lookupCommit(repository.resolve(src));
      if (revWalk.isMergedInto(srcTip, branchTip)) {
        // already merged
        return MergeStatus.ALREADY_MERGED;
      } else if (revWalk.isMergedInto(branchTip, srcTip)) {
View Full Code Here

  public static MergeStatus canMerge(Repository repository, String src, String toBranch) {
    RevWalk revWalk = null;
    try {
      revWalk = new RevWalk(repository);
      RevCommit branchTip = revWalk.lookupCommit(repository.resolve(toBranch));
      RevCommit srcTip = revWalk.lookupCommit(repository.resolve(src));
      if (revWalk.isMergedInto(srcTip, branchTip)) {
        // already merged
        return MergeStatus.ALREADY_MERGED;
      } else if (revWalk.isMergedInto(branchTip, srcTip)) {
        // fast-forward
View Full Code Here

    }

    RevWalk revWalk = null;
    try {
      revWalk = new RevWalk(repository);
      RevCommit branchTip = revWalk.lookupCommit(repository.resolve(toBranch));
      RevCommit srcTip = revWalk.lookupCommit(repository.resolve(src));
      if (revWalk.isMergedInto(srcTip, branchTip)) {
        // already merged
        return new MergeResult(MergeStatus.ALREADY_MERGED, null);
      }
View Full Code Here

    RevWalk revWalk = null;
    try {
      revWalk = new RevWalk(repository);
      RevCommit branchTip = revWalk.lookupCommit(repository.resolve(toBranch));
      RevCommit srcTip = revWalk.lookupCommit(repository.resolve(src));
      if (revWalk.isMergedInto(srcTip, branchTip)) {
        // already merged
        return new MergeResult(MergeStatus.ALREADY_MERGED, null);
      }
      RecursiveMerger merger = (RecursiveMerger) MergeStrategy.RECURSIVE.newMerger(repository, true);
View Full Code Here

      throws IOException {
    RevWalk revWalk = new RevWalk(db);
    ObjectId oldHeadObjectId = oldHead.getPeeledObjectId();
    if (oldHeadObjectId == null)
      oldHeadObjectId = oldHead.getObjectId();
    RevCommit oldHeadCommit = revWalk.lookupCommit(oldHeadObjectId);
    RevCommit srcCommit = revWalk.lookupCommit(src);
    return revWalk.isMergedInto(oldHeadCommit, srcCommit);
  }
}
View Full Code Here

    RevWalk revWalk = new RevWalk(db);
    ObjectId oldHeadObjectId = oldHead.getPeeledObjectId();
    if (oldHeadObjectId == null)
      oldHeadObjectId = oldHead.getObjectId();
    RevCommit oldHeadCommit = revWalk.lookupCommit(oldHeadObjectId);
    RevCommit srcCommit = revWalk.lookupCommit(src);
    return revWalk.isMergedInto(oldHeadCommit, srcCommit);
  }
}
View Full Code Here

      ref = repo.peel(ref);
      ObjectId objectId = ref.getPeeledObjectId();
      if (objectId == null)
        objectId = ref.getObjectId();

      RevCommit srcCommit = revWalk.lookupCommit(objectId);

      ObjectId headId = head.getObjectId();
      if (headId == null) {
        revWalk.parseHeaders(srcCommit);
        dco = new DirCacheCheckout(repo,
View Full Code Here

        return new MergeResult(srcCommit, srcCommit, new ObjectId[] {
            null, srcCommit }, MergeStatus.FAST_FORWARD,
            mergeStrategy, null, null);
      }

      RevCommit headCommit = revWalk.lookupCommit(headId);

      if (revWalk.isMergedInto(srcCommit, headCommit)) {
        setCallable(false);
        return new MergeResult(headCommit, srcCommit, new ObjectId[] {
            headCommit, srcCommit },
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.