Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.Config$NamesInSection


    return oldTreeParser;
  }

  private static DiffEntry diffFile(Repository repo, String oldCommit,
    String newCommit, String path) throws IOException, GitAPIException {
    Config config = new Config();
    config.setBoolean("diff", null, "renames", true);
    DiffConfig diffConfig = config.get(DiffConfig.KEY);
    List<DiffEntry> diffList = new Git(repo).diff().
      setOldTree(prepareTreeParser(repo, oldCommit)).
      setNewTree(prepareTreeParser(repo, newCommit)).
      setPathFilter(FollowFilter.create(path, diffConfig)).
      call();
View Full Code Here


public class ReadUserConfig {

    public static void main(String[] args) throws IOException {
        Repository repository = CookbookHelper.openJGitCookbookRepository();

        Config config = repository.getConfig();
        String name = config.getString("user", null, "name");
        String email = config.getString("user", null, "email");
        if (name == null || email == null) {
            System.out.println("User identity is unknown!");
        } else {
            System.out.println("User identity is " + name + " <" + email + ">");
        }
       
        String url = config.getString("remote", "origin", "url");
        if (url != null) {
                System.out.println("Origin comes from " + url);
        }
       
        repository.close();
View Full Code Here

      FileRepositoryBuilder builder = new FileRepositoryBuilder();
      Repository repository = builder.setGitDir(new File(path)).build();
     
      RevWalk walk = new RevWalk(repository);

      Config storedConfig = repository.getConfig();
      Set<String> remotes = storedConfig.getSubsections("remote");
      
      String remoteGithub = "";
      for (String remoteName : remotes) {
        String url = storedConfig.getString("remote", remoteName, "url");
        if (url.startsWith("https://github.com"))
        {
          if (!"".equals(remoteGithub))
          {
            System.out.println("Found second url - " + remoteGithub + "," + url);
View Full Code Here

      postBuffer = rc.getInt("http", "postbuffer", 1 * 1024 * 1024); //$NON-NLS-1$  //$NON-NLS-2$
      sslVerify = rc.getBoolean("http", "sslVerify", true);
    }

    private HttpConfig() {
      this(new Config());
    }
View Full Code Here

      postBuffer = rc.getInt("http", "postbuffer", 1 * 1024 * 1024); //$NON-NLS-1$  //$NON-NLS-2$
      sslVerify = rc.getBoolean("http", "sslVerify", true); //$NON-NLS-1$ //$NON-NLS-2$
    }

    private HttpConfig() {
      this(new Config());
    }
View Full Code Here

          JGitText.get().cannotPullOnARepoWithState, repo
              .getRepositoryState().name()));

    // get the configured remote for the currently checked out branch
    // stored in configuration key branch.<branch name>.remote
    Config repoConfig = repo.getConfig();
    String remote = repoConfig.getString(
        ConfigConstants.CONFIG_BRANCH_SECTION, branchName,
        ConfigConstants.CONFIG_KEY_REMOTE);
    if (remote == null)
      // fall back to default remote
      remote = Constants.DEFAULT_REMOTE_NAME;

    // get the name of the branch in the remote repository
    // stored in configuration key branch.<branch name>.merge
    String remoteBranchName = repoConfig.getString(
        ConfigConstants.CONFIG_BRANCH_SECTION, branchName,
        ConfigConstants.CONFIG_KEY_MERGE);

        // determines whether rebase should be used after fetching
        boolean doRebase = false;
        switch (pullRebaseMode) {
            case REBASE:
                doRebase = true;
                break;
            case NO_REBASE:
                doRebase = false;
                break;
            case USE_CONFIG:
            default:
                // check if the branch is configured for pull-rebase
                doRebase = repoConfig.getBoolean(
                        ConfigConstants.CONFIG_BRANCH_SECTION, branchName,
                        ConfigConstants.CONFIG_KEY_REBASE, false);
                break;
        }

    if (remoteBranchName == null) {
      String missingKey = ConfigConstants.CONFIG_BRANCH_SECTION + DOT
          + branchName + DOT + ConfigConstants.CONFIG_KEY_MERGE;
      throw new InvalidConfigurationException(MessageFormat.format(
          JGitText.get().missingConfigurationForKey, missingKey));
    }

    final boolean isRemote = !remote.equals("."); //$NON-NLS-1$
    String remoteUri;
    FetchResult fetchRes;
    if (isRemote) {
      remoteUri = repoConfig.getString(
          ConfigConstants.CONFIG_REMOTE_SECTION, remote,
          ConfigConstants.CONFIG_KEY_URL);
      if (remoteUri == null) {
        String missingKey = ConfigConstants.CONFIG_REMOTE_SECTION + DOT
            + remote + DOT + ConfigConstants.CONFIG_KEY_URL;
View Full Code Here

      postBuffer = rc.getInt("http", "postbuffer", 1 * 1024 * 1024); //$NON-NLS-1$  //$NON-NLS-2$
      sslVerify = rc.getBoolean("http", "sslVerify", true); //$NON-NLS-1$ //$NON-NLS-2$
    }

    private HttpConfig() {
      this(new Config());
    }
View Full Code Here

              modulesConfig = new BlobBasedConfig(null, repository,
                  configWalk.getObjectId(0));
              return this;
            }
          }
          modulesConfig = new Config();
        } finally {
          if (idx > 0)
            rootTree.next(idx);
        }
      } finally {
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.lib.Config$NamesInSection

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.