Class SvnNewDiffGenerator
- java.lang.Object
-
- org.tmatesoft.svn.core.internal.wc2.ng.SvnNewDiffGenerator
-
- All Implemented Interfaces:
ISvnPropertiesDiffHandler,ISVNDiffGenerator
public class SvnNewDiffGenerator extends java.lang.Object implements ISVNDiffGenerator, ISvnPropertiesDiffHandler
-
-
Field Summary
Fields Modifier and Type Field Description private booleandiffAddedprivate booleandiffCopiedprivate booleandiffDeletedprivate booleandiffUnversionedprivate ISvnDiffGeneratorgeneratorprivate SVNPropertieslastOriginalPropertiesprivate SVNPropertieslastPropChanges
-
Constructor Summary
Constructors Constructor Description SvnNewDiffGenerator(ISvnDiffGenerator generator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.FilecreateTempDirectory()Creates a temporary directory (when necessary) where temporary files will be created.voiddisplayAddedDirectory(java.lang.String path, java.lang.String rev1, java.lang.String rev2)Notifies this generator that the directory was added in revisionrev2.voiddisplayDeletedDirectory(java.lang.String path, java.lang.String rev1, java.lang.String rev2)Notifies this generator that the directory was deleted in revisionrev2.voiddisplayFileDiff(java.lang.String path, java.io.File file1, java.io.File file2, java.lang.String rev1, java.lang.String rev2, java.lang.String mimeType1, java.lang.String mimeType2, java.io.OutputStream result)Generates and writes differences between two files to the specified output stream.voiddisplayPropDiff(java.lang.String path, SVNProperties baseProps, SVNProperties diff, java.io.OutputStream result)Writes the differences in file properties to the specified output stream.private SvnTargetgetAbsoluteTarget(java.lang.String path)ISvnDiffGeneratorgetDelegate()java.lang.StringgetEncoding()Gets the encoding charset being in use for a diff output.byte[]getEOL()Returns the EOL marker bytes used in diff output.private SvnTargetgetTarget(java.lang.String path)voidhandlePropertiesDiff(SVNProperties originalProperties, SVNProperties propChanges)voidinit(java.lang.String anchorPath1, java.lang.String anchorPath2)Initializes the driver setting up the paths/URLs that should be compared, or root paths/URLs for those paths to which a diff operation should be restricted.booleanisDiffAdded()Tells whether added files are enabled to be diffed.booleanisDiffCopied()Tells whether copied files are enabled to be diffed against their copy sources.booleanisDiffDeleted()Tells whether deleted files are enabled to be diffed.booleanisDiffUnversioned()Says if unversioned files are also diffed or ignored.booleanisForcedBinaryDiff()Tells whether to force diff even if files are binary.voidsetBasePath(java.io.File basePath)Sets the root path for this diff generator.voidsetDiffAdded(boolean isDiffAdded)Enables or disables generating differences for added files.voidsetDiffCopied(boolean isDiffCopied)Enables or disables generating differences against copy source for copied files.voidsetDiffDeleted(boolean isDiffDeleted)Enables or disables generating differences for deleted files.voidsetDiffUnversioned(boolean diffUnversioned)Includes or not unversioned files into diff processing.voidsetEncoding(java.lang.String encoding)Sets the encoding charset to be used for a diff output.voidsetEOL(byte[] eol)Sets the EOL marker bytes to use in diff output.voidsetForcedBinaryDiff(boolean forced)Enables or disables generating differnces between files having a binary MIME type.
-
-
-
Field Detail
-
generator
private final ISvnDiffGenerator generator
-
diffDeleted
private boolean diffDeleted
-
diffAdded
private boolean diffAdded
-
diffCopied
private boolean diffCopied
-
diffUnversioned
private boolean diffUnversioned
-
lastOriginalProperties
private SVNProperties lastOriginalProperties
-
lastPropChanges
private SVNProperties lastPropChanges
-
-
Constructor Detail
-
SvnNewDiffGenerator
public SvnNewDiffGenerator(ISvnDiffGenerator generator)
-
-
Method Detail
-
getDelegate
public ISvnDiffGenerator getDelegate()
-
init
public void init(java.lang.String anchorPath1, java.lang.String anchorPath2)Description copied from interface:ISVNDiffGeneratorInitializes the driver setting up the paths/URLs that should be compared, or root paths/URLs for those paths to which a diff operation should be restricted.These paths have got the same meaning as OLD-TGT (
anchorPath1) and NEW-TGT (anchorPath2) in the SVN command line client's 'svn diff' command. So, they can be either local paths, or URLs pointing to repository locations. If one of them (or both) is a URL it may differ from that one passed to an appropriate doDiff() method of SVNDiffClient in that case when in a peg revision it's one URL, but in the target revision it was changed (moved?) to some other one. So, this method should receive the real one.- Specified by:
initin interfaceISVNDiffGenerator- Parameters:
anchorPath1- an old path/URLanchorPath2- a new path/URL
-
setBasePath
public void setBasePath(java.io.File basePath)
Description copied from interface:ISVNDiffGeneratorSets the root path for this diff generator.This can be used to make all paths in a diff output be relative to this base path.
- Specified by:
setBasePathin interfaceISVNDiffGenerator- Parameters:
basePath- a base path for this driver
-
setForcedBinaryDiff
public void setForcedBinaryDiff(boolean forced)
Description copied from interface:ISVNDiffGeneratorEnables or disables generating differnces between files having a binary MIME type.Like the '--force' option of the 'svn diff' command.
- Specified by:
setForcedBinaryDiffin interfaceISVNDiffGenerator- Parameters:
forced- if true binary files will also be diffed, otherwise not
-
setEncoding
public void setEncoding(java.lang.String encoding)
Description copied from interface:ISVNDiffGeneratorSets the encoding charset to be used for a diff output.- Specified by:
setEncodingin interfaceISVNDiffGenerator- Parameters:
encoding- the name of a charset
-
getEncoding
public java.lang.String getEncoding()
Description copied from interface:ISVNDiffGeneratorGets the encoding charset being in use for a diff output.- Specified by:
getEncodingin interfaceISVNDiffGenerator- Returns:
- the name of the charset being in use
-
setEOL
public void setEOL(byte[] eol)
Description copied from interface:ISVNDiffGeneratorSets the EOL marker bytes to use in diff output.- Specified by:
setEOLin interfaceISVNDiffGenerator- Parameters:
eol- EOL bytes
-
getEOL
public byte[] getEOL()
Description copied from interface:ISVNDiffGeneratorReturns the EOL marker bytes used in diff output.- Specified by:
getEOLin interfaceISVNDiffGenerator- Returns:
- EOL bytes
-
setDiffDeleted
public void setDiffDeleted(boolean isDiffDeleted)
Description copied from interface:ISVNDiffGeneratorEnables or disables generating differences for deleted files.- Specified by:
setDiffDeletedin interfaceISVNDiffGenerator- Parameters:
isDiffDeleted- if true then deleted files will be diffed, otherwise not- See Also:
ISVNDiffGenerator.isDiffDeleted()
-
isDiffDeleted
public boolean isDiffDeleted()
Description copied from interface:ISVNDiffGeneratorTells whether deleted files are enabled to be diffed.- Specified by:
isDiffDeletedin interfaceISVNDiffGenerator- Returns:
- true if deleted files should be diffed (the driver is set to generate differences for deleted files as well), otherwise false
- See Also:
ISVNDiffGenerator.setDiffDeleted(boolean)
-
setDiffAdded
public void setDiffAdded(boolean isDiffAdded)
Description copied from interface:ISVNDiffGeneratorEnables or disables generating differences for added files.- Specified by:
setDiffAddedin interfaceISVNDiffGenerator- Parameters:
isDiffAdded- if true then added files will be diffed, otherwise not- See Also:
ISVNDiffGenerator.isDiffAdded()
-
isDiffAdded
public boolean isDiffAdded()
Description copied from interface:ISVNDiffGeneratorTells whether added files are enabled to be diffed.- Specified by:
isDiffAddedin interfaceISVNDiffGenerator- Returns:
- true if added files should be diffed, otherwise false
- See Also:
ISVNDiffGenerator.setDiffAdded(boolean)
-
setDiffCopied
public void setDiffCopied(boolean isDiffCopied)
Description copied from interface:ISVNDiffGeneratorEnables or disables generating differences against copy source for copied files. This switch is relevant toSVNLookClient's diff operations.Like the '--diff-copy-from' option of the 'svnlook diff' command.
- Specified by:
setDiffCopiedin interfaceISVNDiffGenerator- Parameters:
isDiffCopied- if true then copied files will be diffed against copy sources, otherwise they will be treated as newly added files- See Also:
ISVNDiffGenerator.isDiffCopied()
-
isDiffCopied
public boolean isDiffCopied()
Description copied from interface:ISVNDiffGeneratorTells whether copied files are enabled to be diffed against their copy sources. This switch is relevant toSVNLookClient's diff operations.- Specified by:
isDiffCopiedin interfaceISVNDiffGenerator- Returns:
- true if copied files should be diffed against copy sources; false if copied files should be treated as newly added
- See Also:
ISVNDiffGenerator.setDiffCopied(boolean)
-
setDiffUnversioned
public void setDiffUnversioned(boolean diffUnversioned)
Description copied from interface:ISVNDiffGeneratorIncludes or not unversioned files into diff processing.If a diff operation is invoked on a versioned directory and
diffUnversionedis true then all unversioned files that may be met in the directory will be processed as added. Otherwise ifdiffUnversionedis false such files are ignored.- Specified by:
setDiffUnversionedin interfaceISVNDiffGenerator- Parameters:
diffUnversioned- controls whether to diff unversioned files or not- See Also:
ISVNDiffGenerator.isDiffUnversioned()
-
isDiffUnversioned
public boolean isDiffUnversioned()
Description copied from interface:ISVNDiffGeneratorSays if unversioned files are also diffed or ignored.- Specified by:
isDiffUnversionedin interfaceISVNDiffGenerator- Returns:
- true if diffed, false if ignored
- See Also:
ISVNDiffGenerator.setDiffUnversioned(boolean)
-
createTempDirectory
public java.io.File createTempDirectory() throws SVNExceptionDescription copied from interface:ISVNDiffGeneratorCreates a temporary directory (when necessary) where temporary files will be created.This temporary directory exists till the end of the diff operation.
- Specified by:
createTempDirectoryin interfaceISVNDiffGenerator- Returns:
- an abstract pathname denoting a newly-created temporary directory
- Throws:
SVNException- if a directory can not be created
-
displayPropDiff
public void displayPropDiff(java.lang.String path, SVNProperties baseProps, SVNProperties diff, java.io.OutputStream result) throws SVNExceptionDescription copied from interface:ISVNDiffGeneratorWrites the differences in file properties to the specified output stream.- Specified by:
displayPropDiffin interfaceISVNDiffGenerator- Parameters:
path- a file path on which the property changes are written to the outputbaseProps- aMapof old properties (property names are mapped to their values)diff- aMapof changed properties (property names are mapped to their values)result- the targetOutputStreamwhere the differences will be written to- Throws:
SVNException- if can not save diff data
-
handlePropertiesDiff
public void handlePropertiesDiff(SVNProperties originalProperties, SVNProperties propChanges)
- Specified by:
handlePropertiesDiffin interfaceISvnPropertiesDiffHandler
-
displayFileDiff
public void displayFileDiff(java.lang.String path, java.io.File file1, java.io.File file2, java.lang.String rev1, java.lang.String rev2, java.lang.String mimeType1, java.lang.String mimeType2, java.io.OutputStream result) throws SVNExceptionDescription copied from interface:ISVNDiffGeneratorGenerates and writes differences between two files to the specified output stream.file1orfile2may be temporary files crteated to get file contents from the repository (when running diff on URLs). These temporary files will be deleted with the temporary directory (created byISVNDiffGenerator.createTempDirectory()) when the operation ends up.- Specified by:
displayFileDiffin interfaceISVNDiffGenerator- Parameters:
path- a file path on which the differences are generated and written to the outputfile1- a file with old contentsfile2- a file with new contentsrev1- the first diff revision offile1rev2- the second diff revision offile2mimeType1- the MIME-type offile1mimeType2- the MIME-type offile2result- the targetOutputStreamwhere the differences will be written to- Throws:
SVNException- if can not save diff data
-
displayDeletedDirectory
public void displayDeletedDirectory(java.lang.String path, java.lang.String rev1, java.lang.String rev2) throws SVNExceptionDescription copied from interface:ISVNDiffGeneratorNotifies this generator that the directory was deleted in revisionrev2.- Specified by:
displayDeletedDirectoryin interfaceISVNDiffGenerator- Parameters:
path- a directory pathrev1- the first diff revisionrev2- the second diff revision- Throws:
SVNException
-
displayAddedDirectory
public void displayAddedDirectory(java.lang.String path, java.lang.String rev1, java.lang.String rev2) throws SVNExceptionDescription copied from interface:ISVNDiffGeneratorNotifies this generator that the directory was added in revisionrev2.- Specified by:
displayAddedDirectoryin interfaceISVNDiffGenerator- Parameters:
path- a directory pathrev1- the first diff revisionrev2- the second diff revision- Throws:
SVNException
-
isForcedBinaryDiff
public boolean isForcedBinaryDiff()
Description copied from interface:ISVNDiffGeneratorTells whether to force diff even if files are binary.- Specified by:
isForcedBinaryDiffin interfaceISVNDiffGenerator- Returns:
- true to force diff for binary files; otherwise false
-
getTarget
private SvnTarget getTarget(java.lang.String path)
-
getAbsoluteTarget
private SvnTarget getAbsoluteTarget(java.lang.String path)
-
-