Package org.eclipse.jgit.lib

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


    private PreBuildMergeOptions options1 = new PreBuildMergeOptions();
    private PreBuildMergeOptions options2 = new PreBuildMergeOptions();

    @Before
    public void setUp() throws URISyntaxException {
        Config config = new Config();
        config.setString(GitRepository.REMOTE_SECTION, "name1", "url", "http://git1.com");
        config.setString(GitRepository.REMOTE_SECTION, "name1", "fetch", "refSpec1");
        config.setString(GitRepository.REMOTE_SECTION, "name2", "url", "http://git2.com");
        config.setString(GitRepository.REMOTE_SECTION, "name2", "fetch", "refSpec2");
        remoteConfigs = GitRepository.getAllGitRepositories(config);
        config = new Config();
        config.setString(GitRepository.REMOTE_SECTION, "name1", "url", "http://git1.com");
        config.setString(GitRepository.REMOTE_SECTION, "name1", "fetch", "refSpec1");
        remoteConfigs.addAll(GitRepository.getAllGitRepositories(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);
    // check if the branch is configured for pull-rebase
    boolean doRebase = repoConfig.getBoolean(
        ConfigConstants.CONFIG_BRANCH_SECTION, branchName,
        ConfigConstants.CONFIG_KEY_REBASE, false);

    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(".");
    String remoteUri;
    FetchResult fetchRes;
    if (isRemote) {
      remoteUri = repoConfig.getString("remote", remote,
          ConfigConstants.CONFIG_KEY_URL);
      if (remoteUri == null) {
        String missingKey = ConfigConstants.CONFIG_REMOTE_SECTION + DOT
            + remote + DOT + ConfigConstants.CONFIG_KEY_URL;
        throw new InvalidConfigurationException(MessageFormat.format(
View Full Code Here

        }
      }

      if (addGitFlow) {
        // insert a .gitflow file
        Config config = new Config();
        config.setString("gitflow", null, "masterBranch", Constants.MASTER);
        config.setString("gitflow", null, "developBranch", Constants.DEVELOP);
        config.setString("gitflow", null, "featureBranchPrefix", "feature/");
        config.setString("gitflow", null, "releaseBranchPrefix", "release/");
        config.setString("gitflow", null, "hotfixBranchPrefix", "hotfix/");
        config.setString("gitflow", null, "supportBranchPrefix", "support/");
        config.setString("gitflow", null, "versionTagPrefix", "");

        byte [] bytes = config.toText().getBytes(Constants.ENCODING);

        DirCacheEntry entry = new DirCacheEntry(".gitflow");
        entry.setLength(bytes.length);
        entry.setLastModified(System.currentTimeMillis());
        entry.setFileMode(FileMode.REGULAR_FILE);
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

    return s > 0 ? path.substring(0, s) : "";
  }

  public class FakeTreeIterator extends WorkingTreeIterator {
    public FakeTreeIterator(String pathName, FileMode fileMode) {
      super(prefix(pathName), new Config().get(WorkingTreeOptions.KEY));
      mode = fileMode.getBits();

      final int s = pathName.lastIndexOf('/');
      final byte[] name = Constants.encode(pathName.substring(s + 1));
      ensurePathCapacity(pathOffset + name.length, pathOffset);
View Full Code Here

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

    Config repoConfig = repo.getConfig();
    if (remote == null) {
      // get the configured remote for the currently checked out branch
      // stored in configuration key branch.<branch name>.remote
      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;

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

    // determines whether rebase should be used after fetching
    if (pullRebaseMode == null) {
      pullRebaseMode = getRebaseMode(branchName, repoConfig);
    }

    if (remoteBranchName == null)
      remoteBranchName = branchName;

    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

    this.modTimes = modTimes;
  }

  public FileTreeIteratorWithTimeControl(File f, FS fs,
      TreeSet<Long> modTimes) {
    super(f, fs, new Config().get(WorkingTreeOptions.KEY));
    this.modTimes = modTimes;
  }
View Full Code Here

      DirCache index = DirCache.newInCore();
      DirCacheBuilder builder = index.builder();
      ObjectInserter inserter = repo.newObjectInserter();
      RevWalk rw = new RevWalk(repo);
      try {
        Config cfg = new Config();
        for (Project proj : bareProjects) {
          String name = proj.path;
          String nameUri = proj.name;
          cfg.setString("submodule", name, "path", name); //$NON-NLS-1$ //$NON-NLS-2$
          cfg.setString("submodule", name, "url", nameUri); //$NON-NLS-1$ //$NON-NLS-2$
          // create gitlink
          DirCacheEntry dcEntry = new DirCacheEntry(name);
          ObjectId objectId;
          if (ObjectId.isId(proj.revision))
            objectId = ObjectId.fromString(proj.revision);
          else {
            objectId = callback.sha1(nameUri, proj.revision);
          }
          if (objectId == null)
            throw new RemoteUnavailableException(nameUri);
          dcEntry.setObjectId(objectId);
          dcEntry.setFileMode(FileMode.GITLINK);
          builder.add(dcEntry);

          for (CopyFile copyfile : proj.copyfiles) {
            byte[] src = callback.readFile(
                nameUri, proj.revision, copyfile.src);
            objectId = inserter.insert(Constants.OBJ_BLOB, src);
            dcEntry = new DirCacheEntry(copyfile.dest);
            dcEntry.setObjectId(objectId);
            dcEntry.setFileMode(FileMode.REGULAR_FILE);
            builder.add(dcEntry);
          }
        }
        String content = cfg.toText();

        // create a new DirCacheEntry for .gitmodules file.
        final DirCacheEntry dcEntry = new DirCacheEntry(Constants.DOT_GIT_MODULES);
        ObjectId objectId = inserter.insert(Constants.OBJ_BLOB,
            content.getBytes(Constants.CHARACTER_ENCODING));
View Full Code Here

  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();
    final Config config = db.getConfig();
    remoteConfig = new RemoteConfig(config, "test");
    remoteConfig.addURI(new URIish("http://everyones.loves.git/u/2"));
    transport = null;
  }
View Full Code Here

  public void indexWithGitmodules() throws Exception {
    final ObjectId subId = ObjectId
        .fromString("abcd1234abcd1234abcd1234abcd1234abcd1234");
    final String path = "sub";

    final Config gitmodules = new Config();
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_PATH,
        "sub");
    // Different config in the index should be overridden by the working tree.
    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_URL,
        "git://example.com/bad");
    final RevBlob gitmodulesBlob = testDb.blob(gitmodules.toText());

    gitmodules.setString(CONFIG_SUBMODULE_SECTION, path, CONFIG_KEY_URL,
        "git://example.com/sub");
    writeTrashFile(DOT_GIT_MODULES, gitmodules.toText());

    DirCache cache = db.lockDirCache();
    DirCacheEditor editor = cache.editor();
    editor.add(new PathEdit(path) {
View Full Code Here

TOP

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

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.