Example usage for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_UPDATE

List of usage examples for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_UPDATE

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_UPDATE.

Prototype

String CONFIG_KEY_UPDATE

To view the source code for org.eclipse.jgit.lib ConfigConstants CONFIG_KEY_UPDATE.

Click Source Link

Document

The "update" key

Usage

From source file:net.polydawn.mdm.commands.MdmAddCommand.java

License:Open Source License

Config doSubmoduleConfig(Config gitmodulesCfg, File path) {
    // write gitmodule config for the new submodule
    String slashedPath = (File.separatorChar != '/') ? path.getPath().replace(File.separatorChar, '/')
            : path.getPath();/*from  w  ww.  ja  va2s. c om*/
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, slashedPath,
            ConfigConstants.CONFIG_KEY_PATH, slashedPath);
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, slashedPath,
            ConfigConstants.CONFIG_KEY_URL, url);
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, slashedPath,
            MdmConfigConstants.Module.MODULE_TYPE.toString(), MdmModuleType.DEPENDENCY.toString());
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, slashedPath,
            MdmConfigConstants.Module.DEPENDENCY_VERSION.toString(), version);
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, slashedPath,
            ConfigConstants.CONFIG_KEY_UPDATE, "none"); // since almost all git commands by default will pull down waaaay too much data if they operate naively on our dependencies, we tell them to ignore all dependencies by default.  And of course, commands like `git pull` just steamroll right ahead and ignore this anyway, so those require even more drastic counters.
    return gitmodulesCfg;
}

From source file:net.polydawn.mdm.commands.MdmReleaseInitCommand.java

License:Open Source License

/**
 * Writes a new submodule block to the parentRepo's .gitmodules file declaring the
 * release repo, and initializes the local .git/config file to match.
 *
 * @param parentRepo/*from   w  w w .  j av a 2  s. c  om*/
 * @throws IOException
 * @throws ConfigInvalidException
 */
void writeParentGitmoduleConfig(Repository parentRepo) throws IOException, ConfigInvalidException {
    // write gitmodule config for the new submodule
    StoredConfig gitmodulesCfg = new FileBasedConfig(
            new File(parentRepo.getWorkTree(), Constants.DOT_GIT_MODULES), parentRepo.getFS());
    gitmodulesCfg.load();
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_PATH,
            path);
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_URL,
            remotePublicUrl);
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
            MdmConfigConstants.Module.MODULE_TYPE.toString(), MdmModuleType.RELEASES.toString());
    gitmodulesCfg.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path, ConfigConstants.CONFIG_KEY_UPDATE,
            "none");
    gitmodulesCfg.save();

    // initialize local parent repo config for the submodule
    MdmModuleRelease module = MdmModuleRelease.load(parentRepo, path, gitmodulesCfg);
    Plumbing.initLocalConfig(parentRepo, module);
    parentRepo.getConfig().save();
}

From source file:net.polydawn.mdm.Plumbing.java

License:Open Source License

/**
 * Similar to calling `git submodule init [module]`.  Also updates the MdmModule cache of values.
 * @return true if repo.getConfig() has been modified and should be saved.
 *//*from  ww  w.  j a v a 2s. c  om*/
public static boolean initLocalConfig(Repository repo, MdmModule module) {
    // Ignore entry if URL is already present in config file
    if (module.getUrlLocal() != null)
        return false;

    // Copy 'url' and 'update' fields to local repo config
    module.urlLocal = module.getUrlHistoric();
    repo.getConfig().setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, module.getHandle(),
            ConfigConstants.CONFIG_KEY_URL, module.getUrlLocal());
    repo.getConfig().setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, module.getHandle(),
            ConfigConstants.CONFIG_KEY_UPDATE, "none");
    return true;
}