Package org.eclipse.jgit.api.errors

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


          FileUtils.delete(new File(repo.getWorkTree(), file));
          files.add(file);
        }
      }
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
    return files;
  }
View Full Code Here


          fc.close();
        }
        return refmap.values();

      } catch (TransportException e) {
        throw new JGitInternalException(
            JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
            e);
      } finally {
        transport.close();
      }
    } catch (URISyntaxException e) {
      throw new InvalidRemoteException(MessageFormat.format(
          JGitText.get().invalidRemote, remote));
    } catch (NotSupportedException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfLsRemoteCommand,
          e);
    }
  }
View Full Code Here

      map.set(id, null, inserter);
      commitNoteMap(walk, map, notesCommit, inserter,
          "Notes removed by 'git notes remove'");
      return map.getNote(id);
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } finally {
      inserter.release();
      walk.release();
    }
  }
View Full Code Here

                lowLevelResults, null);
          }
        }
      }
    } catch (IOException e) {
      throw new JGitInternalException(
          MessageFormat.format(
              JGitText.get().exceptionCaughtDuringExecutionOfMergeCommand,
              e), e);
    } finally {
      if (revWalk != null)
View Full Code Here

    case REJECTED:
    case LOCK_FAILURE:
      throw new ConcurrentRefUpdateException(
          JGitText.get().couldNotLockHEAD, refUpdate.getRef(), rc);
    default:
      throw new JGitInternalException(MessageFormat.format(
          JGitText.get().updatingRefFailed, Constants.HEAD,
          newHeadId.toString(), rc));
    }
  }
View Full Code Here

      Repository repository = builder.build();
      if (!repository.getObjectDatabase().exists())
        repository.create(bare);
      return new Git(repository);
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
  }
View Full Code Here

      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

            gen.push(null, new RawText(inTree));
        }
      }
      return gen.computeBlameResult();
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } finally {
      gen.release();
    }
  }
View Full Code Here

      // resolve the ref to a commit
      final ObjectId commitId;
      try {
        commitId = repo.resolve(ref);
      } catch (IOException e) {
        throw new JGitInternalException(
            MessageFormat.format(JGitText.get().cannotRead, ref),
            e);
      }
      RevWalk rw = new RevWalk(repo);
      try {
        commit = rw.parseCommit(commitId);
      } catch (IOException e) {
        throw new JGitInternalException(
            MessageFormat.format(
            JGitText.get().cannotReadCommit, commitId.toString()),
            e);
      } finally {
        rw.release();
      }

      if (!filepaths.isEmpty()) {
        // reset [commit] -- paths
        resetIndexForPaths(commit);
        setCallable(false);
        return repo.getRef(Constants.HEAD);
      }

      // write the ref
      final RefUpdate ru = repo.updateRef(Constants.HEAD);
      ru.setNewObjectId(commitId);

      String refName = Repository.shortenRefName(ref);
      String message = refName + ": updating " + Constants.HEAD; //$NON-NLS-1$
      ru.setRefLogMessage(message, false);
      if (ru.forceUpdate() == RefUpdate.Result.LOCK_FAILURE)
        throw new JGitInternalException(MessageFormat.format(
            JGitText.get().cannotLock, ru.getName()));

      switch (mode) {
        case HARD:
          checkoutIndex(commit);
          break;
        case MIXED:
          resetIndex(commit);
          break;
        case SOFT: // do nothing, only the ref was changed
          break;
        case KEEP: // TODO
        case MERGE: // TODO
          throw new UnsupportedOperationException();

      }

      if (mode != ResetType.SOFT) {
        if (merging)
          resetMerge();
        else if (cherryPicking)
          resetCherryPick();
      }

      setCallable(false);
      r = ru.getRef();
    } catch (IOException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfResetCommand,
          e);
    }

    return r;
View Full Code Here

   *            the mode of the reset command
   * @return this instance
   */
  public ResetCommand setMode(ResetType mode) {
    if (!filepaths.isEmpty())
      throw new JGitInternalException(MessageFormat.format(
          JGitText.get().illegalCombinationOfArguments,
          "[--mixed | --soft | --hard]", "<paths>..."));
    this.mode = mode;
    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.