当前位置: 首页>>代码示例>>Java>>正文


Java StoredConfig.unsetSection方法代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.StoredConfig.unsetSection方法的典型用法代码示例。如果您正苦于以下问题:Java StoredConfig.unsetSection方法的具体用法?Java StoredConfig.unsetSection怎么用?Java StoredConfig.unsetSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.lib.StoredConfig的用法示例。


在下文中一共展示了StoredConfig.unsetSection方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Override
protected void run () throws GitException {
    Repository repository = getRepository();
    StoredConfig config = repository.getConfig();
    config.unsetSection(ConfigConstants.CONFIG_REMOTE_SECTION, remote);
    Set<String> subSections = config.getSubsections(ConfigConstants.CONFIG_BRANCH_SECTION);
    for (String subSection : subSections) {
        if (remote.equals(config.getString(ConfigConstants.CONFIG_BRANCH_SECTION, subSection, ConfigConstants.CONFIG_KEY_REMOTE))) {
            config.unset(ConfigConstants.CONFIG_BRANCH_SECTION, subSection, ConfigConstants.CONFIG_KEY_REMOTE);
            config.unset(ConfigConstants.CONFIG_BRANCH_SECTION, subSection, ConfigConstants.CONFIG_KEY_MERGE);
        }
    }
    try {
        config.save();
    } catch (IOException ex) {
        throw new GitException(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:RemoveRemoteCommand.java

示例2: ifThereIsNoScmInfoAndNoRemoteBranchThenAnErrorIsThrown

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Test
public void ifThereIsNoScmInfoAndNoRemoteBranchThenAnErrorIsThrown()
		throws GitAPIException, IOException, InterruptedException {
	final TestProject testProject = TestProject.singleModuleProject();

	final StoredConfig config = testProject.local.getRepository().getConfig();
	config.unsetSection("remote", "origin");
	config.save();

	try {
		testProject.mvnRelease("1");
		Assert.fail("Should have failed");
	} catch (final MavenExecutionException e) {
		assertThat(e.output, oneOf(containsString("[ERROR] Remote tags could not be listed!")));
	}
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:17,代码来源:GitRelatedTest.java

示例3: deleteRegistrations

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Override
public boolean deleteRegistrations(List<GitblitRegistration> list) {
	boolean success = false;
	try {
		StoredConfig config = getConfig();
		for (GitblitRegistration reg : list) {
			config.unsetSection(SERVER, reg.name);
			registrations.remove(reg.name);
		}
		config.save();
		success = true;
	} catch (Throwable t) {
		Utils.showException(GitblitManager.this, t);
	}
	return success;
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:17,代码来源:GitblitManager.java

示例4: ifThereIsNoRemoteButTheScmDetailsArePresentThenThisIsUsed

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Test
public void ifThereIsNoRemoteButTheScmDetailsArePresentThenThisIsUsed()
		throws GitAPIException, IOException, InterruptedException {
	final TestProject testProject = TestProject.moduleWithScmTag();

	final StoredConfig config = testProject.local.getRepository().getConfig();
	config.unsetSection("remote", "origin");
	config.save();

	testProject.mvnRelease("1");
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:12,代码来源:GitRelatedTest.java

示例5: ifThereIsNoScmInfoAndNoRemoteBranchThenAnErrorIsThrown

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Test
public void ifThereIsNoScmInfoAndNoRemoteBranchThenAnErrorIsThrown() throws GitAPIException, IOException, InterruptedException {
    TestProject testProject = TestProject.singleModuleProject();

    StoredConfig config = testProject.local.getRepository().getConfig();
    config.unsetSection("remote", "origin");
    config.save();

    try {
        testProject.mvnRelease("1");
        Assert.fail("Should have failed");
    } catch (MavenExecutionException e) {
        assertThat(e.output, oneOf(containsString("[ERROR] origin: not found.")));
    }
}
 
开发者ID:danielflower,项目名称:multi-module-maven-release-plugin,代码行数:16,代码来源:GitRelatedTest.java

示例6: ifThereIsNoRemoteButTheScmDetailsArePresentThenThisIsUsed

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Test
public void ifThereIsNoRemoteButTheScmDetailsArePresentThenThisIsUsed() throws GitAPIException, IOException, InterruptedException {
    TestProject testProject = TestProject.moduleWithScmTag();

    StoredConfig config = testProject.local.getRepository().getConfig();
    config.unsetSection("remote", "origin");
    config.save();

    testProject.mvnRelease("1");
}
 
开发者ID:danielflower,项目名称:multi-module-maven-release-plugin,代码行数:11,代码来源:GitRelatedTest.java

示例7: usesThePassedInScmUrlToFindRemote

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Test
public void usesThePassedInScmUrlToFindRemote() throws Exception {
    String remote = scmUrlToRemote(dirToGitScmReference(project.originDir));
    LocalGitRepo repo = new LocalGitRepo(project.local, new RemoteTagFetcher(project.local, remote),
                                         new LocalTagPusher(project.local));
    tag(project.origin, "some-tag");

    StoredConfig config = project.local.getRepository().getConfig();
    config.unsetSection("remote", "origin");
    config.save();

    assertThat(repo.tagsFrom(tags("blah", "some-tag")), equalTo(asList("some-tag")));
}
 
开发者ID:danielflower,项目名称:multi-module-maven-release-plugin,代码行数:14,代码来源:LocalGitRepoTest.java

示例8: remoteDelete

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Override
public void remoteDelete(String name) throws GitException {
  StoredConfig config = repository.getConfig();
  Set<String> remoteNames = config.getSubsections(ConfigConstants.CONFIG_KEY_REMOTE);
  if (!remoteNames.contains(name)) {
    throw new GitException("error: Could not remove config section 'remote." + name + "'");
  }

  config.unsetSection(ConfigConstants.CONFIG_REMOTE_SECTION, name);
  Set<String> branches = config.getSubsections(ConfigConstants.CONFIG_BRANCH_SECTION);

  for (String branch : branches) {
    String r =
        config.getString(
            ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_REMOTE);
    if (name.equals(r)) {
      config.unset(
          ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_REMOTE);
      config.unset(
          ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_MERGE);
      List<Branch> remoteBranches = branchList(LIST_REMOTE);
      for (Branch remoteBranch : remoteBranches) {
        if (remoteBranch.getDisplayName().startsWith(name)) {
          branchDelete(remoteBranch.getName(), true);
        }
      }
    }
  }

  try {
    config.save();
  } catch (IOException exception) {
    throw new GitException(exception.getMessage(), exception);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:36,代码来源:JGitConnection.java

示例9: saveRegistration

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Override
public boolean saveRegistration(String name, GitblitRegistration reg) {
	try {
		StoredConfig config = getConfig();
		if (!StringUtils.isEmpty(name) && !name.equals(reg.name)) {
			// delete old registration
			registrations.remove(name);
			config.unsetSection(SERVER, name);
		}

		// update registration
		config.setString(SERVER, reg.name, "url", reg.url);
		config.setString(SERVER, reg.name, "account", reg.account);
		if (reg.savePassword) {
			config.setString(SERVER, reg.name, "password",
					Base64.encodeBytes(new String(reg.password).getBytes("UTF-8")));
		} else {
			config.setString(SERVER, reg.name, "password", "");
		}
		if (reg.lastLogin != null) {
			config.setString(SERVER, reg.name, "lastLogin", dateFormat.format(reg.lastLogin));
		}
		// serialize the feed definitions
		List<String> definitions = new ArrayList<String>();
		for (FeedModel feed : reg.feeds) {
			definitions.add(feed.toString());
		}
		if (definitions.size() > 0) {
			config.setStringList(SERVER, reg.name, FEED, definitions);
		}
		config.save();
		return true;
	} catch (Throwable t) {
		Utils.showException(GitblitManager.this, t);
	}
	return false;
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:38,代码来源:GitblitManager.java

示例10: initializeConfiguration

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@Before
public void initializeConfiguration() throws Exception{
	Repository r = GitBlitSuite.getHelloworldRepository();
	StoredConfig config = r.getConfig();
	
	config.unsetSection(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS);
	config.setString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, "commitMessageRegEx", "\\d");
	config.setString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, "anotherProperty", "Hello");
	
	config.save();
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:12,代码来源:RepositoryModelTest.java

示例11: teardownConfiguration

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
@After
public void teardownConfiguration() throws Exception {
	Repository r = GitBlitSuite.getHelloworldRepository();
	StoredConfig config = r.getConfig();
	
	config.unsetSection(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS);
	config.save();
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:9,代码来源:RepositoryModelTest.java

示例12: removeRemote

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
public void removeRemote(String remote) throws IOException {
    try {
        StoredConfig config = getStoredConfig();
        Set<String> remoteNames = config.getSubsections("remote");
        if (!remoteNames.contains(remote)) {
            throw new IOException(String.format("Remote %s does not exist.", remote));
        }
        config.unsetSection("remote", remote);
        config.save();
        mRemotes.remove(remote);
    } catch (StopTaskException e) {
    }
}
 
开发者ID:sheimi,项目名称:SGit,代码行数:14,代码来源:Repo.java

示例13: updateConfiguration

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
/**
 * Updates the Gitblit configuration for the specified repository.
 * 
 * @param r
 *            the Git repository
 * @param repository
 *            the Gitblit repository model
 */
public void updateConfiguration(Repository r, RepositoryModel repository) {
	StoredConfig config = r.getConfig();
	config.setString(Constants.CONFIG_GITBLIT, null, "description", repository.description);
	config.setString(Constants.CONFIG_GITBLIT, null, "owner", ArrayUtils.toString(repository.owners));
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useTickets", repository.useTickets);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useDocs", repository.useDocs);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useIncrementalPushTags", repository.useIncrementalPushTags);
	if (StringUtils.isEmpty(repository.incrementalPushTagPrefix) ||
			repository.incrementalPushTagPrefix.equals(settings.getString(Keys.git.defaultIncrementalPushTagPrefix, "r"))) {
		config.unset(Constants.CONFIG_GITBLIT, null, "incrementalPushTagPrefix");
	} else {
		config.setString(Constants.CONFIG_GITBLIT, null, "incrementalPushTagPrefix", repository.incrementalPushTagPrefix);
	}
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "allowForks", repository.allowForks);
	config.setString(Constants.CONFIG_GITBLIT, null, "accessRestriction", repository.accessRestriction.name());
	config.setString(Constants.CONFIG_GITBLIT, null, "authorizationControl", repository.authorizationControl.name());
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "verifyCommitter", repository.verifyCommitter);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "showRemoteBranches", repository.showRemoteBranches);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFrozen", repository.isFrozen);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "showReadme", repository.showReadme);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSizeCalculation", repository.skipSizeCalculation);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSummaryMetrics", repository.skipSummaryMetrics);
	config.setString(Constants.CONFIG_GITBLIT, null, "federationStrategy",
			repository.federationStrategy.name());
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFederated", repository.isFederated);
	config.setString(Constants.CONFIG_GITBLIT, null, "gcThreshold", repository.gcThreshold);
	if (repository.gcPeriod == settings.getInteger(Keys.git.defaultGarbageCollectionPeriod, 7)) {
		// use default from config
		config.unset(Constants.CONFIG_GITBLIT, null, "gcPeriod");
	} else {
		config.setInt(Constants.CONFIG_GITBLIT, null, "gcPeriod", repository.gcPeriod);
	}
	if (repository.lastGC != null) {
		config.setString(Constants.CONFIG_GITBLIT, null, "lastGC", new SimpleDateFormat(Constants.ISO8601).format(repository.lastGC));
	}
	if (repository.maxActivityCommits == settings.getInteger(Keys.web.maxActivityCommits, 0)) {
		// use default from config
		config.unset(Constants.CONFIG_GITBLIT, null, "maxActivityCommits");
	} else {
		config.setInt(Constants.CONFIG_GITBLIT, null, "maxActivityCommits", repository.maxActivityCommits);
	}

	updateList(config, "federationSets", repository.federationSets);
	updateList(config, "preReceiveScript", repository.preReceiveScripts);
	updateList(config, "postReceiveScript", repository.postReceiveScripts);
	updateList(config, "mailingList", repository.mailingLists);
	updateList(config, "indexBranch", repository.indexedBranches);
	updateList(config, "metricAuthorExclusions", repository.metricAuthorExclusions);
	
	// User Defined Properties
	if (repository.customFields != null) {
		if (repository.customFields.size() == 0) {
			// clear section
			config.unsetSection(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS);
		} else {
			for (Entry<String, String> property : repository.customFields.entrySet()) {
				// set field
				String key = property.getKey();
				String value = property.getValue();
				config.setString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, key, value);
			}
		}
	}

	try {
		config.save();
	} catch (IOException e) {
		logger.error("Failed to save repository config!", e);
	}
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:79,代码来源:GitBlit.java

示例14: updateConfiguration

import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
/**
 * Updates the Gitblit configuration for the specified repository.
 * 
 * @param r
 *            the Git repository
 * @param repository
 *            the Gitblit repository model
 */
public void updateConfiguration(Repository r, RepositoryModel repository) {
	StoredConfig config = r.getConfig();
	config.setString(Constants.CONFIG_GITBLIT, null, "description", repository.description);
	config.setString(Constants.CONFIG_GITBLIT, null, "owner", ArrayUtils.toString(repository.owners));
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useTickets", repository.useTickets);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useDocs", repository.useDocs);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "useIncrementalPushTags", repository.useIncrementalPushTags);
	if (StringUtils.isEmpty(repository.incrementalPushTagPrefix) ||
			repository.incrementalPushTagPrefix.equals(settings.getString(Keys.git.defaultIncrementalPushTagPrefix, "r"))) {
		config.unset(Constants.CONFIG_GITBLIT, null, "incrementalPushTagPrefix");
	} else {
		config.setString(Constants.CONFIG_GITBLIT, null, "incrementalPushTagPrefix", repository.incrementalPushTagPrefix);
	}
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "allowForks", repository.allowForks);
	config.setString(Constants.CONFIG_GITBLIT, null, "accessRestriction", repository.accessRestriction.name());
	config.setString(Constants.CONFIG_GITBLIT, null, "authorizationControl", repository.authorizationControl.name());
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "verifyCommitter", repository.verifyCommitter);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "showRemoteBranches", repository.showRemoteBranches);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFrozen", repository.isFrozen);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "showReadme", repository.showReadme);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSizeCalculation", repository.skipSizeCalculation);
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "skipSummaryMetrics", repository.skipSummaryMetrics);
	config.setString(Constants.CONFIG_GITBLIT, null, "federationStrategy",
			repository.federationStrategy.name());
	config.setBoolean(Constants.CONFIG_GITBLIT, null, "isFederated", repository.isFederated);
	config.setString(Constants.CONFIG_GITBLIT, null, "gcThreshold", repository.gcThreshold);
	if (repository.gcPeriod == settings.getInteger(Keys.git.defaultGarbageCollectionPeriod, 7)) {
		// use default from config
		config.unset(Constants.CONFIG_GITBLIT, null, "gcPeriod");
	} else {
		config.setInt(Constants.CONFIG_GITBLIT, null, "gcPeriod", repository.gcPeriod);
	}
	if (repository.lastGC != null) {
		config.setString(Constants.CONFIG_GITBLIT, null, "lastGC", new SimpleDateFormat(Constants.ISO8601).format(repository.lastGC));
	}
	if (repository.maxActivityCommits == settings.getInteger(Keys.web.maxActivityCommits, 0)) {
		// use default from config
		config.unset(Constants.CONFIG_GITBLIT, null, "maxActivityCommits");
	} else {
		config.setInt(Constants.CONFIG_GITBLIT, null, "maxActivityCommits", repository.maxActivityCommits);
	}

	updateList(config, "federationSets", repository.federationSets);
	updateList(config, "preReceiveScript", repository.preReceiveScripts);
	updateList(config, "postReceiveScript", repository.postReceiveScripts);
	updateList(config, "mailingList", repository.mailingLists);
	updateList(config, "indexBranch", repository.indexedBranches);
	
	// User Defined Properties
	if (repository.customFields != null) {
		if (repository.customFields.size() == 0) {
			// clear section
			config.unsetSection(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS);
		} else {
			for (Entry<String, String> property : repository.customFields.entrySet()) {
				// set field
				String key = property.getKey();
				String value = property.getValue();
				config.setString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, key, value);
			}
		}
	}

	try {
		config.save();
	} catch (IOException e) {
		logger.error("Failed to save repository config!", e);
	}
}
 
开发者ID:BullShark,项目名称:IRCBlit,代码行数:78,代码来源:GitBlit.java


注:本文中的org.eclipse.jgit.lib.StoredConfig.unsetSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。