List of usage examples for org.eclipse.jgit.storage.file FileBasedConfig setBoolean
public void setBoolean(final String section, final String subsection, final String name, final boolean value)
From source file:com.ericsson.gerrit.plugins.highavailability.SetupLocalHAReplica.java
License:Apache License
void run(SitePaths replica, FileBasedConfig pluginConfig) throws IOException, ConfigInvalidException { this.replicaSitePaths = replica; FileUtil.mkdirsOrDie(replicaSitePaths.site_path, "cannot create " + replicaSitePaths.site_path); configureMainSection(pluginConfig);/* w w w . ja v a 2s . c o m*/ configurePeerInfo(pluginConfig); for (Path dir : listDirsForCopy()) { copyFiles(dir); } mkdir(replicaSitePaths.logs_dir); mkdir(replicaSitePaths.tmp_dir); symlink(Paths.get(masterConfig.getString("gerrit", null, "basePath"))); symlink(sharedDir); FileBasedConfig replicaConfig = new FileBasedConfig(replicaSitePaths.gerrit_config.toFile(), FS.DETECTED); replicaConfig.load(); if ("h2".equals(masterConfig.getString(DATABASE, null, "type"))) { masterConfig.setBoolean(DATABASE, "h2", "autoServer", true); replicaConfig.setBoolean(DATABASE, "h2", "autoServer", true); symlinkH2ReviewDbDir(); } }
From source file:com.googlesource.gerrit.plugins.emoticons.PutConfig.java
License:Apache License
@Override public Response<?> apply(ConfigResource rsrc, Input input) throws IOException, ConfigInvalidException, UnprocessableEntityException { if (input == null) { input = new Input(); }/*w ww.j a v a2 s. c o m*/ FileBasedConfig cfg = new FileBasedConfig(sitePaths.gerrit_config.toFile(), FS.DETECTED); cfg.load(); if (input.showEmoticons != null) { if (input.showEmoticons) { cfg.setBoolean("plugin", pluginName, "showEmoticons", input.showEmoticons); } else { cfg.unset("plugin", pluginName, "stage"); } } cfg.save(); cfgFactory.getFromGerritConfig(pluginName, true); return Response.none(); }
From source file:com.googlesource.gerrit.plugins.verifystatus.server.PutConfig.java
License:Apache License
@Override public Response<?> apply(ConfigResource rsrc, Input input) throws IOException, ConfigInvalidException, UnprocessableEntityException { if (input == null) { input = new Input(); }/* w w w . j a va 2s .c o m*/ FileBasedConfig cfg = new FileBasedConfig(sitePaths.gerrit_config.toFile(), FS.DETECTED); cfg.load(); if (input.showJobsPanel != null) { cfg.setBoolean("plugin", pluginName, "showJobsPanel", input.showJobsPanel); } else { cfg.unset("plugin", pluginName, "showJobsPanel"); } if (input.showJobsDropDownPanel != null) { cfg.setBoolean("plugin", pluginName, "showJobsDropDownPanel", input.showJobsDropDownPanel); } else { cfg.unset("plugin", pluginName, "showJobsDropDownPanel"); } if (input.showJobsSummaryPanel != null) { cfg.setBoolean("plugin", pluginName, "showJobsSummaryPanel", input.showJobsSummaryPanel); } else { cfg.unset("plugin", pluginName, "showJobsSummaryPanel"); } cfg.save(); cfgFactory.getFromGerritConfig(pluginName, true); return Response.none(); }
From source file:org.commonjava.gitwrap.BareGitRepository.java
License:Open Source License
protected BareGitRepository(final File gitDir, final boolean create, final File workDir) throws IOException { this.gitDir = gitDir; this.workDir = workDir; final FileRepositoryBuilder builder = new FileRepositoryBuilder(); builder.setGitDir(gitDir);// w w w .j a v a 2 s .com if (workDir != null) { builder.setWorkTree(workDir); } builder.setup(); repository = new FileRepository(builder); if (create && !gitDir.exists()) { final File objectsDir = new File(gitDir, "objects"); final File refsDir = new File(gitDir, "refs"); refsDir.mkdirs(); objectsDir.mkdirs(); repository.create(workDir == null); final FileBasedConfig config = repository.getConfig(); config.setInt("core", null, "repositoryformatversion", 0); config.setBoolean("core", null, "filemode", true); config.setBoolean("core", null, "bare", workDir == null); config.setBoolean("core", null, "logallrefupdates", true); config.setBoolean("core", null, "ignorecase", true); config.save(); } git = new Git(repository); }
From source file:org.jboss.forge.git.Clone.java
License:Eclipse Distribution License
public void run(File projectDir, String sourceUri) throws IOException { try {/* w w w.j ava 2 s .com*/ final URIish uri = new URIish(sourceUri); File gitdir = new File(projectDir, Constants.DOT_GIT); db = new FileRepository(gitdir); db.create(); final FileBasedConfig dstcfg = db.getConfig(); dstcfg.setBoolean("core", null, "bare", false); dstcfg.save(); saveRemote(uri); final FetchResult r = runFetch(); final Ref branch = guessHEAD(r); doCheckout(branch); } catch (URISyntaxException e) { throw new IllegalArgumentException("Failed to parse remote repository URI", e); } }