/** * 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; }
protected void displayHeaderFields(OutputStream os, String label1, String label2) throws IOException { os.write("--- ".getBytes(getEncoding())); String originalLabel = null; String newLabel = null; try { originalLabel = generateLabel(myOriginalRoot, myOriginalPath); newLabel = generateLabel(myNewRoot, myNewPath); } catch (SVNException svne) { throw new IOException(svne.getLocalizedMessage()); } os.write(originalLabel.getBytes(getEncoding())); os.write(getEOL()); os.write("+++ ".getBytes(getEncoding())); os.write(newLabel.getBytes(getEncoding())); os.write(getEOL()); }
protected void displayBinary(OutputStream os, String mimeType1, String mimeType2) throws IOException { os.write("(Binary files differ)".getBytes(getEncoding())); os.write(getEOL()); }
if (generator instanceof DefaultSVNGNUDiffGenerator) { defaultGenerator = (DefaultSVNGNUDiffGenerator) generator; defaultGenerator.setHeaderWritten(false); defaultGenerator.setDiffWritten(false); if (defaultGenerator != null) { if (isOriginalEmpty) { defaultGenerator.setOriginalFile(null, path); } else { defaultGenerator.setOriginalFile(baseRoot, basePath); defaultGenerator.setNewFile(root, path); boolean hasDiff = defaultGenerator != null ? defaultGenerator.isDiffWritten() : true; if (!hasDiff && !node.myHasPropModifications && (node.myAction == SVNChangeEntry.TYPE_ADDED && generator.isDiffAdded() || node.myAction == SVNChangeEntry.TYPE_DELETED && generator.isDiffDeleted())) { int kind = node.myAction == SVNChangeEntry.TYPE_ADDED ? ISVNGNUDiffGenerator.ADDED : ISVNGNUDiffGenerator.DELETED; defaultGenerator.setHeaderWritten(false); defaultGenerator.displayHeader(kind, path, null, -1, os); defaultGenerator.printHeader(os);
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()); } }
public void displayFileDiff(String path, File file1, File file2, String rev1, String rev2, String mimeType1, String mimeType2, OutputStream result) throws SVNException { CountingOutputStream counitngStream = new CountingOutputStream(result, 0); super.displayFileDiff(path, file1, file2, rev1, rev2, mimeType1, mimeType2, counitngStream); if (counitngStream.getPosition() > 0) { try { result.write(getEOL()); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } } setDiffWritten(counitngStream.getPosition() > 0); }
public void printHeader(OutputStream os) throws SVNException { if (myHeader != null) { try { displayHeader(os, null, false); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } } }
case NO_DIFF: try { result.write(getEOL()); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
if (generator instanceof DefaultSVNGNUDiffGenerator) { defaultGenerator = (DefaultSVNGNUDiffGenerator) generator; defaultGenerator.setHeaderWritten(false); defaultGenerator.setDiffWritten(false); if (defaultGenerator != null) { if (isOriginalEmpty) { defaultGenerator.setOriginalFile(null, path); } else { defaultGenerator.setOriginalFile(baseRoot, basePath); defaultGenerator.setNewFile(root, path); boolean hasDiff = defaultGenerator != null ? defaultGenerator.isDiffWritten() : true; if (!hasDiff && !node.myHasPropModifications && (node.myAction == SVNChangeEntry.TYPE_ADDED && generator.isDiffAdded() || node.myAction == SVNChangeEntry.TYPE_DELETED && generator.isDiffDeleted())) { int kind = node.myAction == SVNChangeEntry.TYPE_ADDED ? ISVNGNUDiffGenerator.ADDED : ISVNGNUDiffGenerator.DELETED; defaultGenerator.setHeaderWritten(false); defaultGenerator.displayHeader(kind, path, null, -1, os); defaultGenerator.printHeader(os);
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()); } }
protected void displayBinary(OutputStream os, String mimeType1, String mimeType2) throws IOException { os.write("(Binary files differ)".getBytes(getEncoding())); os.write(getEOL()); }
public void displayFileDiff(String path, File file1, File file2, String rev1, String rev2, String mimeType1, String mimeType2, OutputStream result) throws SVNException { CountingOutputStream counitngStream = new CountingOutputStream(result, 0); super.displayFileDiff(path, file1, file2, rev1, rev2, mimeType1, mimeType2, counitngStream); if (counitngStream.getPosition() > 0) { try { result.write(getEOL()); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } } setDiffWritten(counitngStream.getPosition() > 0); }
public void printHeader(OutputStream os) throws SVNException { if (myHeader != null) { try { displayHeader(os, null, false); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } } }
case NO_DIFF: try { result.write(getEOL()); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
if (generator instanceof DefaultSVNGNUDiffGenerator) { defaultGenerator = (DefaultSVNGNUDiffGenerator) generator; defaultGenerator.setHeaderWritten(false); defaultGenerator.setDiffWritten(false); if (defaultGenerator != null) { if (isOriginalEmpty) { defaultGenerator.setOriginalFile(null, path); } else { defaultGenerator.setOriginalFile(baseRoot, basePath); defaultGenerator.setNewFile(root, path); boolean hasDiff = defaultGenerator != null ? defaultGenerator.isDiffWritten() : true; if (!hasDiff && !node.myHasPropModifications && (node.myAction == SVNChangeEntry.TYPE_ADDED && generator.isDiffAdded() || node.myAction == SVNChangeEntry.TYPE_DELETED && generator.isDiffDeleted())) { int kind = node.myAction == SVNChangeEntry.TYPE_ADDED ? ISVNGNUDiffGenerator.ADDED : ISVNGNUDiffGenerator.DELETED; defaultGenerator.setHeaderWritten(false); defaultGenerator.displayHeader(kind, path, null, -1, os); defaultGenerator.printHeader(os);
/** * 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; }
protected void displayHeaderFields(OutputStream os, String label1, String label2) throws IOException { os.write("--- ".getBytes(getEncoding())); String originalLabel = null; String newLabel = null; try { originalLabel = generateLabel(myOriginalRoot, myOriginalPath); newLabel = generateLabel(myNewRoot, myNewPath); } catch (SVNException svne) { throw new IOException(svne.getLocalizedMessage()); } os.write(originalLabel.getBytes(getEncoding())); os.write(getEOL()); os.write("+++ ".getBytes(getEncoding())); os.write(newLabel.getBytes(getEncoding())); os.write(getEOL()); }
protected void displayBinary(OutputStream os, String mimeType1, String mimeType2) throws IOException { os.write("(Binary files differ)".getBytes(getEncoding())); os.write(getEOL()); }
public void displayFileDiff(String path, File file1, File file2, String rev1, String rev2, String mimeType1, String mimeType2, OutputStream result) throws SVNException { CountingOutputStream counitngStream = new CountingOutputStream(result, 0); super.displayFileDiff(path, file1, file2, rev1, rev2, mimeType1, mimeType2, counitngStream); if (counitngStream.getPosition() > 0) { try { result.write(getEOL()); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } } setDiffWritten(counitngStream.getPosition() > 0); }
public void printHeader(OutputStream os) throws SVNException { if (myHeader != null) { try { displayHeader(os, null, false); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } } }