Package org.eclipse.jgit.api.errors

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


  }

  private void processOptions() throws InvalidRefNameException {
    if (name == null
        || !Repository.isValidRefName(Constants.R_HEADS + name))
      throw new InvalidRefNameException(MessageFormat.format(JGitText
          .get().branchNameInvalid, name == null ? "<null>" : name));
  }
View Full Code Here


    try {
      ReflogReader reader = new ReflogReader(repo, ref);
      return reader.getReverseEntries();
    } catch (IOException e) {
      throw new InvalidRefNameException(MessageFormat.format(
          JGitText.get().cannotRead, ref), e);
    }
  }
View Full Code Here

  public Ref call() throws RefNotFoundException, InvalidRefNameException,
      RefAlreadyExistsException, DetachedHeadException {
    checkCallable();

    if (newName == null)
      throw new InvalidRefNameException(MessageFormat.format(JGitText
          .get().branchNameInvalid, "<null>"));

    try {
      String fullOldName;
      String fullNewName;
      if (repo.getRef(newName) != null)
        throw new RefAlreadyExistsException(MessageFormat.format(
            JGitText.get().refAlreadyExists, newName));
      if (oldName != null) {
        Ref ref = repo.getRef(oldName);
        if (ref == null)
          throw new RefNotFoundException(MessageFormat.format(
              JGitText.get().refNotResolved, oldName));
        if (ref.getName().startsWith(Constants.R_TAGS))
          throw new RefNotFoundException(MessageFormat.format(
              JGitText.get().renameBranchFailedBecauseTag,
              oldName));
        fullOldName = ref.getName();
      } else {
        fullOldName = repo.getFullBranch();
        if (ObjectId.isId(fullOldName))
          throw new DetachedHeadException();
      }

      if (fullOldName.startsWith(Constants.R_REMOTES))
        fullNewName = Constants.R_REMOTES + newName;
      else {
        fullNewName = Constants.R_HEADS + newName;
      }

      if (!Repository.isValidRefName(fullNewName))
        throw new InvalidRefNameException(MessageFormat.format(JGitText
            .get().branchNameInvalid, fullNewName));

      RefRename rename = repo.renameRef(fullOldName, fullNewName);
      Result renameResult = rename.rename();
View Full Code Here

    try {
      if (repo.getRef(Constants.R_STASH) == null)
        return Collections.emptyList();
    } catch (IOException e) {
      throw new InvalidRefNameException(MessageFormat.format(
          JGitText.get().cannotRead, Constants.R_STASH), e);
    }

    final ReflogCommand refLog = new ReflogCommand(repo);
    refLog.setRef(Constants.R_STASH);
View Full Code Here

  private void processOptions() throws InvalidRefNameException {
    if (paths.isEmpty()
        && (name == null || !Repository
            .isValidRefName(Constants.R_HEADS + name)))
      throw new InvalidRefNameException(MessageFormat.format(JGitText
          .get().branchNameInvalid, name == null ? "<null>" : name));
  }
View Full Code Here

  private void processOptions() throws InvalidRefNameException {
    if (paths.isEmpty()
        && (name == null || !Repository
            .isValidRefName(Constants.R_HEADS + name)))
      throw new InvalidRefNameException(MessageFormat.format(JGitText
          .get().branchNameInvalid, name == null ? "<null>" : name));
  }
View Full Code Here

  public Ref call() throws GitAPIException, RefNotFoundException, InvalidRefNameException,
      RefAlreadyExistsException, DetachedHeadException {
    checkCallable();

    if (newName == null)
      throw new InvalidRefNameException(MessageFormat.format(JGitText
          .get().branchNameInvalid, "<null>"));

    try {
      String fullOldName;
      String fullNewName;
      if (repo.getRef(newName) != null)
        throw new RefAlreadyExistsException(MessageFormat.format(
            JGitText.get().refAlreadyExists1, newName));
      if (oldName != null) {
        Ref ref = repo.getRef(oldName);
        if (ref == null)
          throw new RefNotFoundException(MessageFormat.format(
              JGitText.get().refNotResolved, oldName));
        if (ref.getName().startsWith(Constants.R_TAGS))
          throw new RefNotFoundException(MessageFormat.format(
              JGitText.get().renameBranchFailedBecauseTag,
              oldName));
        fullOldName = ref.getName();
      } else {
        fullOldName = repo.getFullBranch();
        if (ObjectId.isId(fullOldName))
          throw new DetachedHeadException();
      }

      if (fullOldName.startsWith(Constants.R_REMOTES))
        fullNewName = Constants.R_REMOTES + newName;
      else {
        fullNewName = Constants.R_HEADS + newName;
      }

      if (!Repository.isValidRefName(fullNewName))
        throw new InvalidRefNameException(MessageFormat.format(JGitText
            .get().branchNameInvalid, fullNewName));

      RefRename rename = repo.renameRef(fullOldName, fullNewName);
      Result renameResult = rename.rename();
View Full Code Here

  }

  private void processOptions() throws InvalidRefNameException {
    if (name == null
        || !Repository.isValidRefName(Constants.R_HEADS + name))
      throw new InvalidRefNameException(MessageFormat.format(JGitText
          .get().branchNameInvalid, name == null ? "<null>" : name));
  }
View Full Code Here

  private void processOptions() throws InvalidRefNameException {
    if ((!checkoutAllPaths && paths.isEmpty())
        && (name == null || !Repository
            .isValidRefName(Constants.R_HEADS + name)))
      throw new InvalidRefNameException(MessageFormat.format(JGitText
          .get().branchNameInvalid, name == null ? "<null>" : name));
  }
View Full Code Here

  }

  private void processOptions() throws InvalidRefNameException {
    if (name == null
        || !Repository.isValidRefName(Constants.R_HEADS + name))
      throw new InvalidRefNameException(MessageFormat.format(JGitText
          .get().branchNameInvalid, name == null ? "<null>" : name));
  }
View Full Code Here

TOP

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

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.