本文整理汇总了Java中org.eclipse.jgit.lib.StoredConfig.unset方法的典型用法代码示例。如果您正苦于以下问题:Java StoredConfig.unset方法的具体用法?Java StoredConfig.unset怎么用?Java StoredConfig.unset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jgit.lib.StoredConfig
的用法示例。
在下文中一共展示了StoredConfig.unset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: 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);
}
}
示例3: updateList
import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
private void updateList(StoredConfig config, String field, List<String> list) {
// a null list is skipped, not cleared
// this is for RPC administration where an older manager might be used
if (list == null) {
return;
}
if (ArrayUtils.isEmpty(list)) {
config.unset(Constants.CONFIG_GITBLIT, null, field);
} else {
config.setStringList(Constants.CONFIG_GITBLIT, null, field, list);
}
}
示例4: pushClonedRepoToOurRepository
import org.eclipse.jgit.lib.StoredConfig; //导入方法依赖的package包/类
private void pushClonedRepoToOurRepository(String repositoryUrl, Git git) throws IOException, InvalidRemoteException {
log.debug("Changing remote to {}", repositoryUrl);
StoredConfig config = git.getRepository().getConfig();
config.setString("remote", "origin", "url", repositoryUrl);
config.unset("remote", "origin", "fetch");
config.save();
git.push().setPushAll().setRemote("origin").call();
log.debug("Push complete");
}
示例5: 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);
}
}
示例6: 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);
}
}