/** * Calls <code>getResolvedPegRevision</code> with {@link org.tmatesoft.svn.core.wc.SVNRevision#HEAD}, * {@link org.tmatesoft.svn.core.wc.SVNRevision#WORKING} as default values * @return peg revision of the target * @see #getResolvedPegRevision(SVNRevision, SVNRevision) */ public SVNRevision getResolvedPegRevision() { return getResolvedPegRevision(SVNRevision.HEAD, SVNRevision.WORKING); }
/** * Determines whether target is located in the local working copy and its peg revision is working copy specific. * @return <code>true</code> if the target and its peg revision refers to local working copy, otherwise <code>false</code> */ public boolean isLocal() { return isFile() && getResolvedPegRevision().isLocal(); }
private SvnCopySource(SvnTarget source, SVNRevision revision) { setSource(source); if (revision == null || !revision.isValid()) { revision = source.getResolvedPegRevision(); } setRevision(revision); }
/** * Adds the revision range to collection of revision ranges for merging. * @param range revision range for merge * @see #getRevisionRanges() */ public void addRevisionRange(SvnRevisionRange range) { if (ranges == null) { ranges = new ArrayList<SvnRevisionRange>(); } SVNRevision start = range.getStart(); SVNRevision end = range.getEnd(); if (start == SVNRevision.UNDEFINED && end == SVNRevision.UNDEFINED) { start = SVNRevision.create(0); end = getSource().getResolvedPegRevision(); range = SvnRevisionRange.create(start, end); } ranges.add(range); }
protected Collection<SvnCopySource> expandCopySources(Collection<SvnCopySource> sources) throws SVNException { Collection<SvnCopySource> expanded = new ArrayList<SvnCopySource>(sources.size()); for (SvnCopySource source : sources) { if (source.isCopyContents() && source.getSource().isURL()) { // get children at revision. SVNRevision pegRevision = source.getSource().getResolvedPegRevision(); if (!pegRevision.isValid()) { pegRevision = SVNRevision.HEAD; } SVNRevision startRevision = source.getRevision(); if (!startRevision.isValid()) { startRevision = pegRevision; } final SVNRepository svnRepository = getRepositoryAccess().createRepository(source.getSource().getURL(), null, true); final Structure<LocationsInfo> locations = getRepositoryAccess().getLocations(svnRepository, source.getSource(), pegRevision, startRevision, SVNRevision.UNDEFINED); long revision = locations.lng(LocationsInfo.startRevision); Collection<SVNDirEntry> entries = new ArrayList<SVNDirEntry>(); svnRepository.getDir("", revision, null, 0, entries); for (Iterator<SVNDirEntry> ents = entries.iterator(); ents.hasNext();) { SVNDirEntry entry = (SVNDirEntry) ents.next(); // add new copy source. expanded.add(SvnCopySource.create(SvnTarget.fromURL(entry.getURL()), source.getRevision())); } } else { expanded.add(source); } } return expanded; }
public static SVNCopySource copySource(SvnCopySource newSource) { if (newSource.getSource().getURL() != null) { final SVNCopySource copySource = new SVNCopySource(newSource.getSource().getResolvedPegRevision(), newSource.getRevision(), newSource.getSource().getURL()); copySource.setCopyContents(newSource.isCopyContents()); return copySource; } final SVNCopySource copySource = new SVNCopySource(newSource.getSource().getResolvedPegRevision(), newSource.getRevision(), newSource.getSource().getFile()); copySource.setCopyContents(newSource.isCopyContents()); return copySource; }
private boolean areAllSourcesRemote(SvnCopy operation) { for(SvnCopySource source : operation.getSources()) { if (source.getSource().isFile()) { if (operation.isMove()) { return false; } if (isLocalRevision(source.getRevision()) && isLocalRevision(source.getSource().getResolvedPegRevision())) { return false; } } } return true; }
private boolean areAllSourcesLocal(SvnCopy operation) { for(SvnCopySource source : operation.getSources()) { if (source.getSource().isFile()) { if (operation.isMove()) { continue; } if (isLocalRevision(source.getRevision()) && isLocalRevision(source.getSource().getResolvedPegRevision())) { continue; } } return false; } return true; }
@Override protected void ensureArgumentsAreValid() throws SVNException { if (getDepth() == SVNDepth.UNKNOWN) { setDepth(SVNDepth.EMPTY); } if (getRevision() == null || !getRevision().isValid()) { if (getFirstTarget() != null) { setRevision(getFirstTarget().getResolvedPegRevision()); } } super.ensureArgumentsAreValid(); }
@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()); }
@Override protected SvnDiffStatus run(SVNWCContext context) throws SVNException { final SvnTarget source = getOperation().getSource(); final SvnTarget firstSource = getOperation().getFirstSource(); final SvnTarget secondSource = getOperation().getSecondSource(); final ISVNDiffStatusHandler handler = createHandlerForReceiver(getOperation()); final SVNDepth depth = getOperation().getDepth(); final boolean useAncestry = !getOperation().isIgnoreAncestry(); if (source != null) { doDiff(source, getOperation().getStartRevision(), source, getOperation().getEndRevision(), source.getPegRevision(), depth, useAncestry, getOperation().isRecurseIntoDeletedDirectories(), handler); } else { doDiff(firstSource, firstSource.getResolvedPegRevision(), secondSource, secondSource.getResolvedPegRevision(), SVNRevision.UNDEFINED, depth, useAncestry, getOperation().isRecurseIntoDeletedDirectories(), handler); } return null; }
@Override protected Long run(SVNWCContext context) throws SVNException { SvnTarget source = getOperation().getSource(); int targetWorkingCopyFormat = getOperation().getTargetWorkingCopyFormat(); return checkout(source.getURL(), getFirstTarget(), source.getResolvedPegRevision(), getOperation().getRevision(), getOperation().getDepth(), getOperation().isIgnoreExternals(), getOperation().isAllowUnversionedObstructions(), getOperation().isSleepForTimestamp(), targetWorkingCopyFormat < 0 ? ISVNWCDb.WC_FORMAT_18 : targetWorkingCopyFormat); }
protected SVNDirEntry run() throws SVNException { SvnTarget infoTarget = getOperation().getFirstTarget(); Structure<RepositoryInfo> repositoryInfo = getRepositoryAccess().createRepositoryFor(infoTarget, getOperation().getRevision(), infoTarget.getResolvedPegRevision(), null); SVNRepository repository = repositoryInfo.<SVNRepository>get(RepositoryInfo.repository); long revNum = repositoryInfo.lng(RepositoryInfo.revision); repositoryInfo.release(); doList(repository, revNum, this, getOperation().isFetchLocks(), getOperation().getDepth(), getOperation().getEntryFields(), null, null); return getOperation().first(); }
@Override protected void ensureArgumentsAreValid() throws SVNException { if (getFirstTarget() == null || !getFirstTarget().isLocal()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "Destination path is required for export."); SVNErrorManager.error(err, SVNLogType.WC); } if (getSource() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "Source is required for export."); SVNErrorManager.error(err, SVNLogType.WC); } if (getDepth() == null || getDepth() == SVNDepth.UNKNOWN) { setDepth(SVNDepth.INFINITY); } if (getRevision() == SVNRevision.UNDEFINED) { setRevision(getSource().getResolvedPegRevision()); } super.ensureArgumentsAreValid(); }
public SvnCopySource createRemoteCopySource(SVNWCContext context, SvnCopySource localCopySource) throws SVNException { Structure<NodeOriginInfo> origin = context.getNodeOrigin(localCopySource.getSource().getFile(), true, NodeOriginInfo.reposRelpath, NodeOriginInfo.reposRootUrl, NodeOriginInfo.revision); SVNURL url = origin.get(NodeOriginInfo.reposRootUrl); url = url.appendPath(SVNFileUtil.getFilePath(origin.<File>get(NodeOriginInfo.reposRelpath)), false); SVNRevision pegRevision = localCopySource.getSource().getResolvedPegRevision(); SVNRevision revision = localCopySource.getRevision(); if (pegRevision == SVNRevision.UNDEFINED || pegRevision == SVNRevision.WORKING || pegRevision == SVNRevision.BASE) { pegRevision = SVNRevision.create(origin.lng(NodeOriginInfo.revision)); } if (revision == SVNRevision.BASE) { revision = SVNRevision.create(origin.lng(NodeOriginInfo.revision)); } origin.release(); localCopySource = SvnCopySource.create(SvnTarget.fromURL(url, pegRevision), revision); return localCopySource; }
@Override protected Long run(SVNWCContext context) throws SVNException { SvnTarget switchTarget = getOperation().getSwitchTarget(); return doSwitch(getFirstTarget(), switchTarget.getURL(), getOperation().getRevision(), switchTarget.getResolvedPegRevision(), getOperation().getDepth(), getOperation().isDepthIsSticky(), getOperation().isIgnoreExternals(), getOperation().isAllowUnversionedObstructions(), getOperation().isIgnoreAncestry(), getOperation().isSleepForTimestamp()); }
@Override protected SvnInfo run() throws SVNException { SVNWCClient16 client = new SVNWCClient16(getOperation().getRepositoryPool(), getOperation().getOptions()); client.setEventHandler(getOperation().getEventHandler()); client.doInfo(getFirstTarget(), getOperation().getFirstTarget().getResolvedPegRevision(), getOperation().getRevision(), getOperation().getDepth(), getOperation().getApplicableChangelists(), this); return getOperation().first(); }
@Override protected SVNProperties run() throws SVNException { SVNWCClient16 client = new SVNWCClient16(getOperation().getRepositoryPool(), getOperation().getOptions()); client.setEventHandler(getOperation().getEventHandler()); client.doGetProperty( getFirstTarget(), null, getOperation().getFirstTarget().getResolvedPegRevision(), getOperation().getRevision(), getOperation().getDepth(), this, getOperation().getApplicableChangelists()); if (currentFile != null && currentProperties != null && !currentProperties.isEmpty()) { getOperation().receive(SvnTarget.fromFile(currentFile), currentProperties); } return getOperation().first(); }
@Override protected Long run() throws SVNException { SVNUpdateClient16 client = new SVNUpdateClient16(getOperation().getRepositoryPool(), getOperation().getOptions()); client.setIgnoreExternals(getOperation().isIgnoreExternals()); client.setUpdateLocksOnDemand(getOperation().isUpdateLocksOnDemand()); client.setEventHandler(getOperation().getEventHandler()); client.setExternalsHandler(SvnCodec.externalsHandler(getOperation().getExternalsHandler())); return client.doSwitch(getFirstTarget(), getOperation().getSwitchTarget().getURL(), getOperation().getSwitchTarget().getResolvedPegRevision(), getOperation().getRevision(), getOperation().getDepth(), getOperation().isAllowUnversionedObstructions(), getOperation().isDepthIsSticky()); } }
@Override protected Long run() throws SVNException { SVNUpdateClient16 client = new SVNUpdateClient16(getOperation().getRepositoryPool(), getOperation().getOptions()); client.setIgnoreExternals(getOperation().isIgnoreExternals()); client.setUpdateLocksOnDemand(getOperation().isUpdateLocksOnDemand()); client.setEventHandler(getOperation().getEventHandler()); client.setExportExpandsKeywords(getOperation().isExpandKeywords()); client.setExternalsHandler(SvnCodec.externalsHandler(getOperation().getExternalsHandler())); return client.doExport( getOperation().getSource().getFile(), getOperation().getFirstTarget().getFile(), getOperation().getSource().getResolvedPegRevision(), getOperation().getRevision(), getOperation().getEolStyle(), getOperation().isForce(), getOperation().getDepth()); } }