Package org.eclipse.jgit.api.errors

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


   * @return {@code this}
   */
  public CommitCommand setOnly(String only) {
    checkCallable();
    if (all)
      throw new JGitInternalException(MessageFormat.format(
          JGitText.get().illegalCombinationOfArguments, "--only",
          "--all"));
    String o = only.endsWith("/") ? only.substring(0, only.length() - 1)
        : only;
    // ignore duplicates
View Full Code Here


        }
        updated.add(generator.getPath());
      }
      return updated;
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } catch (ConfigInvalidException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } catch (GitAPIException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
  }
View Full Code Here

    if (uri == null || uri.length() == 0)
      throw new IllegalArgumentException(JGitText.get().uriNotConfigured);

    try {
      if (submoduleExists())
        throw new JGitInternalException(MessageFormat.format(
            JGitText.get().submoduleExists, path));
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }

    final String resolvedUri;
    try {
      resolvedUri = SubmoduleWalk.getSubmoduleRemoteUrl(repo, uri);
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
    // Clone submodule repository
    File moduleDirectory = SubmoduleWalk.getSubmoduleDirectory(repo, path);
    CloneCommand clone = Git.cloneRepository();
    configure(clone);
    clone.setDirectory(moduleDirectory);
    clone.setURI(resolvedUri);
    if (monitor != null)
      clone.setProgressMonitor(monitor);
    Repository subRepo = clone.call().getRepository();

    // Save submodule URL to parent repository's config
    StoredConfig config = repo.getConfig();
    config.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_URL, resolvedUri);
    try {
      config.save();
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }

    // Save path and URL to parent repository's .gitmodules file
    FileBasedConfig modulesConfig = new FileBasedConfig(new File(
        repo.getWorkTree(), Constants.DOT_GIT_MODULES), repo.getFS());
    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_PATH, path);
    modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
        ConfigConstants.CONFIG_KEY_URL, uri);
    try {
      modulesConfig.save();
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }

    AddCommand add = new AddCommand(repo);
    // Add .gitmodules file to parent repository's index
    add.addFilepattern(Constants.DOT_GIT_MODULES);
    // Add submodule directory to parent repository's index
    add.addFilepattern(path);
    try {
      add.call();
    } catch (NoFilepatternException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }

    return subRepo;
  }
View Full Code Here

      // Save repository config if any values were updated
      if (!initialized.isEmpty())
        config.save();
      return initialized;
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } catch (ConfigInvalidException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
  }
View Full Code Here

                  shortOldName);
          repoConfig.save();
        }

      } else
        throw new JGitInternalException(MessageFormat.format(JGitText
            .get().renameBranchUnexpectedResult, renameResult
            .name()));

      Ref resultRef = repo.getRef(newName);
      if (resultRef == null)
        throw new JGitInternalException(
            JGitText.get().renameBranchFailedUnknownReason);
      return resultRef;
    } catch (IOException ioe) {
      throw new JGitInternalException(ioe.getMessage(), ioe);
    }
  }
View Full Code Here

      }
      if (!synced.isEmpty())
        config.save();
      return synced;
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
    } catch (ConfigInvalidException e) {
      throw new JGitInternalException(e.getMessage(), e);
    }
  }
View Full Code Here

    try {
      for (ReflogEntry entry : stashEntries)
        try {
          stashCommits.add(walk.parseCommit(entry.getNewId()));
        } catch (IOException e) {
          throw new JGitInternalException(MessageFormat.format(
              JGitText.get().cannotReadCommit, entry.getNewId()),
              e);
        }
    } finally {
      walk.dispose();
View Full Code Here

        try {
          PushResult result = transport.push(monitor, toPush);
          pushResults.add(result);

        } catch (TransportException e) {
          throw new JGitInternalException(
              JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
              e);
        } finally {
          transport.close();
        }
      }

    } catch (URISyntaxException e) {
      throw new InvalidRemoteException(MessageFormat.format(
          JGitText.get().invalidRemote, remote));
    } catch (NotSupportedException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
          e);
    } catch (IOException e) {
      throw new JGitInternalException(
          JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
          e);
    }

    return pushResults;
View Full Code Here

    } else {
      Ref src;
      try {
        src = repo.getRef(nameOrSpec);
      } catch (IOException e) {
        throw new JGitInternalException(
            JGitText.get().exceptionCaughtDuringExecutionOfPushCommand,
            e);
      }
      if (src != null)
        add(src);
View Full Code Here

          return CherryPickResult.CONFLICT;
        }
      }
    } catch (IOException e) {
      throw new JGitInternalException(
          MessageFormat.format(
              JGitText.get().exceptionCaughtDuringExecutionOfCherryPickCommand,
              e), e);
    } finally {
      revWalk.release();
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.