/** * Returns a diff generator to be used in <code>doGetDiff()</code> methods of this class. * If no generator was provided by a caller, <b>SVNLookClient</b> uses a default one * that prints differences in a GNU-style. * * @return a diff generator * @see #setDiffGenerator(ISVNGNUDiffGenerator) */ public ISVNGNUDiffGenerator getDiffGenerator() { if (myDiffGenerator == null) { DefaultSVNGNUDiffGenerator defaultDiffGenerator = new DefaultSVNGNUDiffGenerator(); defaultDiffGenerator.setOptions(getOptions()); myDiffGenerator = defaultDiffGenerator; } return myDiffGenerator; }
@Override protected SVNLogEntry run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); SVNLogEntry entry; if (getOperation().getTransactionName() == null) entry = lc.doGetInfo(getOperation().getRepositoryRoot(), getOperation().getRevision()); else entry = lc.doGetInfo(getOperation().getRepositoryRoot(), getOperation().getTransactionName()); return entry; } }
private void getTree(FSFS fsfs, FSRoot root, String path, SVNNodeKind kind, FSID id, boolean includeIDs, int depth, boolean recursive, ISVNTreeHandler handler) throws SVNException { checkCancelled(); if (handler != null) { handler.handlePath(new SVNAdminPath(path, includeIDs ? id.toString() : null, depth, kind == SVNNodeKind.DIR)); } if (kind != SVNNodeKind.DIR) { return; } if (recursive || depth == 0) { FSRevisionNode node = root.getRevisionNode(path); Map entries = node.getDirEntries(fsfs); for (Iterator names = entries.keySet().iterator(); names.hasNext();) { String name = (String) names.next(); FSEntry entry = (FSEntry) entries.get(name); getTree(fsfs, root, SVNPathUtil.getAbsolutePath(SVNPathUtil.append(path, entry.getName())), entry.getType(), includeIDs ? entry.getId() : null, includeIDs, depth + 1, recursive, handler); } } }
/** * Returns an instance of the {@link org.tmatesoft.svn.core.wc.admin.SVNLookClient} class. * * <p> * If it's the first time this method is being called the object is * created, initialized and then returned. Further calls to this * method will get the same object instantiated at that moment of * the first call. <b>SVNClientManager</b> does not reinstantiate * its <b>SVN</b>*<b>Client</b> objects. * * @return an <b>SVNLookClient</b> instance */ public SVNLookClient getLookClient() { if (myLookClient == null) { myLookClient = new SVNLookClient(this, myOptions); myLookClient.setEventHandler(myEventHandler); myLookClient.setDebugLog(getDebugLog()); myLookClient.setIgnoreExternals(myIsIgnoreExternals); } return myLookClient; }
@Override protected Long run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); return lc.doGetYoungestRevision(getOperation().getRepositoryRoot()); } }
@Override protected String run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); return lc.doGetUUID(getOperation().getRepositoryRoot()); } }
if (environment.isRevision()) { if (environment.isRevProp()) { props = client.doGetRevisionProperties(environment.getRepositoryFile(), getRevisionObject()); } else { props = client.doGetProperties(environment.getRepositoryFile(), environment.getFirstArgument(), getRevisionObject()); props = client.doGetRevisionProperties(environment.getRepositoryFile(), environment.getTransaction()); } else { props = client.doGetProperties(environment.getRepositoryFile(), environment.getFirstArgument(), environment.getTransaction()); String propName = (String) propNamesIter.next(); SVNPropertyData propData = new SVNPropertyData(propName, props.getSVNPropertyValue(propName), client.getOptions()); SVNPropertyValue propValue = propData.getValue(); if (environment.isVerbose()) {
public void run() throws SVNException { SVNLookCommandEnvironment environment = getSVNLookEnvironment(); SVNLookClient client = environment.getClientManager().getLookClient(); DefaultSVNGNUDiffGenerator defaultDiffGenerator = new DefaultSVNGNUDiffGenerator(); defaultDiffGenerator.setOptions(client.getOptions()); defaultDiffGenerator.setDiffOptions(environment.getDiffOptions()); client.setDiffGenerator(defaultDiffGenerator); if (environment.isRevision()) { client.doGetDiff(environment.getRepositoryFile(), getRevisionObject(), !environment.isNoDiffDeleted(), !environment.isNoDiffAdded(), environment.isDiffCopyFrom(), environment.getOut()); } else { client.doGetDiff(environment.getRepositoryFile(), environment.getTransaction(), !environment.isNoDiffDeleted(), !environment.isNoDiffAdded(), environment.isDiffCopyFrom(), environment.getOut()); } }
@Override protected Long run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); lc.doCat(getOperation().getRepositoryRoot(), getOperation().getPath(), getOperation().getTransactionName(), getOperation().getOutputStream()); return 1l; } }
@Override protected SVNChangeEntry run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); if (getOperation().getTransactionName() == null) lc.doGetChanged(getOperation().getRepositoryRoot(), getOperation().getRevision(), this, getOperation().isIncludeCopyInfo()); else lc.doGetChanged(getOperation().getRepositoryRoot(), getOperation().getTransactionName(), this, getOperation().isIncludeCopyInfo()); return getOperation().first(); }
@Override protected SVNLock run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); return lc.doGetLock(getOperation().getRepositoryRoot(), getOperation().getPath()); } }
@Override protected SVNProperties run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); SVNProperties props; if (getOperation().getTransactionName() == null) props = lc.doGetRevisionProperties(getOperation().getRepositoryRoot(), getOperation().getRevision()); else props = lc.doGetRevisionProperties(getOperation().getRepositoryRoot(), getOperation().getTransactionName()); return props; } }
@Override protected String run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); if (getOperation().getTransactionName() == null) lc.doGetChangedDirectories(getOperation().getRepositoryRoot(), getOperation().getRevision(), this); else lc.doGetChangedDirectories(getOperation().getRepositoryRoot(), getOperation().getTransactionName(), this); return getOperation().first(); }
@Override protected SVNProperties run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); SVNProperties props; if (getOperation().getTransactionName() == null) props = lc.doGetProperties(getOperation().getRepositoryRoot(), getOperation().getPath(), getOperation().getRevision()); else props = lc.doGetProperties(getOperation().getRepositoryRoot(), getOperation().getPath(), getOperation().getTransactionName()); return props; } }
private void catFile(FSRoot root, String path, OutputStream out) throws SVNException { SVNNodeKind kind = verifyPath(root, path); if (kind != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Path ''{0}'' is not a file", path); SVNErrorManager.error(err, SVNLogType.FSFS); } if (out != null) { InputStream contents = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); byte[] buffer = new byte[SVNFileUtil.STREAM_CHUNK_SIZE]; int len = 0; do { checkCancelled(); len = SVNFileUtil.readIntoBuffer(contents, buffer, 0, buffer.length); out.write(buffer, 0, len); } while (len == SVNFileUtil.STREAM_CHUNK_SIZE); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(contents); } } }
@Override protected SVNPropertyValue run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); SVNPropertyValue propvalue; if (getOperation().getTransactionName() == null) propvalue = lc.doGetRevisionProperty(getOperation().getRepositoryRoot(), getOperation().getPropName(), getOperation().getRevision()); else propvalue = lc.doGetRevisionProperty(getOperation().getRepositoryRoot(), getOperation().getPropName(), getOperation().getTransactionName()); return propvalue; } }
@Override protected Long run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(getOperation().getEventHandler()); long fileSize; if (getOperation().getTransactionName() == null) { fileSize = lc.doGetFileSize(getOperation().getRepositoryRoot(), getOperation().getPath(), getOperation().getRevision()); } else { fileSize = lc.doGetFileSize(getOperation().getRepositoryRoot(), getOperation().getPath(), getOperation().getTransactionName()); } return fileSize; } }
@Override protected SVNPropertyValue run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); SVNPropertyValue propvalue; if (getOperation().getTransactionName() == null) propvalue = lc.doGetProperty(getOperation().getRepositoryRoot(), getOperation().getPropName(), getOperation().getPath(), getOperation().getRevision()); else propvalue = lc.doGetProperty(getOperation().getRepositoryRoot(), getOperation().getPropName(), getOperation().getPath(), getOperation().getTransactionName()); return propvalue; } }
@Override protected SVNAdminPath run() throws SVNException { SVNLookClient lc = new SVNLookClient(getOperation().getAuthenticationManager(), getOperation().getOptions()); lc.setEventHandler(this); lc.doGetHistory( getOperation().getRepositoryRoot(), getOperation().getPath(), getOperation().getRevision(), getOperation().isIncludeIDs(), getOperation().getLimit(), this); return getOperation().first(); }