Package org.eclipse.jgit.api.errors

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


      JGitInternalException, WrongRepositoryStateException {
    checkCallable();

    RepositoryState state = repo.getRepositoryState();
    if (!state.canCommit())
      throw new WrongRepositoryStateException(MessageFormat.format(
          JGitText.get().cannotCommitOnARepoWithState, state.name()));
    processOptions(state);

    try {
      if (all && !repo.isBare() && repo.getWorkTree() != null) {
View Full Code Here


          JGitText.get().exceptionCaughtDuringExecutionOfPullCommand,
          e);
    }

    if (!repo.getRepositoryState().equals(RepositoryState.SAFE))
      throw new WrongRepositoryStateException(MessageFormat.format(
          JGitText.get().cannotPullOnARepoWithState, repo
              .getRepositoryState().name()));

    // get the configured remote for the currently checked out branch
    // stored in configuration key branch.<branch name>.remote
View Full Code Here

      // these operations are only possible while in a rebasing state
      switch (repo.getRepositoryState()) {
      case REBASING_INTERACTIVE:
        break;
      default:
        throw new WrongRepositoryStateException(MessageFormat.format(
            JGitText.get().wrongRepositoryState, repo
                .getRepositoryState().name()));
      }
    } 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(
            JGitText.get().wrongRepositoryState, repo
                .getRepositoryState().name()));

      }
  }
View Full Code Here

          JGitText.get().exceptionCaughtDuringExecutionOfPullCommand,
          e);
    }

    if (!repo.getRepositoryState().equals(RepositoryState.SAFE))
      throw new WrongRepositoryStateException(MessageFormat.format(
          JGitText.get().cannotPullOnARepoWithState, repo
              .getRepositoryState().name()));

    Config repoConfig = repo.getConfig();
    if (remote == null) {
View Full Code Here

    RevWalk rw = new RevWalk(repo);

    try {
      RepositoryState state = repo.getRepositoryState();
      if (!state.canCommit())
        throw new WrongRepositoryStateException(MessageFormat.format(
            JGitText.get().cannotCommitOnARepoWithState,
            state.name()));
      processOptions(state, rw);

      if (all && !repo.isBare() && repo.getWorkTree() != null) {
        Git git = new Git(repo);
        try {
          git.add()
              .addFilepattern(".") //$NON-NLS-1$
              .setUpdate(true).call();
        } catch (NoFilepatternException e) {
          // should really not happen
          throw new JGitInternalException(e.getMessage(), e);
        }
      }

      Ref head = repo.getRef(Constants.HEAD);
      if (head == null)
        throw new NoHeadException(
            JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported);

      // determine the current HEAD and the commit it is referring to
      ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}"); //$NON-NLS-1$
      if (headId == null && amend)
        throw new WrongRepositoryStateException(
            JGitText.get().commitAmendOnInitialNotPossible);

      if (headId != null)
        if (amend) {
          RevCommit previousCommit = rw.parseCommit(headId);
View Full Code Here

      StashApplyFailureException {
    checkCallable();

    if (!ignoreRepositoryState
        && repo.getRepositoryState() != RepositoryState.SAFE)
      throw new WrongRepositoryStateException(MessageFormat.format(
          JGitText.get().stashApplyOnUnsafeRepository,
          repo.getRepositoryState()));

    ObjectReader reader = repo.newObjectReader();
    try {
View Full Code Here

  }

  private void checkParameters() throws WrongRepositoryStateException {
    if (this.operation == Operation.PROCESS_STEPS) {
      if (rebaseState.getFile(DONE).exists())
        throw new WrongRepositoryStateException(MessageFormat.format(
            JGitText.get().wrongRepositoryState, repo
                .getRepositoryState().name()));
    }
    if (this.operation != Operation.BEGIN) {
      // these operations are only possible while in a rebasing state
      switch (repo.getRepositoryState()) {
      case REBASING_INTERACTIVE:
      case REBASING:
      case REBASING_REBASING:
      case REBASING_MERGE:
        break;
      default:
        throw new WrongRepositoryStateException(MessageFormat.format(
            JGitText.get().wrongRepositoryState, repo
                .getRepositoryState().name()));
      }
    } 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(
            JGitText.get().wrongRepositoryState, repo
                .getRepositoryState().name()));

      }
  }
View Full Code Here

  @Override
  public ObjectId call() throws GitAPIException, WrongRepositoryStateException, NoHeadException, StashApplyFailureException {
    checkCallable();

    if (!ignoreRepositoryState && repo.getRepositoryState() != RepositoryState.SAFE)
      throw new WrongRepositoryStateException(MessageFormat.format(JGitText.get().stashApplyOnUnsafeRepository, repo.getRepositoryState()));

    ObjectReader reader = repo.newObjectReader();
    try {
      RevWalk revWalk = new RevWalk(reader);
View Full Code Here

      case REBASING:
      case REBASING_REBASING:
      case REBASING_MERGE:
        break;
      default:
        throw new WrongRepositoryStateException(MessageFormat.format(
            JGitText.get().wrongRepositoryState, repo
                .getRepositoryState().name()));
      }
    } 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(
            JGitText.get().wrongRepositoryState, repo
                .getRepositoryState().name()));

      }
  }
View Full Code Here

          JGitText.get().exceptionCaughtDuringExecutionOfPullCommand,
          e);
    }

    if (!repo.getRepositoryState().equals(RepositoryState.SAFE))
      throw new WrongRepositoryStateException(MessageFormat.format(
          JGitText.get().cannotPullOnARepoWithState, repo
              .getRepositoryState().name()));

    // get the configured remote for the currently checked out branch
    // stored in configuration key branch.<branch name>.remote
View Full Code Here

TOP

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

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.