Interface ISVNDiffGenerator
- All Known Subinterfaces:
ISVNGNUDiffGenerator
- All Known Implementing Classes:
DefaultSVNCommandLineDiffGenerator
,DefaultSVNDiffGenerator
,DefaultSVNGNUDiffGenerator
,SvnNewDiffGenerator
- Since:
- 1.2
- Version:
- 1.3
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionCreates a temporary directory (when necessary) where temporary files will be created.void
displayAddedDirectory
(String path, String rev1, String rev2) Notifies this generator that the directory was added in revisionrev2
.void
displayDeletedDirectory
(String path, String rev1, String rev2) Notifies this generator that the directory was deleted in revisionrev2
.void
displayFileDiff
(String path, File file1, File file2, String rev1, String rev2, String mimeType1, String mimeType2, OutputStream result) Generates and writes differences between two files to the specified output stream.void
displayPropDiff
(String path, SVNProperties baseProps, SVNProperties diff, OutputStream result) Writes the differences in file properties to the specified output stream.Gets the encoding charset being in use for a diff output.byte[]
getEOL()
Returns the EOL marker bytes used in diff output.void
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.boolean
Tells whether added files are enabled to be diffed.boolean
Tells whether copied files are enabled to be diffed against their copy sources.boolean
Tells whether deleted files are enabled to be diffed.boolean
Says if unversioned files are also diffed or ignored.boolean
Tells whether to force diff even if files are binary.void
setBasePath
(File basePath) Sets the root path for this diff generator.void
setDiffAdded
(boolean isDiffAdded) Enables or disables generating differences for added files.void
setDiffCopied
(boolean isDiffCopied) Enables or disables generating differences against copy source for copied files.void
setDiffDeleted
(boolean isDiffDeleted) Enables or disables generating differences for deleted files.void
setDiffUnversioned
(boolean diffUnversioned) Includes or not unversioned files into diff processing.void
setEncoding
(String encoding) Sets the encoding charset to be used for a diff output.void
setEOL
(byte[] eol) Sets the EOL marker bytes to use in diff output.void
setForcedBinaryDiff
(boolean forced) Enables or disables generating differnces between files having a binary MIME type.
-
Method Details
-
init
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.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.- Parameters:
anchorPath1
- an old path/URLanchorPath2
- a new path/URL
-
setBasePath
Sets 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.
- Parameters:
basePath
- a base path for this driver
-
setForcedBinaryDiff
void setForcedBinaryDiff(boolean forced) Enables or disables generating differnces between files having a binary MIME type.Like the '--force' option of the 'svn diff' command.
- Parameters:
forced
- if true binary files will also be diffed, otherwise not
-
setEncoding
Sets the encoding charset to be used for a diff output.- Parameters:
encoding
- the name of a charset
-
getEncoding
String getEncoding()Gets the encoding charset being in use for a diff output.- Returns:
- the name of the charset being in use
-
setEOL
void setEOL(byte[] eol) Sets the EOL marker bytes to use in diff output.- Parameters:
eol
- EOL bytes- Since:
- 1.2.0
-
getEOL
byte[] getEOL()Returns the EOL marker bytes used in diff output.- Returns:
- EOL bytes
- Since:
- 1.2.0
-
setDiffDeleted
void setDiffDeleted(boolean isDiffDeleted) Enables or disables generating differences for deleted files.- Parameters:
isDiffDeleted
- if true then deleted files will be diffed, otherwise not- See Also:
-
isDiffDeleted
boolean isDiffDeleted()Tells whether deleted files are enabled to be diffed.- Returns:
- true if deleted files should be diffed (the driver is set to generate differences for deleted files as well), otherwise false
- See Also:
-
setDiffAdded
void setDiffAdded(boolean isDiffAdded) Enables or disables generating differences for added files.- Parameters:
isDiffAdded
- if true then added files will be diffed, otherwise not- See Also:
-
isDiffAdded
boolean isDiffAdded()Tells whether added files are enabled to be diffed.- Returns:
- true if added files should be diffed, otherwise false
- See Also:
-
setDiffCopied
void setDiffCopied(boolean isDiffCopied) Enables 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.
- Parameters:
isDiffCopied
- if true then copied files will be diffed against copy sources, otherwise they will be treated as newly added files- See Also:
-
isDiffCopied
boolean isDiffCopied()Tells whether copied files are enabled to be diffed against their copy sources. This switch is relevant toSVNLookClient
's diff operations.- Returns:
- true if copied files should be diffed against copy sources; false if copied files should be treated as newly added
- See Also:
-
setDiffUnversioned
void setDiffUnversioned(boolean diffUnversioned) Includes or not unversioned files into diff processing.If a diff operation is invoked on a versioned directory and
diffUnversioned
is true then all unversioned files that may be met in the directory will be processed as added. Otherwise ifdiffUnversioned
is false such files are ignored.- Parameters:
diffUnversioned
- controls whether to diff unversioned files or not- See Also:
-
isDiffUnversioned
boolean isDiffUnversioned()Says if unversioned files are also diffed or ignored.- Returns:
- true if diffed, false if ignored
- See Also:
-
createTempDirectory
Creates a temporary directory (when necessary) where temporary files will be created.This temporary directory exists till the end of the diff operation.
- Returns:
- an abstract pathname denoting a newly-created temporary directory
- Throws:
SVNException
- if a directory can not be created
-
displayPropDiff
void displayPropDiff(String path, SVNProperties baseProps, SVNProperties diff, OutputStream result) throws SVNException Writes the differences in file properties to the specified output stream.- Parameters:
path
- a file path on which the property changes are written to the outputbaseProps
- aMap
of old properties (property names are mapped to their values)diff
- aMap
of changed properties (property names are mapped to their values)result
- the targetOutputStream
where the differences will be written to- Throws:
SVNException
- if can not save diff data
-
displayFileDiff
void displayFileDiff(String path, File file1, File file2, String rev1, String rev2, String mimeType1, String mimeType2, OutputStream result) throws SVNException Generates and writes differences between two files to the specified output stream.file1
orfile2
may 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 bycreateTempDirectory()
) when the operation ends up.- 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 offile1
rev2
- the second diff revision offile2
mimeType1
- the MIME-type offile1
mimeType2
- the MIME-type offile2
result
- the targetOutputStream
where the differences will be written to- Throws:
SVNException
- if can not save diff data
-
displayDeletedDirectory
Notifies this generator that the directory was deleted in revisionrev2
.- Parameters:
path
- a directory pathrev1
- the first diff revisionrev2
- the second diff revision- Throws:
SVNException
- Since:
- 1.1
-
displayAddedDirectory
Notifies this generator that the directory was added in revisionrev2
.- Parameters:
path
- a directory pathrev1
- the first diff revisionrev2
- the second diff revision- Throws:
SVNException
- Since:
- 1.1
-
isForcedBinaryDiff
boolean isForcedBinaryDiff()Tells whether to force diff even if files are binary.- Returns:
- true to force diff for binary files; otherwise false
- Since:
- 1.1.1
-