JavaSVN Home

## org.tmatesoft.svn.core.wc
Interface ISVNDiffGenerator

All Known Implementing Classes:
  DefaultSVNDiffGenerator

public interface ISVNDiffGenerator

The ISVNDiffGenerator should be implemented by drivers generating contents difference between files in order to be used in 'diff' operations performed by SVNDiffClient.

Version:
  1.0
Author:
  TMate Software Ltd.
See Also:
  `SVNDiffClient`, `DefaultSVNDiffGenerator`

Method Summary
`File` `createTempDirectory()` Creates a temporary directory (when necessary) where temporary files will be created.
`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, Map baseProps, Map diff, OutputStream result)` Writes the differences in file properties to the specified output stream.
`String` `getEncoding()` Gets the encoding charset being in use for a diff output.
`void` `init(String anchorPath1, 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.
`boolean` `isDiffDeleted()` Tells whether deleted files are enabled to be diffed.
`void` `setBasePath(File basePath)` Sets the root path for this diff generator.
`void` `setDiffDeleted(boolean isDiffDeleted)` Enables or disables generating differences for deleted files.
`void` `setEncoding(String encoding)` Sets the encoding charset to be used for a diff output.
`void` `setForcedBinaryDiff(boolean forced)` Enables or disables generating differnces between files having a binary MIME type.

Method Detail

### init

    public void init(String anchorPath1,
                     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.

  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/URL
    `anchorPath2` - a new path/URL

### setBasePath

    public void setBasePath(File basePath)

  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

    public 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

    public void setEncoding(String encoding)

  Sets the encoding charset to be used for a diff output.

  Parameters:
    `encoding` - the name of a charset

### getEncoding

    public String getEncoding()

  Gets the encoding charset being in use for a diff output.

  Returns:
    the name of the charset being in use

### setDiffDeleted

    public void setDiffDeleted(boolean isDiffDeleted)

  Enables or disables generating differences for deleted files.

  Like the '--no-diff-deleted' option of the 'svn diff' command.

  Parameters:
    `isDiffDeleted` - if true then deleted files will be diffed, otherwise not

### isDiffDeleted

    public 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

### createTempDirectory

    public File createTempDirectory()
                             throws SVNException

  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

    public void displayPropDiff(String path,
                                Map baseProps,
                                Map 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 output
    `baseProps` - a `Map` of old properties (property names are mapped to their values)
    `diff` - a `Map` of changed properties (property names are mapped to their values)
    `result` - the target `OutputStream` where the differences will be written to
  Throws:
    `SVNException` - if can not save diff data

### displayFileDiff

    public 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` or `file2` 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 by `createTempDirectory()`) when the operation ends up.

  Parameters:
    `path` - a file path on which the differences are generated and written to the output
    `file1` - a file with old contents
    `file2` - a file with new contents
    `rev1` - the revision of `file1`
    `rev2` - the revision of `file2`
    `mimeType1` - the MIME-type of `file1`
    `mimeType2` - the MIME-type of `file2`
    `result` - the target `OutputStream` where the differences will be written to
  Throws:
    `SVNException` - if can not save diff data

JavaSVN Home

Copyright © 2004-2006 TMate Software Ltd. All Rights Reserved.