/** * Determines whether target is remote or local, and returns corresponding <code>String</code> representation of the target's path * @return <code>String</code> representation of the target's path * @throws {@link IllegalStateException} if neither file not URL was specified as a target */ public String getPathOrUrlString() { if (isFile()) { return getFile().getPath(); } else if (isURL()) { return getURL().toString(); } throw new IllegalStateException("A target can be either an URL or a path"); }
/** * Determines whether target is remote or local, and returns corresponding <code>String</code> representation of the target's path * @return <code>String</code> representation of the target * @throws {@link IllegalStateException} if neither file not URL was specified as a target's path */ public String getPathOrUrlDecodedString() { if (isFile()) { return getFile().getPath(); } else if (isURL()) { return getURL().toString(); } throw new IllegalStateException("A target can be either an URL or a path"); }
protected SVNURL getURL(SvnTarget target) throws SVNException { if (target.isURL()) { return target.getURL(); } return deriveLocation(target.getFile(), null, null, SVNRevision.UNDEFINED, null, null); }
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; }
protected SVNURL getTargetURL(SvnTarget target) throws SVNException { if (target.isURL()) { return target.getURL(); } return getWCContext().getNodeUrl(target.getFile()); }
@Override public boolean isApplicable(SvnSuggestMergeSources operation, SvnWcGeneration wcGeneration) throws SVNException { return operation.getFirstTarget().isURL() || SvnOperationFactory.detectWcGeneration(operation.getFirstTarget().getFile(), true) == SvnWcGeneration.V17; }
@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; }
public SVNURL resolveUrl(SvnTarget target, SVNRepository repository, SVNRevision pegRevision, SVNRevision revision) throws SVNException { SVNRevision[] resolvedRevisions = resolveRevisions(pegRevision, revision, target.isURL(), true); SVNRevision pegRev = resolvedRevisions[0]; SVNRevision startRev = resolvedRevisions[1]; Structure<LocationsInfo> locationsInfo = getLocations(repository, target, pegRev, startRev, SVNRevision.UNDEFINED); SVNURL url = locationsInfo.<SVNURL>get(LocationsInfo.startUrl); locationsInfo.release(); return url; }
@Override public boolean isApplicable(SvnGetMergeInfo operation, SvnWcGeneration wcGeneration) throws SVNException { return operation.getFirstTarget().isURL() || SvnOperationFactory.detectWcGeneration(operation.getFirstTarget().getFile(), true) == SvnWcGeneration.V17; }
/** * Determines whether target is remote or local, and returns corresponding <code>String</code> * representation of the target's path and peg revision. * * @return <code>String</code> of the target's path and peg revision */ public String toString() { if (isFile()) { return getFile().getAbsolutePath() + '@' + getPegRevision(); } else if (isURL()) { return getURL().toString() + '@' + getPegRevision(); } return "INVALID TARGET"; } }
public SVNPathRevision resolveRevisionAndUrl(SVNRepository svnRepository, SvnTarget svnTarget, SVNRevision pegRevision, SVNRevision revision) throws SVNException { SVNRevision startRevision = revision; SVNRevision[] svnRevisions = resolveRevisions(pegRevision, revision, svnTarget.isURL(), true); pegRevision = svnRevisions[0]; startRevision = svnRevisions[1]; Structure<LocationsInfo> locationsInfoStructure = getLocations(svnRepository, svnTarget, pegRevision, startRevision, SVNRevision.UNDEFINED); SVNURL url = locationsInfoStructure.get(LocationsInfo.startUrl); long rev = locationsInfoStructure.lng(LocationsInfo.startRevision); return SVNPathRevision.createWithRepository(svnRepository, url, rev); }
public void receive(SvnTarget target, SVNProperties props) throws SVNException { for (Object propertyName : props.nameSet()) { final String name = propertyName.toString(); final SVNPropertyData propertyData = new SVNPropertyData(name, props.getSVNPropertyValue(name), getSVNEnvironment().getOptions()); if (target.isURL()) { handleProperty(target.getURL(), propertyData); } else { handleProperty(target.getFile(), propertyData); } } } });
public void receive(SvnTarget target, SVNProperties props) throws SVNException { for (Object propertyName : props.nameSet()) { final String name = propertyName.toString(); final SVNPropertyData propertyData = new SVNPropertyData(name, props.getSVNPropertyValue(name), getSVNEnvironment().getOptions()); if (target.isURL()) { handleProperty(target.getURL(), propertyData); } else { handleProperty(target.getFile(), propertyData); } } } });
public void receive(SvnTarget target, SVNProperties props) throws SVNException { if (!props.containsName(propertyName)) { return; } final SVNPropertyData propertyData = new SVNPropertyData(propertyName, props.getSVNPropertyValue(propertyName), getSVNEnvironment().getOptions()); if (target.isURL()) { handleProperty(target.getURL(), propertyData); } else { handleProperty(target.getFile(), propertyData); } } });
public void receive(SvnTarget target, SVNProperties props) throws SVNException { if (!props.containsName(propertyName)) { return; } final SVNPropertyData propertyData = new SVNPropertyData(propertyName, props.getSVNPropertyValue(propertyName), getSVNEnvironment().getOptions()); if (target.isURL()) { handleProperty(target.getURL(), propertyData); } else { handleProperty(target.getFile(), propertyData); } } });
private void printInhertiedPropertiesXML(SvnTarget target, List<SvnInheritedProperties> propsList) { for (SvnInheritedProperties props : propsList) { final String name; if (props.getTarget().isURL()) { name = props.getTarget().getPathOrUrlString(); } else { name = SVNFileUtil.getFilePath(props.getTarget().getFile()); } StringBuffer buffer = openXMLTag("target", SVNXMLUtil.XML_STYLE_NORMAL, "path", name, null); printXMLPropHash(buffer, props.getProperties(), !getSVNEnvironment().isVerbose(), true); buffer = closeXMLTag("target", buffer); getSVNEnvironment().getOut().print(buffer); } }
private void printInhertiedPropertiesXML(SvnTarget target, List<SvnInheritedProperties> propsList) { for (SvnInheritedProperties props : propsList) { final String name; if (props.getTarget().isURL()) { name = props.getTarget().getPathOrUrlString(); } else { name = SVNFileUtil.getFilePath(props.getTarget().getFile()); } StringBuffer buffer = openXMLTag("target", SVNXMLUtil.XML_STYLE_NORMAL, "path", name, null); printXMLPropHash(buffer, props.getProperties(), !getSVNEnvironment().isVerbose(), true); buffer = closeXMLTag("target", buffer); getSVNEnvironment().getOut().print(buffer); } }
@Override protected Collection<SVNURL> run() throws SVNException { SVNDiffClient16 dc = new SVNDiffClient16(getOperation().getAuthenticationManager(), getOperation().getOptions()); if (getOperation().getFirstTarget().isURL()) { return dc.doSuggestMergeSources(getOperation().getFirstTarget().getURL(), getOperation().getFirstTarget().getPegRevision()); } return dc.doSuggestMergeSources(getOperation().getFirstTarget().getFile(), getOperation().getFirstTarget().getPegRevision()); }
@Override protected Map<SVNURL, SVNMergeRangeList> run() throws SVNException { SVNDiffClient16 dc = new SVNDiffClient16(getOperation().getAuthenticationManager(), getOperation().getOptions()); if (getOperation().getFirstTarget().isURL()) { return dc.doGetMergedMergeInfo(getOperation().getFirstTarget().getURL(), getOperation().getFirstTarget().getResolvedPegRevision()); } return dc.doGetMergedMergeInfo(getOperation().getFirstTarget().getFile(), getOperation().getFirstTarget().getResolvedPegRevision()); }
private Void virtualCopy() throws SVNException { SVNMoveClient16 client = new SVNMoveClient16(getOperation().getRepositoryPool(), getOperation().getOptions()); client.setEventHandler(getOperation().getEventHandler()); client.setOptions(getOperation().getOptions()); final SvnTarget target = getOperation().getFirstTarget(); if (target.isURL()) { throwCannotPerformOnUrl(target, "virtual", getOperation().isMove() ? "move" : "copy"); } final SVNCopySource[] sources = getCopySources(); for (SVNCopySource source : sources) { client.doVirtualCopy(source.getFile(), target.getFile(), getOperation().isMove()); } return null; }