Subversion 1.6.16

svn_diff.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  * Copyright (c) 2000-2008 CollabNet.  All rights reserved.
00005  *
00006  * This software is licensed as described in the file COPYING, which
00007  * you should have received as part of this distribution.  The terms
00008  * are also available at http://subversion.tigris.org/license-1.html.
00009  * If newer versions of this license are posted there, you may use a
00010  * newer version instead, at your option.
00011  *
00012  * This software consists of voluntary contributions made by many
00013  * individuals.  For exact contribution history, see the revision
00014  * history and logs, available at http://subversion.tigris.org/.
00015  * ====================================================================
00016  * @endcopyright
00017  *
00018  * @file svn_diff.h
00019  * @brief Contextual diffing.
00020  *
00021  * This is an internalized library for performing contextual diffs
00022  * between sources of data.
00023  *
00024  * @note This is different than Subversion's binary-diffing engine.
00025  * That API lives in @c svn_delta.h -- see the "text deltas" section.  A
00026  * "text delta" is way of representing precise binary diffs between
00027  * strings of data.  The Subversion client and server send text deltas
00028  * to one another during updates and commits.
00029  *
00030  * This API, however, is (or will be) used for performing *contextual*
00031  * merges between files in the working copy.  During an update or
00032  * merge, 3-way file merging is needed.  And 'svn diff' needs to show
00033  * the differences between 2 files.
00034  *
00035  * The nice thing about this API is that it's very general.  It
00036  * operates on any source of data (a "datasource") and calculates
00037  * contextual differences on "tokens" within the data.  In our
00038  * particular usage, the datasources are files and the tokens are
00039  * lines.  But the possibilities are endless.
00040  */
00041 
00042 
00043 #ifndef SVN_DIFF_H
00044 #define SVN_DIFF_H
00045 
00046 #include <apr.h>
00047 #include <apr_pools.h>
00048 #include <apr_tables.h>   /* for apr_array_header_t */
00049 
00050 #include "svn_types.h"
00051 #include "svn_io.h"       /* for svn_stream_t */
00052 #include "svn_version.h"
00053 #include "svn_string.h"
00054 
00055 #ifdef __cplusplus
00056 extern "C" {
00057 #endif /* __cplusplus */
00058 
00059 
00060 
00061 /**
00062  * Get libsvn_diff version information.
00063  *
00064  * @since New in 1.1.
00065  */
00066 const svn_version_t *
00067 svn_diff_version(void);
00068 
00069 
00070 /* Diffs. */
00071 
00072 /** An opaque type that represents a difference between either two or
00073  * three datasources.   This object is returned by svn_diff_diff(),
00074  * svn_diff_diff3() and svn_diff_diff4(), and consumed by a number of
00075  * other routines.
00076  */
00077 typedef struct svn_diff_t svn_diff_t;
00078 
00079 /**
00080  * There are four types of datasources.  In GNU diff3 terminology,
00081  * the first three types correspond to the phrases "older", "mine",
00082  * and "yours".
00083  */
00084 typedef enum svn_diff_datasource_e
00085 {
00086   /** The oldest form of the data. */
00087   svn_diff_datasource_original,
00088 
00089   /** The same data, but potentially changed by the user. */
00090   svn_diff_datasource_modified,
00091 
00092   /** The latest version of the data, possibly different than the
00093    * user's modified version.
00094    */
00095   svn_diff_datasource_latest,
00096 
00097   /** The common ancestor of original and modified. */
00098   svn_diff_datasource_ancestor
00099 
00100 } svn_diff_datasource_e;
00101 
00102 
00103 /** A vtable for reading data from the three datasources. */
00104 typedef struct svn_diff_fns_t
00105 {
00106   /** Open the datasource of type @a datasource. */
00107   svn_error_t *(*datasource_open)(void *diff_baton,
00108                                   svn_diff_datasource_e datasource);
00109 
00110   /** Close the datasource of type @a datasource. */
00111   svn_error_t *(*datasource_close)(void *diff_baton,
00112                                    svn_diff_datasource_e datasource);
00113 
00114   /** Get the next "token" from the datasource of type @a datasource.
00115    *  Return a "token" in @a *token.   Return a hash of "token" in @a *hash.
00116    *  Leave @a token and @a hash untouched when the datasource is exhausted.
00117    */
00118   svn_error_t *(*datasource_get_next_token)(apr_uint32_t *hash, void **token,
00119                                             void *diff_baton,
00120                                             svn_diff_datasource_e datasource);
00121 
00122   /** A function for ordering the tokens, resembling 'strcmp' in functionality.
00123    * @a compare should contain the return value of the comparison:
00124    * If @a ltoken and @a rtoken are "equal", return 0.  If @a ltoken is
00125    * "less than" @a rtoken, return a number < 0.  If @a ltoken  is
00126    * "greater than" @a rtoken, return a number > 0.
00127    */
00128   svn_error_t *(*token_compare)(void *diff_baton,
00129                                 void *ltoken,
00130                                 void *rtoken,
00131                                 int *compare);
00132 
00133   /** Free @a token from memory, the diff algorithm is done with it. */
00134   void (*token_discard)(void *diff_baton,
00135                         void *token);
00136 
00137   /** Free *all* tokens from memory, they're no longer needed. */
00138   void (*token_discard_all)(void *diff_baton);
00139 } svn_diff_fns_t;
00140 
00141 
00142 /* The Main Events */
00143 
00144 /** Given a vtable of @a diff_fns/@a diff_baton for reading datasources,
00145  * return a diff object in @a *diff that represents a difference between
00146  * an "original" and "modified" datasource.  Do all allocation in @a pool.
00147  */
00148 svn_error_t *
00149 svn_diff_diff(svn_diff_t **diff,
00150               void *diff_baton,
00151               const svn_diff_fns_t *diff_fns,
00152               apr_pool_t *pool);
00153 
00154 /** Given a vtable of @a diff_fns/@a diff_baton for reading datasources,
00155  * return a diff object in @a *diff that represents a difference between
00156  * three datasources: "original", "modified", and "latest".  Do all
00157  * allocation in @a pool.
00158  */
00159 svn_error_t *
00160 svn_diff_diff3(svn_diff_t **diff,
00161                void *diff_baton,
00162                const svn_diff_fns_t *diff_fns,
00163                apr_pool_t *pool);
00164 
00165 /** Given a vtable of @a diff_fns/@a diff_baton for reading datasources,
00166  * return a diff object in @a *diff that represents a difference between
00167  * two datasources: "original" and "latest", adjusted to become a full
00168  * difference between "original", "modified" and "latest" using "ancestor".
00169  * Do all allocation in @a pool.
00170  */
00171 svn_error_t *
00172 svn_diff_diff4(svn_diff_t **diff,
00173                void *diff_baton,
00174                const svn_diff_fns_t *diff_fns,
00175                apr_pool_t *pool);
00176 
00177 
00178 /* Utility functions */
00179 
00180 /** Determine if a diff object contains conflicts.  If it does, return
00181  * @c TRUE, else return @c FALSE.
00182  */
00183 svn_boolean_t
00184 svn_diff_contains_conflicts(svn_diff_t *diff);
00185 
00186 
00187 /** Determine if a diff object contains actual differences between the
00188  * datasources.  If so, return @c TRUE, else return @c FALSE.
00189  */
00190 svn_boolean_t
00191 svn_diff_contains_diffs(svn_diff_t *diff);
00192 
00193 
00194 
00195 
00196 /* Displaying Diffs */
00197 
00198 /** A vtable for displaying (or consuming) differences between datasources.
00199  *
00200  * Differences, similarities, and conflicts are described by lining up
00201  * "ranges" of data.
00202  *
00203  * @note These callbacks describe data ranges in units of "tokens".
00204  * A "token" is whatever you've defined it to be in your datasource
00205  * @c svn_diff_fns_t vtable.
00206  */
00207 typedef struct svn_diff_output_fns_t
00208 {
00209   /* Two-way and three-way diffs both call the first two output functions: */
00210 
00211   /**
00212    * If doing a two-way diff, then an *identical* data range was found
00213    * between the "original" and "modified" datasources.  Specifically,
00214    * the match starts at @a original_start and goes for @a original_length
00215    * tokens in the original data, and at @a modified_start for
00216    * @a modified_length tokens in the modified data.
00217    *
00218    * If doing a three-way diff, then all three datasources have
00219    * matching data ranges.  The range @a latest_start, @a latest_length in
00220    * the "latest" datasource is identical to the range @a original_start,
00221    * @a original_length in the original data, and is also identical to
00222    * the range @a modified_start, @a modified_length in the modified data.
00223    */
00224   svn_error_t *(*output_common)(void *output_baton,
00225                                 apr_off_t original_start,
00226                                 apr_off_t original_length,
00227                                 apr_off_t modified_start,
00228                                 apr_off_t modified_length,
00229                                 apr_off_t latest_start,
00230                                 apr_off_t latest_length);
00231 
00232   /**
00233    * If doing a two-way diff, then an *conflicting* data range was found
00234    * between the "original" and "modified" datasources.  Specifically,
00235    * the conflict starts at @a original_start and goes for @a original_length
00236    * tokens in the original data, and at @a modified_start for
00237    * @a modified_length tokens in the modified data.
00238    *
00239    * If doing a three-way diff, then an identical data range was discovered
00240    * between the "original" and "latest" datasources, but this conflicts with
00241    * a range in the "modified" datasource.
00242    */
00243   svn_error_t *(*output_diff_modified)(void *output_baton,
00244                                        apr_off_t original_start,
00245                                        apr_off_t original_length,
00246                                        apr_off_t modified_start,
00247                                        apr_off_t modified_length,
00248                                        apr_off_t latest_start,
00249                                        apr_off_t latest_length);
00250 
00251   /* ------ The following callbacks are used by three-way diffs only --- */
00252 
00253   /** An identical data range was discovered between the "original" and
00254    * "modified" datasources, but this conflicts with a range in the
00255    * "latest" datasource.
00256    */
00257   svn_error_t *(*output_diff_latest)(void *output_baton,
00258                                      apr_off_t original_start,
00259                                      apr_off_t original_length,
00260                                      apr_off_t modified_start,
00261                                      apr_off_t modified_length,
00262                                      apr_off_t latest_start,
00263                                      apr_off_t latest_length);
00264 
00265   /** An identical data range was discovered between the "modified" and
00266    * "latest" datasources, but this conflicts with a range in the
00267    * "original" datasource.
00268    */
00269   svn_error_t *(*output_diff_common)(void *output_baton,
00270                                      apr_off_t original_start,
00271                                      apr_off_t original_length,
00272                                      apr_off_t modified_start,
00273                                      apr_off_t modified_length,
00274                                      apr_off_t latest_start,
00275                                      apr_off_t latest_length);
00276 
00277   /** All three datasources have conflicting data ranges.  The range
00278    * @a latest_start, @a latest_length in the "latest" datasource conflicts
00279    * with the range @a original_start, @a original_length in the "original"
00280    * datasource, and also conflicts with the range @a modified_start,
00281    * @a modified_length in the "modified" datasource.
00282    * If there are common ranges in the "modified" and "latest" datasources
00283    * in this conflicting range, @a resolved_diff will contain a diff
00284    * which can be used to retrieve the common and conflicting ranges.
00285    */
00286   svn_error_t *(*output_conflict)(void *output_baton,
00287                                   apr_off_t original_start,
00288                                   apr_off_t original_length,
00289                                   apr_off_t modified_start,
00290                                   apr_off_t modified_length,
00291                                   apr_off_t latest_start,
00292                                   apr_off_t latest_length,
00293                                   svn_diff_t *resolved_diff);
00294 } svn_diff_output_fns_t;
00295 
00296 /** Style for displaying conflicts during diff3 output.
00297  *
00298  * @since New in 1.6.
00299  */
00300 typedef enum svn_diff_conflict_display_style_t
00301 {
00302   /** Display modified and latest, with conflict markers. */
00303   svn_diff_conflict_display_modified_latest,
00304 
00305   /** Like svn_diff_conflict_display_modified_latest, but with an
00306       extra effort to identify common sequences between modified and
00307       latest. */
00308   svn_diff_conflict_display_resolved_modified_latest,
00309 
00310   /** Display modified, original, and latest, with conflict
00311       markers. */
00312   svn_diff_conflict_display_modified_original_latest,
00313 
00314   /** Just display modified, with no markers. */
00315   svn_diff_conflict_display_modified,
00316 
00317   /** Just display latest, with no markers. */
00318   svn_diff_conflict_display_latest,
00319 
00320   /** Like svn_diff_conflict_display_modified_original_latest, but
00321       *only* showing conflicts. */
00322   svn_diff_conflict_display_only_conflicts
00323 } svn_diff_conflict_display_style_t;
00324 
00325 
00326 /** Given a vtable of @a output_fns/@a output_baton for consuming
00327  * differences, output the differences in @a diff.
00328  */
00329 svn_error_t *
00330 svn_diff_output(svn_diff_t *diff,
00331                 void *output_baton,
00332                 const svn_diff_output_fns_t *output_fns);
00333 
00334 
00335 
00336 /* Diffs on files */
00337 
00338 /** To what extent whitespace should be ignored when comparing lines.
00339  *
00340  * @since New in 1.4.
00341  */
00342 typedef enum svn_diff_file_ignore_space_t
00343 {
00344   /** Ignore no whitespace. */
00345   svn_diff_file_ignore_space_none,
00346 
00347   /** Ignore changes in sequences of whitespace characters, treating each
00348    * sequence of whitespace characters as a single space. */
00349   svn_diff_file_ignore_space_change,
00350 
00351   /** Ignore all whitespace characters. */
00352   svn_diff_file_ignore_space_all
00353 } svn_diff_file_ignore_space_t;
00354 
00355 /** Options to control the behaviour of the file diff routines.
00356  *
00357  * @since New in 1.4.
00358  *
00359  * @note This structure may be extended in the future, so to preserve binary
00360  * compatibility, users must not allocate structs of this type themselves.
00361  * @see svn_diff_file_options_create().
00362  *
00363  * @note Although its name suggests otherwise, this structure is used to
00364  *       pass options to file as well as in-memory diff functions.
00365  */
00366 typedef struct svn_diff_file_options_t
00367 {
00368   /** To what extent whitespace should be ignored when comparing lines.
00369    * The default is @c svn_diff_file_ignore_space_none. */
00370   svn_diff_file_ignore_space_t ignore_space;
00371   /** Whether to treat all end-of-line markers the same when comparing lines.
00372    * The default is @c FALSE. */
00373   svn_boolean_t ignore_eol_style;
00374   /** Whether the '@@' lines of the unified diff output should include a prefix
00375     * of the nearest preceding line that starts with a character that might be
00376     * the initial character of a C language identifier.  The default is
00377     * @c FALSE.
00378     */
00379   svn_boolean_t show_c_function;
00380 } svn_diff_file_options_t;
00381 
00382 /** Allocate a @c svn_diff_file_options_t structure in @a pool, initializing
00383  * it with default values.
00384  *
00385  * @since New in 1.4.
00386  */
00387 svn_diff_file_options_t *
00388 svn_diff_file_options_create(apr_pool_t *pool);
00389 
00390 /**
00391  * Parse @a args, an array of <tt>const char *</tt> command line switches
00392  * and adjust @a options accordingly.  @a options is assumed to be initialized
00393  * with default values.  @a pool is used for temporary allocation.
00394  *
00395  * @since New in 1.4.
00396  *
00397  * The following options are supported:
00398  * - --ignore-space-change, -b
00399  * - --ignore-all-space, -w
00400  * - --ignore-eol-style
00401  * - --unified, -u (for compatibility, does nothing).
00402  */
00403 svn_error_t *
00404 svn_diff_file_options_parse(svn_diff_file_options_t *options,
00405                             const apr_array_header_t *args,
00406                             apr_pool_t *pool);
00407 
00408 
00409 /** A convenience function to produce a diff between two files.
00410  *
00411  * @since New in 1.4.
00412  *
00413  * Return a diff object in @a *diff (allocated from @a pool) that represents
00414  * the difference between an @a original file and @a modified file.
00415  * (The file arguments must be full paths to the files.)
00416  *
00417  * Compare lines according to the relevant fields of @a options.
00418  */
00419 svn_error_t *
00420 svn_diff_file_diff_2(svn_diff_t **diff,
00421                      const char *original,
00422                      const char *modified,
00423                      const svn_diff_file_options_t *options,
00424                      apr_pool_t *pool);
00425 
00426 /** Similar to svn_file_diff_2(), but with @a options set to a struct with
00427  * default options.
00428  *
00429  * @deprecated Provided for backwards compatibility with the 1.3 API.
00430  */
00431 SVN_DEPRECATED
00432 svn_error_t *
00433 svn_diff_file_diff(svn_diff_t **diff,
00434                    const char *original,
00435                    const char *modified,
00436                    apr_pool_t *pool);
00437 
00438 /** A convenience function to produce a diff between three files.
00439  *
00440  * @since New in 1.4.
00441  *
00442  * Return a diff object in @a *diff (allocated from @a pool) that represents
00443  * the difference between an @a original file, @a modified file, and @a latest
00444  * file.
00445  *
00446  * Compare lines according to the relevant fields of @a options.
00447  */
00448 svn_error_t *
00449 svn_diff_file_diff3_2(svn_diff_t **diff,
00450                       const char *original,
00451                       const char *modified,
00452                       const char *latest,
00453                       const svn_diff_file_options_t *options,
00454                       apr_pool_t *pool);
00455 
00456 /** Similar to svn_diff_file_diff3_2(), but with @a options set to a struct
00457  * with default options.
00458  *
00459  * @deprecated Provided for backwards compatibility with the 1.3 API.
00460  */
00461 SVN_DEPRECATED
00462 svn_error_t *
00463 svn_diff_file_diff3(svn_diff_t **diff,
00464                     const char *original,
00465                     const char *modified,
00466                     const char *latest,
00467                     apr_pool_t *pool);
00468 
00469 /** A convenience function to produce a diff between four files.
00470  *
00471  * @since New in 1.4.
00472  *
00473  * Return a diff object in @a *diff (allocated from @a pool) that represents
00474  * the difference between an @a original file, @a modified file, @a latest
00475  * and @a ancestor file. (The file arguments must be full paths to the files.)
00476  *
00477  * Compare lines according to the relevant fields of @a options.
00478  */
00479 svn_error_t *
00480 svn_diff_file_diff4_2(svn_diff_t **diff,
00481                       const char *original,
00482                       const char *modified,
00483                       const char *latest,
00484                       const char *ancestor,
00485                       const svn_diff_file_options_t *options,
00486                       apr_pool_t *pool);
00487 
00488 /** Simliar to svn_file_diff4_2(), but with @a options set to a struct with
00489  * default options.
00490  *
00491  * @deprecated Provided for backwards compatibility with the 1.3 API.
00492  */
00493 SVN_DEPRECATED
00494 svn_error_t *
00495 svn_diff_file_diff4(svn_diff_t **diff,
00496                     const char *original,
00497                     const char *modified,
00498                     const char *latest,
00499                     const char *ancestor,
00500                     apr_pool_t *pool);
00501 
00502 /** A convenience function to produce unified diff output from the
00503  * diff generated by svn_diff_file_diff().
00504  *
00505  * @since New in 1.5.
00506  *
00507  * Output a @a diff between @a original_path and @a modified_path in unified
00508  * context diff format to @a output_stream.  Optionally supply
00509  * @a original_header and/or @a modified_header to be displayed in the header
00510  * of the output.  If @a original_header or @a modified_header is @c NULL, a
00511  * default header will be displayed, consisting of path and last modified time.
00512  * Output all headers and markers in @a header_encoding.  If @a relative_to_dir
00513  * is not @c NULL, the @a original_path and @a modified_path will have the
00514  * @a relative_to_dir stripped from the front of the respective paths.  If
00515  * @a relative_to_dir is @c NULL, paths will be not be modified.  If
00516  * @a relative_to_dir is not @c NULL but @a relative_to_dir is not a parent
00517  * path of the target, an error is returned. Finally, if @a relative_to_dir
00518  * is a URL, an error will be returned.
00519  */
00520 svn_error_t *
00521 svn_diff_file_output_unified3(svn_stream_t *output_stream,
00522                               svn_diff_t *diff,
00523                               const char *original_path,
00524                               const char *modified_path,
00525                               const char *original_header,
00526                               const char *modified_header,
00527                               const char *header_encoding,
00528                               const char *relative_to_dir,
00529                               svn_boolean_t show_c_function,
00530                               apr_pool_t *pool);
00531 
00532 /** Similar to svn_diff_file_output_unified3(), but with @a relative_to_dir
00533  * set to NULL and @a show_c_function to false.
00534  *
00535  * @deprecated Provided for backwards compatibility with the 1.3 API.
00536  */
00537 SVN_DEPRECATED
00538 svn_error_t *
00539 svn_diff_file_output_unified2(svn_stream_t *output_stream,
00540                               svn_diff_t *diff,
00541                               const char *original_path,
00542                               const char *modified_path,
00543                               const char *original_header,
00544                               const char *modified_header,
00545                               const char *header_encoding,
00546                               apr_pool_t *pool);
00547 
00548 /** Similar to svn_diff_file_output_unified2(), but with @a header_encoding
00549  * set to @c APR_LOCALE_CHARSET.
00550  *
00551  * @deprecated Provided for backward compatibility with the 1.2 API.
00552  */
00553 SVN_DEPRECATED
00554 svn_error_t *
00555 svn_diff_file_output_unified(svn_stream_t *output_stream,
00556                              svn_diff_t *diff,
00557                              const char *original_path,
00558                              const char *modified_path,
00559                              const char *original_header,
00560                              const char *modified_header,
00561                              apr_pool_t *pool);
00562 
00563 
00564 /** A convenience function to produce diff3 output from the
00565  * diff generated by svn_diff_file_diff3().
00566  *
00567  * Output a @a diff between @a original_path, @a modified_path and
00568  * @a latest_path in merged format to @a output_stream.  Optionally supply
00569  * @a conflict_modified, @a conflict_original, @a conflict_separator and/or
00570  * @a conflict_latest to be displayed as conflict markers in the output.
00571  * If @a conflict_original, @a conflict_modified, @a conflict_latest and/or
00572  * @a conflict_separator is @c NULL, a default marker will be displayed.
00573  * @a conflict_style dictates how conflicts are displayed.
00574  *
00575  * @since New in 1.6.
00576  */
00577 svn_error_t *
00578 svn_diff_file_output_merge2(svn_stream_t *output_stream,
00579                             svn_diff_t *diff,
00580                             const char *original_path,
00581                             const char *modified_path,
00582                             const char *latest_path,
00583                             const char *conflict_original,
00584                             const char *conflict_modified,
00585                             const char *conflict_latest,
00586                             const char *conflict_separator,
00587                             svn_diff_conflict_display_style_t conflict_style,
00588                             apr_pool_t *pool);
00589 
00590 
00591 /** Similar to svn_diff_file_output_merge2, but with @a
00592  * display_original_in_conflict and @a display_resolved_conflicts
00593  * booleans instead of the @a conflict_style enum.
00594  *
00595  * If both booleans are false, acts like
00596  * svn_diff_conflict_display_modified_latest; if @a
00597  * display_original_in_conflict is true, acts like
00598  * svn_diff_conflict_display_modified_original_latest; if @a
00599  * display_resolved_conflicts is true, acts like
00600  * svn_diff_conflict_display_resolved_modified_latest.  The booleans
00601  * may not both be true.
00602  *
00603  * @deprecated Provided for backward compatibility with the 1.5 API.
00604  */
00605 SVN_DEPRECATED
00606 svn_error_t *
00607 svn_diff_file_output_merge(svn_stream_t *output_stream,
00608                            svn_diff_t *diff,
00609                            const char *original_path,
00610                            const char *modified_path,
00611                            const char *latest_path,
00612                            const char *conflict_original,
00613                            const char *conflict_modified,
00614                            const char *conflict_latest,
00615                            const char *conflict_separator,
00616                            svn_boolean_t display_original_in_conflict,
00617                            svn_boolean_t display_resolved_conflicts,
00618                            apr_pool_t *pool);
00619 
00620 
00621 
00622 /* Diffs on in-memory structures */
00623 
00624 /** Generate @a diff output from the @a original and @a modified
00625  * in-memory strings.  @a diff will be allocated from @a pool.
00626  *
00627  * @since New in 1.5.
00628  */
00629 svn_error_t *
00630 svn_diff_mem_string_diff(svn_diff_t **diff,
00631                          const svn_string_t *original,
00632                          const svn_string_t *modified,
00633                          const svn_diff_file_options_t *options,
00634                          apr_pool_t *pool);
00635 
00636 
00637 /** Generate @a diff output from the @a orginal, @a modified and @a latest
00638  * in-memory strings.  @a diff will be allocated in @a pool.
00639  *
00640  * @since New in 1.5.
00641  */
00642 svn_error_t *
00643 svn_diff_mem_string_diff3(svn_diff_t **diff,
00644                           const svn_string_t *original,
00645                           const svn_string_t *modified,
00646                           const svn_string_t *latest,
00647                           const svn_diff_file_options_t *options,
00648                           apr_pool_t *pool);
00649 
00650 
00651 /** Generate @a diff output from the @a original, @a modified and @a latest
00652  * in-memory strings, using @a ancestor.  @a diff will be allocated in @a pool.
00653  *
00654  * @since New in 1.5.
00655  */
00656 svn_error_t *
00657 svn_diff_mem_string_diff4(svn_diff_t **diff,
00658                           const svn_string_t *original,
00659                           const svn_string_t *modified,
00660                           const svn_string_t *latest,
00661                           const svn_string_t *ancestor,
00662                           const svn_diff_file_options_t *options,
00663                           apr_pool_t *pool);
00664 
00665 
00666 /** Outputs the @a diff object generated by svn_diff_mem_string_diff()
00667  * in unified diff format on @a output_stream, using @a original
00668  * and @a modified for the text in the output.
00669  * Outputs the header and markers in @a header_encoding.
00670  *
00671  * @a original_header and @a modified header are
00672  * used to fill the field after the "---" and "+++" header markers.
00673  *
00674  * @since New in 1.5.
00675  */
00676 svn_error_t *
00677 svn_diff_mem_string_output_unified(svn_stream_t *output_stream,
00678                                    svn_diff_t *diff,
00679                                    const char *original_header,
00680                                    const char *modified_header,
00681                                    const char *header_encoding,
00682                                    const svn_string_t *original,
00683                                    const svn_string_t *modified,
00684                                    apr_pool_t *pool);
00685 
00686 /** Output the @a diff generated by svn_diff_mem_string_diff3() in diff3
00687  * format on @a output_stream, using @a original, @a modified and @a latest
00688  * for content changes.
00689  *
00690  * Use the conflict markers @a conflict_original, @a conflict_modified,
00691  * @a conflict_latest and @a conflict_separator or the default one for
00692  * each of these if @c NULL is passed.
00693  *
00694  * @a conflict_style dictates how conflicts are displayed.
00695  *
00696  * @since New in 1.6.
00697  */
00698 svn_error_t *
00699 svn_diff_mem_string_output_merge2(svn_stream_t *output_stream,
00700                                   svn_diff_t *diff,
00701                                   const svn_string_t *original,
00702                                   const svn_string_t *modified,
00703                                   const svn_string_t *latest,
00704                                   const char *conflict_original,
00705                                   const char *conflict_modified,
00706                                   const char *conflict_latest,
00707                                   const char *conflict_separator,
00708                                   svn_diff_conflict_display_style_t style,
00709                                   apr_pool_t *pool);
00710 
00711 /** Similar to svn_diff_mem_string_output_merge2, but with @a
00712  * display_original_in_conflict and @a display_resolved_conflicts
00713  * booleans instead of the @a conflict_style enum.
00714  *
00715  * If both booleans are false, acts like
00716  * svn_diff_conflict_display_modified_latest; if @a
00717  * display_original_in_conflict is true, acts like
00718  * svn_diff_conflict_display_modified_original_latest; if @a
00719  * display_resolved_conflicts is true, acts like
00720  * svn_diff_conflict_display_resolved_modified_latest.  The booleans
00721  * may not both be true.
00722  *
00723  * @deprecated Provided for backward compatibility with the 1.5 API.
00724  */
00725 SVN_DEPRECATED
00726 svn_error_t *
00727 svn_diff_mem_string_output_merge(svn_stream_t *output_stream,
00728                                  svn_diff_t *diff,
00729                                  const svn_string_t *original,
00730                                  const svn_string_t *modified,
00731                                  const svn_string_t *latest,
00732                                  const char *conflict_original,
00733                                  const char *conflict_modified,
00734                                  const char *conflict_latest,
00735                                  const char *conflict_separator,
00736                                  svn_boolean_t display_original_in_conflict,
00737                                  svn_boolean_t display_resolved_conflicts,
00738                                  apr_pool_t *pool);
00739 
00740 
00741 #ifdef __cplusplus
00742 }
00743 #endif /* __cplusplus */
00744 
00745 #endif /* SVN_DIFF_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines