private String checkout(SvnOperationFactory svnOperationFactory) throws SVNException { logger.debug("Checking out " + getUri() + " to: " + getWorkingDirectory().getAbsolutePath()); final SvnCheckout checkout = svnOperationFactory.createCheckout(); checkout.setSource(SvnTarget.fromURL(SVNURL.parseURIEncoded(getUri()))); checkout.setSingleTarget(SvnTarget.fromFile(getWorkingDirectory())); Long id = checkout.run(); if (id == null) { return null; } return id.toString(); }
private String update(SvnOperationFactory svnOperationFactory, String label) throws SVNException { logger.debug("Repo already checked out - updating instead."); try { final SvnUpdate update = svnOperationFactory.createUpdate(); update.setSingleTarget(SvnTarget.fromFile(getWorkingDirectory())); long[] ids = update.run(); StringBuilder version = new StringBuilder(); for (long id : ids) { if (version.length() > 0) { version.append(","); } version.append(id); } return version.toString(); } catch (Exception e) { String message = "Could not update remote for " + label + " (current local=" + getWorkingDirectory().getPath() + "), remote: " + this.getUri() + ")"; if (logger.isDebugEnabled()) { logger.debug(message, e); } else if (logger.isWarnEnabled()) { logger.warn(message); } } final SVNStatus status = SVNClientManager.newInstance().getStatusClient() .doStatus(getWorkingDirectory(), false); return status != null ? status.getRevision().toString() : null; }
@Override public synchronized Locations getLocations(String application, String profile, String label) { if (label == null) { label = this.defaultLabel; } SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); if (hasText(getUsername())) { svnOperationFactory .setAuthenticationManager(new DefaultSVNAuthenticationManager(null, false, getUsername(), getPassword())); } try { String version; if (new File(getWorkingDirectory(), ".svn").exists()) { version = update(svnOperationFactory, label); } else { version = checkout(svnOperationFactory); } return new Locations(application, profile, label, version, getPaths(application, profile, label)); } catch (SVNException e) { throw new IllegalStateException("Cannot checkout repository", e); } finally { svnOperationFactory.dispose(); } }
@Override public void initDefaults() { super.initDefaults(); setRevision(SVNRevision.HEAD); setReportAll(true); setReportIgnored(true); setReportExternals(true); setRemoteRevision(SVNWCContext.INVALID_REVNUM); }
@Override public boolean isApplicable(SvnLogMergeInfo operation, SvnWcGeneration wcGeneration) throws SVNException { boolean targetOk = operation.getFirstTarget().isURL() || SvnOperationFactory.detectWcGeneration(operation.getFirstTarget().getFile(), true) == SvnWcGeneration.V17; boolean sourceOk = operation.getSource().isURL() || SvnOperationFactory.detectWcGeneration(operation.getSource().getFile(), true) == SvnWcGeneration.V17; return targetOk && sourceOk; }
@Override public boolean isApplicable(SvnGetMergeInfo operation, SvnWcGeneration wcGeneration) throws SVNException { return operation.getFirstTarget().isURL() || SvnOperationFactory.detectWcGeneration(operation.getFirstTarget().getFile(), true) == SvnWcGeneration.V17; }
@Override public boolean isApplicable(SvnSuggestMergeSources operation, SvnWcGeneration wcGeneration) throws SVNException { return operation.getFirstTarget().isURL() || SvnOperationFactory.detectWcGeneration(operation.getFirstTarget().getFile(), true) == SvnWcGeneration.V17; }
private boolean areAllSourcesRemote(SvnRemoteCopy operation) { for(SvnCopySource source : operation.getSources()) { if (source.getSource().isURL() || (source.getRevision() != SVNRevision.WORKING && source.getRevision() != SVNRevision.UNDEFINED)) { continue; } return false; } return true; }
@Override public void initDefaults() { super.initDefaults(); setFetchActualOnly(true); setFetchExcluded(true); }
@Override protected void initDefaults() { super.initDefaults(); setExpandKeywords(true); setDepth(SVNDepth.INFINITY); }
private boolean areAllSourcesLocal(SvnRemoteCopy operation) { // need all sources to be wc files at WORKING. // BASE revision meas repos_to_repos copy for(SvnCopySource source : operation.getSources()) { if (source.getSource().isFile() && (source.getRevision() == SVNRevision.WORKING || source.getRevision() == SVNRevision.UNDEFINED)) { continue; } return false; } return true; }
@Override protected void ensureArgumentsAreValid() throws SVNException { if (getDepth() == null || getDepth() == SVNDepth.UNKNOWN) { setDepth(SVNDepth.INFINITY); } super.ensureArgumentsAreValid(); }
/** * Gets operation's options, provided by {@link SvnOperationFactory#getOptions()}. * * @return options of the operation */ public ISVNOptions getOptions() { return getOperationFactory().getOptions(); }
/** * Returns <code>String</code> representation of the object * * @return object as <code>String</code> */ @Override public String toString() { return getSource().toString() + " r" + getRevision(); } }
@Override protected void initDefaults() { super.initDefaults(); setDepth(SVNDepth.IMMEDIATES); } }
public boolean isApplicable(SvnList operation, SvnWcGeneration wcGeneration) throws SVNException { if (wcGeneration == SvnWcGeneration.V16 && operation.getFirstTarget().isFile()) { return false; } return true; }
/** * Gets the operation's pool of repositories, provided by {@link SvnOperationFactory#getRepositoryPool()}. * * @return pool of repositories */ public ISVNRepositoryPool getRepositoryPool() { return getOperationFactory().getRepositoryPool(); }
@Override protected void initDefaults() { super.initDefaults(); setRecursive(true); }
@Override protected void initDefaults() { super.initDefaults(); setCombinePackets(true); }