List of usage examples for org.eclipse.jgit.lib StoredConfig getString
public String getString(final String section, String subsection, final String name)
From source file:org.eclipse.egit.gitflow.GitFlowConfig.java
License:Open Source License
/** * @param prefixName// w ww.j a va 2 s .c o m * @param defaultPrefix * @return value for key prefixName from .git/config or default */ public String getPrefix(String prefixName, String defaultPrefix) { StoredConfig config = repository.getConfig(); String result = config.getString(GITFLOW_SECTION, PREFIX_SECTION, prefixName); return (result == null) ? defaultPrefix : result; }
From source file:org.eclipse.egit.gitflow.GitFlowConfig.java
License:Open Source License
/** * @param branch/*from w w w . j ava 2 s . c om*/ * @param defaultBranch * @return value for key branch from .git/config or default */ public String getBranch(String branch, String defaultBranch) { StoredConfig config = repository.getConfig(); String result = config.getString(GITFLOW_SECTION, BRANCH_SECTION, branch); return (result == null) ? defaultBranch : result; }
From source file:org.eclipse.egit.gitflow.GitFlowConfig.java
License:Open Source License
/** * @param featureName// ww w .j av a 2 s. com * @return Upstream branch name */ public String getUpstreamBranchName(String featureName) { StoredConfig config = repository.getConfig(); return config.getString(BRANCH_SECTION, getFeatureBranchName(featureName), MERGE_KEY); }
From source file:org.eclipse.egit.gitflow.GitFlowConfig.java
License:Open Source License
/** * @param featureName//from w ww.j a v a2 s .c o m * @return remote tracking branch */ public String getRemoteName(String featureName) { StoredConfig config = repository.getConfig(); return config.getString(BRANCH_SECTION, getFeatureBranchName(featureName), REMOTE_KEY); }
From source file:org.eclipse.egit.gitflow.op.InitOperationTest.java
License:Open Source License
private String getPrefix(Repository repository, String prefixName) { StoredConfig config = repository.getConfig(); return config.getString(GITFLOW_SECTION, PREFIX_SECTION, prefixName); }
From source file:org.eclipse.egit.gitflow.op.InitOperationTest.java
License:Open Source License
private String getBranch(Repository repository, String branch) { StoredConfig config = repository.getConfig(); return config.getString(GITFLOW_SECTION, BRANCH_SECTION, branch); }
From source file:org.eclipse.egit.ui.internal.actions.SynchronizeWorkspaceActionHandler.java
License:Open Source License
private String getDstRef(Repository repo, boolean launchFetch) { if (launchFetch) { String realName = getRealBranchName(repo); String name = BRANCH_NAME_PATTERN.matcher(realName).replaceAll(""); //$NON-NLS-1$ StoredConfig config = repo.getConfig(); String remote = config.getString(CONFIG_BRANCH_SECTION, name, CONFIG_KEY_REMOTE); String merge = config.getString(CONFIG_BRANCH_SECTION, name, CONFIG_KEY_MERGE); if (remote == null || merge == null) return HEAD; String mergeBranchName = merge.replace(R_HEADS, ""); //$NON-NLS-1$ return R_REMOTES + remote + "/" + mergeBranchName; //$NON-NLS-1$ } else/* w w w . java 2 s.c o m*/ return HEAD; }
From source file:org.eclipse.egit.ui.internal.push.PushBranchWizardTest.java
License:Open Source License
private void assertBranchConfig(String branchName, String remoteName, String mergeRef, String rebase) { StoredConfig config = repository.getConfig(); assertEquals(remoteName, config.getString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REMOTE)); assertEquals(mergeRef, config.getString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_MERGE)); assertEquals(rebase, config.getString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REBASE)); }
From source file:org.eclipse.egit.ui.internal.push.PushBranchWizardTest.java
License:Open Source License
private void assertRemoteConfig(String remoteName, URIish remoteUri) { StoredConfig config = repository.getConfig(); assertEquals(remoteUri.toString(), config.getString(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName, ConfigConstants.CONFIG_KEY_URL)); assertEquals("+refs/heads/*:refs/remotes/" + remoteName + "/*", config.getString(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName, "fetch")); }
From source file:org.eclipse.egit.ui.internal.repository.tree.command.DeleteFetchCommand.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { FetchNode node = getSelectedNodes(event).get(0); RemoteNode remote = (RemoteNode) node.getParent(); StoredConfig config = node.getRepository().getConfig(); String fetchUrl = config.getString(REMOTE, remote.getObject(), URL); config.unset(REMOTE, remote.getObject(), FETCH); config.unset(REMOTE, remote.getObject(), URL); // the push URL may still be needed for fetch if (fetchUrl != null) { boolean hasPush = config.getStringList(REMOTE, remote.getObject(), PUSH).length > 0; if (hasPush) { String[] pushurls = config.getStringList(REMOTE, remote.getObject(), PUSHURL); // if there are not specific push urls, // copy the former fetch url into push url if (pushurls.length == 0) config.setString(REMOTE, remote.getObject(), PUSHURL, fetchUrl); }/* ww w . j a va 2 s .com*/ } try { config.save(); } catch (IOException e1) { Activator.handleError(e1.getMessage(), e1, true); } return null; }