protected ISVNOptions getOptions(){ if (myOptions == null){ myOptions = new DefaultSVNOptions(); } return myOptions; }
/** * Creates the subversion custom authentication manager. * * @param userName the user name. * @param password the password. * @param connectionTimeout the connection timeout. * @param readTimeout the read timeout. * @return the subversion custom authentication manager. */ public static SvnCustomAuthenticationManager create(String userName, char[] password, Integer connectionTimeout, Integer readTimeout) { DefaultSVNOptions options = new DefaultSVNOptions(null, true); boolean store = options.isAuthStorageEnabled(); return new SvnCustomAuthenticationManager(store, userName, password, connectionTimeout, readTimeout); }
public static boolean matches(String pattern, String fileName) { if (pattern == null || fileName == null) { return false; } Pattern compiled = compileNamePatter(pattern); if (compiled != null) { return compiled.matcher(fileName).matches(); } return false; }
public boolean isIgnored(String name) { String[] patterns = getIgnorePatterns(); for (int i = 0; patterns != null && i < patterns.length; i++) { String pattern = patterns[i]; if (matches(pattern, name)) { return true; } } return false; }
public boolean isUseCommitTimes() { String value = getConfigFile().getPropertyValue(MISCELLANY_GROUP, USE_COMMIT_TIMES); return getBooleanValue(value, false); }
public void addIgnorePattern(String pattern) { if (pattern == null) { return; } String[] patterns = getIgnorePatterns(); Collection oldPatterns = new ArrayList(Arrays.asList(patterns)); if (!oldPatterns.contains(pattern)) { oldPatterns.add(pattern); patterns = (String[]) oldPatterns.toArray(new String[oldPatterns.size()]); setIgnorePatterns(patterns); } }
protected DefaultSVNOptions createClientOptions() throws SVNException { File configDir = myConfigDir != null ? new File(myConfigDir) : SVNWCUtil.getDefaultConfigurationDirectory(); DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(configDir, true); options.setAuthStorageEnabled(!myIsNoAuthCache); if (myIsAutoProps) { options.setUseAutoProperties(true); options.setUseAutoProperties(false); options.setKeepLocks(true); if ((myResolveAccept == SVNConflictAcceptPolicy.UNSPECIFIED && (!options.isInteractiveConflictResolution() || myIsNonInteractive)) || myResolveAccept == SVNConflictAcceptPolicy.POSTPONE) { options.setConflictHandler(null); } else { if (myIsNonInteractive) { options.setConflictHandler(new SVNCommandLineConflictHandler(myResolveAccept, this)); options.setInMemoryConfigOptions(myConfigOptions); return options;
public Map applyAutoProperties(File file, Map target) { String fileName = file.getName(); target = target == null ? new HashMap() : target; if (!isUseAutoProperties()) { return target; Map autoProperties = getAutoProperties(); for (Iterator names = autoProperties.keySet().iterator(); names.hasNext();) { String pattern = (String) names.next(); String value = (String) autoProperties.get(pattern); if (value != null && !"".equals(value) && matches(pattern, fileName)) { for (StringTokenizer tokens = new StringTokenizer(value, ";"); tokens.hasMoreTokens();) { String token = tokens.nextToken().trim();
private void updateClientManager() { File configDir = myConfigDir == null ? null : new File(myConfigDir); myOptions = SVNWCUtil.createDefaultOptions(configDir, true); myOptions.setConflictHandler(getConflictHandler()); myAuthenticationManager = SVNWCUtil.createDefaultAuthenticationManager(configDir, myUserName, myPassword, myOptions.isAuthStorageEnabled()); if (myPrompt != null) { myAuthenticationManager.setAuthenticationProvider(new JavaHLAuthenticationProvider(myPrompt)); } else { myAuthenticationManager.setAuthenticationProvider(null); } if (myAuthenticationManager instanceof DefaultSVNAuthenticationManager) { ((DefaultSVNAuthenticationManager)myAuthenticationManager).setRuntimeStorage(getClientCredentialsStorage()); } if (myClientManager != null) { myClientManager.dispose(); myClientManager.setAuthenticationManager(myAuthenticationManager); myClientManager.setOptions(myOptions); } }
public SVNAuthenticationManager(File configDir, String userName, String password) { super(configDir, SVNWCUtil.createDefaultOptions(configDir, true).isAuthStorageEnabled(), userName, password); }
/** * Gives the name of the person who made the last commit * @param address the repository's address * @param login the username to use to connect to the repository * @param password the password to use to connect to the repository * @return the name of the person who made the last commit * @throws SVNException if there is a problem while accessing the repository */ public String getHeadcommiter(String address, String login, String password) throws SVNException { ISVNAuthenticationManager svnAuthManager = SVNWCUtil.createDefaultAuthenticationManager(login, password); DefaultSVNOptions svnOptions = new DefaultSVNOptions(); svnOptions.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF); SVNWCClient wcClient = new SVNWCClient(svnAuthManager, svnOptions); SVNInfo info = wcClient.doInfo(SVNURL.parseURIEncoded(address), SVNRevision.HEAD, SVNRevision.HEAD); String headAuthor = info.getAuthor(); return headAuthor; }
public void setAutoProperties(Map autoProperties) { autoProperties = autoProperties == null ? Collections.EMPTY_MAP : autoProperties; Map existingProperties = getAutoProperties(); for (Iterator names = existingProperties.keySet().iterator(); names.hasNext();) { String pattern = (String) names.next(); String value = (String) existingProperties.get(pattern); if (value.equals(autoProperties.get(pattern))) { continue; } getConfigFile().setPropertyValue(AUTOPROPS_GROUP, pattern, null, false); names.remove(); } // add all new for (Iterator names = autoProperties.keySet().iterator(); names.hasNext();) { String pattern = (String) names.next(); String value = (String) autoProperties.get(pattern); if (value.equals(existingProperties.get(pattern))) { continue; } getConfigFile().setPropertyValue(AUTOPROPS_GROUP, pattern, value, false); } if (!myIsReadonly) { getConfigFile().save(); } }
/** * Returns autoproperties as a {@link java.util.Map} * where each key is a file name pattern and the corresponding * value is a string in the form of <code>"propName=propValue"</code>. * * @return a {@link java.util.Map} containing autoproperties */ public Map getAutoProperties() { return getConfigFile().getProperties(AUTOPROPS_GROUP); }
private void updateSvnOperationsFactory() { //TODO: use tunnelAgent File configDir = this.configDir == null ? null : new File(this.configDir); options = SVNWCUtil.createDefaultOptions(configDir, true); options.setConflictHandler(conflictHandler); options.setConfigEventHandler(getConfigEventHandler(configHandler)); authenticationManager = SVNWCUtil.createDefaultAuthenticationManager(configDir, username, password, options.isAuthStorageEnabled()); if (prompt != null) { authenticationManager.setAuthenticationProvider(new JavaHLAuthenticationProvider(prompt)); } else { authenticationManager.setAuthenticationProvider(null); } if (authenticationManager instanceof DefaultSVNAuthenticationManager) { ((DefaultSVNAuthenticationManager) authenticationManager).setRuntimeStorage(getClientCredentialsStorage()); } if (svnOperationFactory != null) { svnOperationFactory.setAuthenticationManager(authenticationManager); svnOperationFactory.setOptions(options); svnOperationFactory.setEventHandler(getEventHandler()); } }
public ISVNOptions getOptions() { if (options == null) { File configDir = this.configDir == null ? null : new File(this.configDir); options = SVNWCUtil.createDefaultOptions(configDir, true); options.setConflictHandler(getConflictHandler()); } return options; }
public DefaultSVNOptions(File directory, boolean readOnly) { myConfigDirectory = directory == null ? getDefaultConfigDir() : directory; myIsReadonly = readOnly; }
final ISVNConflictHandler[] conflictHandler = new ISVNConflictHandler[1]; if (opts instanceof DefaultSVNOptions) { conflictHandler[0] = ((DefaultSVNOptions) opts).getConflictResolver(); ((DefaultSVNOptions) opts).setConflictHandler(new ISVNConflictHandler() { public SVNConflictResult handleConflict(SVNConflictDescription conflictDescription) throws SVNException { SVNConflictResult result = conflictHandler[0] == null ? ((DefaultSVNOptions) opts).setConflictHandler(conflictHandler[0]);
if (config != null) { String optionValue = config.getPropertyValue(REP_SHARING_SECTION, ENABLE_REP_SHARING_OPTION); isRepSharingAllowed = DefaultSVNOptions.getBooleanValue(optionValue, true);
public boolean isUseCommitTimes() { String value = getConfigFile().getPropertyValue(MISCELLANY_GROUP, USE_COMMIT_TIMES); return getBooleanValue(value, true); }
protected DefaultSVNOptions createClientOptions() throws SVNException { File configDir = myConfigDir != null ? new File(myConfigDir) : SVNWCUtil.getDefaultConfigurationDirectory(); DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(configDir, true); options.setAuthStorageEnabled(!myIsNoAuthCache); if (myIsAutoProps) { options.setUseAutoProperties(true); options.setUseAutoProperties(false); options.setKeepLocks(true); if ((myResolveAccept == SVNConflictAcceptPolicy.UNSPECIFIED && (!options.isInteractiveConflictResolution() || myIsNonInteractive)) || myResolveAccept == SVNConflictAcceptPolicy.POSTPONE) { options.setConflictHandler(null); } else { if (myIsNonInteractive) { options.setConflictHandler(new SVNCommandLineConflictHandler(myResolveAccept, this)); options.setInMemoryConfigOptions(myConfigOptions); return options;