Package org.eclipse.jgit.api.errors

Examples of org.eclipse.jgit.api.errors.JGitInternalException


      default:
        break;
      }

      if (!ok)
        throw new JGitInternalException(MessageFormat.format(JGitText
            .get().checkoutUnexpectedResult, updateResult.name()));

      if (!dco.getToBeDeleted().isEmpty()) {
        status = new CheckoutResult(Status.NONDELETED, dco
            .getToBeDeleted());
      }
      else
        status = CheckoutResult.OK_RESULT;
      return ref;
    } catch (IOException ioe) {
      throw new JGitInternalException(ioe.getMessage(), ioe);
    } finally {
      if (status == null)
        status = CheckoutResult.ERROR_RESULT;
    }
  }
View Full Code Here


              ent.setFileMode(mode);
              try {
                DirCacheCheckout.checkoutEntry(repo, new File(
                    workTree, ent.getPathString()), ent, r);
              } catch (IOException e) {
                throw new JGitInternalException(
                    MessageFormat.format(
                        JGitText.get().checkoutConflictWithFile,
                        ent.getPathString()), e);
              }
            }
View Full Code Here

                merger.getMergeResults(), failingPaths, null);
          return null;
        }
      }
    } catch (IOException e) {
      throw new JGitInternalException(
          MessageFormat.format(
                  JGitText.get().exceptionCaughtDuringExecutionOfRevertCommand,
              e), e);
    } finally {
      revWalk.release();
View Full Code Here

      switch (operation) {
      case ABORT:
        try {
          return abort(RebaseResult.ABORTED_RESULT);
        } catch (IOException ioe) {
          throw new JGitInternalException(ioe.getMessage(), ioe);
        }
      case SKIP:
        // fall through
      case CONTINUE:
        String upstreamCommitName = readFile(rebaseDir, ONTO);
        this.upstreamCommit = walk.parseCommit(repo
            .resolve(upstreamCommitName));
        break;
      case BEGIN:
        RebaseResult res = initFilesAndRewind();
        if (res != null)
          return res;
      }

      if (monitor.isCancelled())
        return abort(RebaseResult.ABORTED_RESULT);

      if (operation == Operation.CONTINUE)
        newHead = continueRebase();

      if (operation == Operation.SKIP)
        newHead = checkoutCurrentHead();

      ObjectReader or = repo.newObjectReader();

      List<Step> steps = loadSteps();
      for (Step step : steps) {
        popSteps(1);
        Collection<ObjectId> ids = or.resolve(step.commit);
        if (ids.size() != 1)
          throw new JGitInternalException(
              "Could not resolve uniquely the abbreviated object ID");
        RevCommit commitToPick = walk
            .parseCommit(ids.iterator().next());
        if (monitor.isCancelled())
          return new RebaseResult(commitToPick);
        try {
          monitor.beginTask(MessageFormat.format(
              JGitText.get().applyingCommit,
              commitToPick.getShortMessage()),
              ProgressMonitor.UNKNOWN);
          // if the first parent of commitToPick is the current HEAD,
          // we do a fast-forward instead of cherry-pick to avoid
          // unnecessary object rewriting
          newHead = tryFastForward(commitToPick);
          lastStepWasForward = newHead != null;
          if (!lastStepWasForward) {
            // TODO if the content of this commit is already merged
            // here we should skip this step in order to avoid
            // confusing pseudo-changed
            CherryPickResult cherryPickResult = new Git(repo)
                .cherryPick().include(commitToPick).call();
            switch (cherryPickResult.getStatus()) {
            case FAILED:
              if (operation == Operation.BEGIN)
                return abort(new RebaseResult(
                    cherryPickResult.getFailingPaths()));
              else
                return stop(commitToPick);
            case CONFLICTING:
              return stop(commitToPick);
            case OK:
              newHead = cherryPickResult.getNewHead();
            }
          }
        } finally {
          monitor.endTask();
        }
      }
      if (newHead != null) {
        String headName = readFile(rebaseDir, HEAD_NAME);
        updateHead(headName, newHead);
        FileUtils.delete(rebaseDir, FileUtils.RECURSIVE);
        if (lastStepWasForward)
          return RebaseResult.FAST_FORWARD_RESULT;
        return RebaseResult.OK_RESULT;
      }
      return RebaseResult.FAST_FORWARD_RESULT;
    } catch (IOException ioe) {
      throw new JGitInternalException(ioe.getMessage(), ioe);
    }
  }
View Full Code Here

      case FAST_FORWARD:
      case FORCED:
      case NO_CHANGE:
        break;
      default:
        throw new JGitInternalException("Updating HEAD failed");
      }
      rup = repo.updateRef(Constants.HEAD);
      res = rup.link(headName);
      switch (res) {
      case FAST_FORWARD:
      case FORCED:
      case NO_CHANGE:
        break;
      default:
        throw new JGitInternalException("Updating HEAD failed");
      }
    }
  }
View Full Code Here

    Iterable<RevCommit> commitsToUse = cmd.call();

    List<RevCommit> cherryPickList = new ArrayList<RevCommit>();
    for (RevCommit commit : commitsToUse) {
      if (commit.getParentCount() != 1)
        throw new JGitInternalException(
            MessageFormat.format(
                JGitText.get().canOnlyCherryPickCommitsWithOneParent,
                commit.name(),
                Integer.valueOf(commit.getParentCount())));
      cherryPickList.add(commit);
View Full Code Here

          throw new IOException("Could not fast-forward");
        }
      }
      return newCommit;
    } catch (RefAlreadyExistsException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } catch (RefNotFoundException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } catch (InvalidRefNameException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
  }
View Full Code Here

      }
    } else
      switch (repo.getRepositoryState()) {
      case SAFE:
        if (this.upstreamCommit == null)
          throw new JGitInternalException(MessageFormat
              .format(JGitText.get().missingRequiredParameter,
                  "upstream"));
        return;
      default:
        throw new WrongRepositoryStateException(MessageFormat.format(
View Full Code Here

        case FAST_FORWARD:
        case FORCED:
        case NO_CHANGE:
          break;
        default:
          throw new JGitInternalException(
              JGitText.get().abortingRebaseFailed);
        }
      }
      // cleanup the files
      FileUtils.delete(rebaseDir, FileUtils.RECURSIVE);
View Full Code Here

   */
  public RebaseCommand setUpstream(AnyObjectId upstream) {
    try {
      this.upstreamCommit = walk.parseCommit(upstream);
    } catch (IOException e) {
      throw new JGitInternalException(MessageFormat.format(
          JGitText.get().couldNotReadObjectWhileParsingCommit,
          upstream.name()), e);
    }
    return this;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.errors.JGitInternalException

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.