svn_diff.h

Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_diff.h
00024  * @brief Contextual diffing.
00025  *
00026  * This is an internalized library for performing contextual diffs
00027  * between sources of data.
00028  *
00029  * @note This is different than Subversion's binary-diffing engine.
00030  * That API lives in @c svn_delta.h -- see the "text deltas" section.  A
00031  * "text delta" is way of representing precise binary diffs between
00032  * strings of data.  The Subversion client and server send text deltas
00033  * to one another during updates and commits.
00034  *
00035  * This API, however, is (or will be) used for performing *contextual*
00036  * merges between files in the working copy.  During an update or
00037  * merge, 3-way file merging is needed.  And 'svn diff' needs to show
00038  * the differences between 2 files.
00039  *
00040  * The nice thing about this API is that it's very general.  It
00041  * operates on any source of data (a "datasource") and calculates
00042  * contextual differences on "tokens" within the data.  In our
00043  * particular usage, the datasources are files and the tokens are
00044  * lines.  But the possibilities are endless.
00045  */
00046 
00047 
00048 #ifndef SVN_DIFF_H
00049 #define SVN_DIFF_H
00050 
00051 #include <apr.h>
00052 #include <apr_pools.h>
00053 #include <apr_tables.h>   /* for apr_array_header_t */
00054 
00055 #include "svn_types.h"
00056 #include "svn_io.h"       /* for svn_stream_t */
00057 #include "svn_string.h"
00058 #include "svn_mergeinfo.h"
00059 
00060 #ifdef __cplusplus
00061 extern "C" {
00062 #endif /* __cplusplus */
00063 
00064 
00065 
00066 /**
00067  * Get libsvn_diff version information.
00068  *
00069  * @since New in 1.1.
00070  */
00071 const svn_version_t *
00072 svn_diff_version(void);
00073 
00074 
00075 /* Diffs. */
00076 
00077 /** An opaque type that represents a difference between either two or
00078  * three datasources.   This object is returned by svn_diff_diff(),
00079  * svn_diff_diff3() and svn_diff_diff4(), and consumed by a number of
00080  * other routines.
00081  */
00082 typedef struct svn_diff_t svn_diff_t;
00083 
00084 /**
00085  * There are four types of datasources.  In GNU diff3 terminology,
00086  * the first three types correspond to the phrases "older", "mine",
00087  * and "yours".
00088  */
00089 typedef enum svn_diff_datasource_e
00090 {
00091   /** The oldest form of the data. */
00092   svn_diff_datasource_original,
00093 
00094   /** The same data, but potentially changed by the user. */
00095   svn_diff_datasource_modified,
00096 
00097   /** The latest version of the data, possibly different than the
00098    * user's modified version.
00099    */
00100   svn_diff_datasource_latest,
00101 
00102   /** The common ancestor of original and modified. */
00103   svn_diff_datasource_ancestor
00104 
00105 } svn_diff_datasource_e;
00106 
00107 
00108 /** A vtable for reading data from the three datasources.
00109  * @since New in 1.7. */
00110 typedef struct svn_diff_fns2_t
00111 {
00112   /** Open the datasources of type @a datasources. */
00113   svn_error_t *(*datasources_open)(void *diff_baton,
00114                                    apr_off_t *prefix_lines,
00115                                    apr_off_t *suffix_lines,
00116                                    const svn_diff_datasource_e *datasources,
00117                                    apr_size_t datasources_len);
00118 
00119   /** Close the datasource of type @a datasource. */
00120   svn_error_t *(*datasource_close)(void *diff_baton,
00121                                    svn_diff_datasource_e datasource);
00122 
00123   /** Get the next "token" from the datasource of type @a datasource.
00124    *  Return a "token" in @a *token.   Return a hash of "token" in @a *hash.
00125    *  Leave @a token and @a hash untouched when the datasource is exhausted.
00126    */
00127   svn_error_t *(*datasource_get_next_token)(apr_uint32_t *hash, void **token,
00128                                             void *diff_baton,
00129                                             svn_diff_datasource_e datasource);
00130 
00131   /** A function for ordering the tokens, resembling 'strcmp' in functionality.
00132    * @a compare should contain the return value of the comparison:
00133    * If @a ltoken and @a rtoken are "equal", return 0.  If @a ltoken is
00134    * "less than" @a rtoken, return a number < 0.  If @a ltoken  is
00135    * "greater than" @a rtoken, return a number > 0.
00136    */
00137   svn_error_t *(*token_compare)(void *diff_baton,
00138                                 void *ltoken,
00139                                 void *rtoken,
00140                                 int *compare);
00141 
00142   /** Free @a token from memory, the diff algorithm is done with it. */
00143   void (*token_discard)(void *diff_baton,
00144                         void *token);
00145 
00146   /** Free *all* tokens from memory, they're no longer needed. */
00147   void (*token_discard_all)(void *diff_baton);
00148 } svn_diff_fns2_t;
00149 
00150 
00151 /** Like #svn_diff_fns2_t except with datasource_open() instead of
00152  * datasources_open().
00153  *
00154  * @deprecated Provided for backward compatibility with the 1.6 API.
00155  */
00156 typedef struct svn_diff_fns_t
00157 {
00158   svn_error_t *(*datasource_open)(void *diff_baton,
00159                                   svn_diff_datasource_e datasource);
00160 
00161   svn_error_t *(*datasource_close)(void *diff_baton,
00162                                    svn_diff_datasource_e datasource);
00163 
00164   svn_error_t *(*datasource_get_next_token)(apr_uint32_t *hash, void **token,
00165                                             void *diff_baton,
00166                                             svn_diff_datasource_e datasource);
00167 
00168   svn_error_t *(*token_compare)(void *diff_baton,
00169                                 void *ltoken,
00170                                 void *rtoken,
00171                                 int *compare);
00172 
00173   void (*token_discard)(void *diff_baton,
00174                         void *token);
00175 
00176   void (*token_discard_all)(void *diff_baton);
00177 } svn_diff_fns_t;
00178 
00179 
00180 /* The Main Events */
00181 
00182 /** Given a vtable of @a diff_fns/@a diff_baton for reading datasources,
00183  * return a diff object in @a *diff that represents a difference between
00184  * an "original" and "modified" datasource.  Do all allocation in @a pool.
00185  *
00186  * @since New in 1.7.
00187  */
00188 svn_error_t *
00189 svn_diff_diff_2(svn_diff_t **diff,
00190                 void *diff_baton,
00191                 const svn_diff_fns2_t *diff_fns,
00192                 apr_pool_t *pool);
00193 
00194 /** Like svn_diff_diff_2() but using #svn_diff_fns_t instead of
00195  * #svn_diff_fns2_t.
00196  *
00197  * @deprecated Provided for backward compatibility with the 1.6 API.
00198  */
00199 SVN_DEPRECATED
00200 svn_error_t *
00201 svn_diff_diff(svn_diff_t **diff,
00202               void *diff_baton,
00203               const svn_diff_fns_t *diff_fns,
00204               apr_pool_t *pool);
00205 
00206 /** Given a vtable of @a diff_fns/@a diff_baton for reading datasources,
00207  * return a diff object in @a *diff that represents a difference between
00208  * three datasources: "original", "modified", and "latest".  Do all
00209  * allocation in @a pool.
00210  *
00211  * @since New in 1.7.
00212  */
00213 svn_error_t *
00214 svn_diff_diff3_2(svn_diff_t **diff,
00215                  void *diff_baton,
00216                  const svn_diff_fns2_t *diff_fns,
00217                  apr_pool_t *pool);
00218 
00219 /** Like svn_diff_diff3_2() but using #svn_diff_fns_t instead of
00220  * #svn_diff_fns2_t.
00221  *
00222  * @deprecated Provided for backward compatibility with the 1.6 API.
00223  */
00224 SVN_DEPRECATED
00225 svn_error_t *
00226 svn_diff_diff3(svn_diff_t **diff,
00227                void *diff_baton,
00228                const svn_diff_fns_t *diff_fns,
00229                apr_pool_t *pool);
00230 
00231 /** Given a vtable of @a diff_fns/@a diff_baton for reading datasources,
00232  * return a diff object in @a *diff that represents a difference between
00233  * two datasources: "original" and "latest", adjusted to become a full
00234  * difference between "original", "modified" and "latest" using "ancestor".
00235  * Do all allocation in @a pool.
00236  *
00237  * @since New in 1.7.
00238  */
00239 svn_error_t *
00240 svn_diff_diff4_2(svn_diff_t **diff,
00241                  void *diff_baton,
00242                  const svn_diff_fns2_t *diff_fns,
00243                  apr_pool_t *pool);
00244 
00245 /** Like svn_diff_diff4_2() but using #svn_diff_fns_t instead of
00246  * #svn_diff_fns2_t.
00247  *
00248  * @deprecated Provided for backward compatibility with the 1.6 API.
00249  */
00250 SVN_DEPRECATED
00251 svn_error_t *
00252 svn_diff_diff4(svn_diff_t **diff,
00253                void *diff_baton,
00254                const svn_diff_fns_t *diff_fns,
00255                apr_pool_t *pool);
00256 
00257 
00258 /* Utility functions */
00259 
00260 /** Determine if a diff object contains conflicts.  If it does, return
00261  * @c TRUE, else return @c FALSE.
00262  */
00263 svn_boolean_t
00264 svn_diff_contains_conflicts(svn_diff_t *diff);
00265 
00266 
00267 /** Determine if a diff object contains actual differences between the
00268  * datasources.  If so, return @c TRUE, else return @c FALSE.
00269  */
00270 svn_boolean_t
00271 svn_diff_contains_diffs(svn_diff_t *diff);
00272 
00273 
00274 
00275 
00276 /* Displaying Diffs */
00277 
00278 /** A vtable for displaying (or consuming) differences between datasources.
00279  *
00280  * Differences, similarities, and conflicts are described by lining up
00281  * "ranges" of data.
00282  *
00283  * Any of the function pointers in this vtable may be NULL to ignore the
00284  * corresponding kinds of output.
00285  *
00286  * @note These callbacks describe data ranges in units of "tokens".
00287  * A "token" is whatever you've defined it to be in your datasource
00288  * @c svn_diff_fns_t vtable.
00289  */
00290 typedef struct svn_diff_output_fns_t
00291 {
00292   /* Two-way and three-way diffs both call the first two output functions: */
00293 
00294   /**
00295    * If doing a two-way diff, then an *identical* data range was found
00296    * between the "original" and "modified" datasources.  Specifically,
00297    * the match starts at @a original_start and goes for @a original_length
00298    * tokens in the original data, and at @a modified_start for
00299    * @a modified_length tokens in the modified data.
00300    *
00301    * If doing a three-way diff, then all three datasources have
00302    * matching data ranges.  The range @a latest_start, @a latest_length in
00303    * the "latest" datasource is identical to the range @a original_start,
00304    * @a original_length in the original data, and is also identical to
00305    * the range @a modified_start, @a modified_length in the modified data.
00306    */
00307   svn_error_t *(*output_common)(void *output_baton,
00308                                 apr_off_t original_start,
00309                                 apr_off_t original_length,
00310                                 apr_off_t modified_start,
00311                                 apr_off_t modified_length,
00312                                 apr_off_t latest_start,
00313                                 apr_off_t latest_length);
00314 
00315   /**
00316    * If doing a two-way diff, then an *conflicting* data range was found
00317    * between the "original" and "modified" datasources.  Specifically,
00318    * the conflict starts at @a original_start and goes for @a original_length
00319    * tokens in the original data, and at @a modified_start for
00320    * @a modified_length tokens in the modified data.
00321    *
00322    * If doing a three-way diff, then an identical data range was discovered
00323    * between the "original" and "latest" datasources, but this conflicts with
00324    * a range in the "modified" datasource.
00325    */
00326   svn_error_t *(*output_diff_modified)(void *output_baton,
00327                                        apr_off_t original_start,
00328                                        apr_off_t original_length,
00329                                        apr_off_t modified_start,
00330                                        apr_off_t modified_length,
00331                                        apr_off_t latest_start,
00332                                        apr_off_t latest_length);
00333 
00334   /* ------ The following callbacks are used by three-way diffs only --- */
00335 
00336   /** An identical data range was discovered between the "original" and
00337    * "modified" datasources, but this conflicts with a range in the
00338    * "latest" datasource.
00339    */
00340   svn_error_t *(*output_diff_latest)(void *output_baton,
00341                                      apr_off_t original_start,
00342                                      apr_off_t original_length,
00343                                      apr_off_t modified_start,
00344                                      apr_off_t modified_length,
00345                                      apr_off_t latest_start,
00346                                      apr_off_t latest_length);
00347 
00348   /** An identical data range was discovered between the "modified" and
00349    * "latest" datasources, but this conflicts with a range in the
00350    * "original" datasource.
00351    */
00352   svn_error_t *(*output_diff_common)(void *output_baton,
00353                                      apr_off_t original_start,
00354                                      apr_off_t original_length,
00355                                      apr_off_t modified_start,
00356                                      apr_off_t modified_length,
00357                                      apr_off_t latest_start,
00358                                      apr_off_t latest_length);
00359 
00360   /** All three datasources have conflicting data ranges.  The range
00361    * @a latest_start, @a latest_length in the "latest" datasource conflicts
00362    * with the range @a original_start, @a original_length in the "original"
00363    * datasource, and also conflicts with the range @a modified_start,
00364    * @a modified_length in the "modified" datasource.
00365    * If there are common ranges in the "modified" and "latest" datasources
00366    * in this conflicting range, @a resolved_diff will contain a diff
00367    * which can be used to retrieve the common and conflicting ranges.
00368    */
00369   svn_error_t *(*output_conflict)(void *output_baton,
00370                                   apr_off_t original_start,
00371                                   apr_off_t original_length,
00372                                   apr_off_t modified_start,
00373                                   apr_off_t modified_length,
00374                                   apr_off_t latest_start,
00375                                   apr_off_t latest_length,
00376                                   svn_diff_t *resolved_diff);
00377 } svn_diff_output_fns_t;
00378 
00379 /** Style for displaying conflicts during diff3 output.
00380  *
00381  * @since New in 1.6.
00382  */
00383 typedef enum svn_diff_conflict_display_style_t
00384 {
00385   /** Display modified and latest, with conflict markers. */
00386   svn_diff_conflict_display_modified_latest,
00387 
00388   /** Like svn_diff_conflict_display_modified_latest, but with an
00389       extra effort to identify common sequences between modified and
00390       latest. */
00391   svn_diff_conflict_display_resolved_modified_latest,
00392 
00393   /** Display modified, original, and latest, with conflict
00394       markers. */
00395   svn_diff_conflict_display_modified_original_latest,
00396 
00397   /** Just display modified, with no markers. */
00398   svn_diff_conflict_display_modified,
00399 
00400   /** Just display latest, with no markers. */
00401   svn_diff_conflict_display_latest,
00402 
00403   /** Like svn_diff_conflict_display_modified_original_latest, but
00404       *only* showing conflicts. */
00405   svn_diff_conflict_display_only_conflicts
00406 
00407   /* IMPORTANT: If you extend this enum note that it is mapped in
00408      tools/diff/diff3.c. */
00409 } svn_diff_conflict_display_style_t;
00410 
00411 
00412 /** Given a vtable of @a output_fns/@a output_baton for consuming
00413  * differences, output the differences in @a diff.
00414  *
00415  * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple
00416  * times while processing larger diffs.
00417  *
00418  * @since New in 1.9.
00419  */
00420 svn_error_t *
00421 svn_diff_output2(svn_diff_t *diff,
00422                  void *output_baton,
00423                  const svn_diff_output_fns_t *output_fns,
00424                  svn_cancel_func_t cancel_func,
00425                  void *cancel_baton);
00426 
00427 /** Similar to svn_diff_output2(), but without cancel support.
00428  *
00429  * @deprecated Provided for backwards compatibility with the 1.8 API.
00430  */
00431 SVN_DEPRECATED
00432 svn_error_t *
00433 svn_diff_output(svn_diff_t *diff,
00434                 void *output_baton,
00435                 const svn_diff_output_fns_t *output_fns);
00436 
00437 
00438 
00439 /* Diffs on files */
00440 
00441 /** To what extent whitespace should be ignored when comparing lines.
00442  *
00443  * @since New in 1.4.
00444  */
00445 typedef enum svn_diff_file_ignore_space_t
00446 {
00447   /** Ignore no whitespace. */
00448   svn_diff_file_ignore_space_none,
00449 
00450   /** Ignore changes in sequences of whitespace characters, treating each
00451    * sequence of whitespace characters as a single space. */
00452   svn_diff_file_ignore_space_change,
00453 
00454   /** Ignore all whitespace characters. */
00455   svn_diff_file_ignore_space_all
00456 } svn_diff_file_ignore_space_t;
00457 
00458 /** Options to control the behaviour of the file diff routines.
00459  *
00460  * @since New in 1.4.
00461  *
00462  * @note This structure may be extended in the future, so to preserve binary
00463  * compatibility, users must not allocate structs of this type themselves.
00464  * @see svn_diff_file_options_create().
00465  *
00466  * @note Although its name suggests otherwise, this structure is used to
00467  *       pass options to file as well as in-memory diff functions.
00468  */
00469 typedef struct svn_diff_file_options_t
00470 {
00471   /** To what extent whitespace should be ignored when comparing lines.
00472    * The default is @c svn_diff_file_ignore_space_none. */
00473   svn_diff_file_ignore_space_t ignore_space;
00474   /** Whether to treat all end-of-line markers the same when comparing lines.
00475    * The default is @c FALSE. */
00476   svn_boolean_t ignore_eol_style;
00477   /** Whether the "@@" lines of the unified diff output should include a prefix
00478     * of the nearest preceding line that starts with a character that might be
00479     * the initial character of a C language identifier.  The default is
00480     * @c FALSE.
00481     * @since New in 1.5.
00482     */
00483   svn_boolean_t show_c_function;
00484 
00485   /** The number of context lines produced above and below modifications, if
00486    * available. The number of context lines must be >= 0.
00487    *
00488    * @since New in 1.9 */
00489   int context_size;
00490 } svn_diff_file_options_t;
00491 
00492 /** Allocate a @c svn_diff_file_options_t structure in @a pool, initializing
00493  * it with default values.
00494  *
00495  * @since New in 1.4.
00496  */
00497 svn_diff_file_options_t *
00498 svn_diff_file_options_create(apr_pool_t *pool);
00499 
00500 /**
00501  * Parse @a args, an array of <tt>const char *</tt> command line switches
00502  * and adjust @a options accordingly.  @a options is assumed to be initialized
00503  * with default values.  @a pool is used for temporary allocation.
00504  *
00505  * @since New in 1.4.
00506  *
00507  * The following options are supported:
00508  * - --ignore-space-change, -b
00509  * - --ignore-all-space, -w
00510  * - --ignore-eol-style
00511  * - --show-c-function, -p @since New in 1.5.
00512  * - --context, -U ARG @since New in 1.9.
00513  * - --unified, -u (for compatibility, does nothing).
00514  */
00515 svn_error_t *
00516 svn_diff_file_options_parse(svn_diff_file_options_t *options,
00517                             const apr_array_header_t *args,
00518                             apr_pool_t *pool);
00519 
00520 
00521 /** A convenience function to produce a diff between two files.
00522  *
00523  * @since New in 1.4.
00524  *
00525  * Return a diff object in @a *diff (allocated from @a pool) that represents
00526  * the difference between an @a original file and @a modified file.
00527  * (The file arguments must be full paths to the files.)
00528  *
00529  * Compare lines according to the relevant fields of @a options.
00530  */
00531 svn_error_t *
00532 svn_diff_file_diff_2(svn_diff_t **diff,
00533                      const char *original,
00534                      const char *modified,
00535                      const svn_diff_file_options_t *options,
00536                      apr_pool_t *pool);
00537 
00538 /** Similar to svn_file_diff_2(), but with @a options set to a struct with
00539  * default options.
00540  *
00541  * @deprecated Provided for backwards compatibility with the 1.3 API.
00542  */
00543 SVN_DEPRECATED
00544 svn_error_t *
00545 svn_diff_file_diff(svn_diff_t **diff,
00546                    const char *original,
00547                    const char *modified,
00548                    apr_pool_t *pool);
00549 
00550 /** A convenience function to produce a diff between three files.
00551  *
00552  * @since New in 1.4.
00553  *
00554  * Return a diff object in @a *diff (allocated from @a pool) that represents
00555  * the difference between an @a original file, @a modified file, and @a latest
00556  * file.
00557  *
00558  * Compare lines according to the relevant fields of @a options.
00559  */
00560 svn_error_t *
00561 svn_diff_file_diff3_2(svn_diff_t **diff,
00562                       const char *original,
00563                       const char *modified,
00564                       const char *latest,
00565                       const svn_diff_file_options_t *options,
00566                       apr_pool_t *pool);
00567 
00568 /** Similar to svn_diff_file_diff3_2(), but with @a options set to a struct
00569  * with default options.
00570  *
00571  * @deprecated Provided for backwards compatibility with the 1.3 API.
00572  */
00573 SVN_DEPRECATED
00574 svn_error_t *
00575 svn_diff_file_diff3(svn_diff_t **diff,
00576                     const char *original,
00577                     const char *modified,
00578                     const char *latest,
00579                     apr_pool_t *pool);
00580 
00581 /** A convenience function to produce a diff between four files.
00582  *
00583  * @since New in 1.4.
00584  *
00585  * Return a diff object in @a *diff (allocated from @a pool) that represents
00586  * the difference between an @a original file, @a modified file, @a latest
00587  * and @a ancestor file. (The file arguments must be full paths to the files.)
00588  *
00589  * Compare lines according to the relevant fields of @a options.
00590  */
00591 svn_error_t *
00592 svn_diff_file_diff4_2(svn_diff_t **diff,
00593                       const char *original,
00594                       const char *modified,
00595                       const char *latest,
00596                       const char *ancestor,
00597                       const svn_diff_file_options_t *options,
00598                       apr_pool_t *pool);
00599 
00600 /** Similar to svn_file_diff4_2(), but with @a options set to a struct with
00601  * default options.
00602  *
00603  * @deprecated Provided for backwards compatibility with the 1.3 API.
00604  */
00605 SVN_DEPRECATED
00606 svn_error_t *
00607 svn_diff_file_diff4(svn_diff_t **diff,
00608                     const char *original,
00609                     const char *modified,
00610                     const char *latest,
00611                     const char *ancestor,
00612                     apr_pool_t *pool);
00613 
00614 /** A convenience function to produce unified diff output from the
00615  * diff generated by svn_diff_file_diff().
00616  *
00617  * Output a @a diff between @a original_path and @a modified_path in unified
00618  * context diff format to @a output_stream.  Optionally supply
00619  * @a original_header and/or @a modified_header to be displayed in the header
00620  * of the output.  If @a original_header or @a modified_header is @c NULL, a
00621  * default header will be displayed, consisting of path and last modified time.
00622  * Output all headers and markers in @a header_encoding.  If @a relative_to_dir
00623  * is not @c NULL, the @a original_path and @a modified_path will have the
00624  * @a relative_to_dir stripped from the front of the respective paths.  If
00625  * @a relative_to_dir is @c NULL, paths will be not be modified.  If
00626  * @a relative_to_dir is not @c NULL but @a relative_to_dir is not a parent
00627  * path of the target, an error is returned. Finally, if @a relative_to_dir
00628  * is a URL, an error will be returned.
00629  *
00630  * If @a context_size is not negative, then this number of context lines
00631  * will be used in the generated diff output. Otherwise the legacy compile
00632  * time default will be used.
00633  *
00634  * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple
00635  * times while processing larger diffs.
00636  *
00637  * @since New in 1.9.
00638  */
00639 svn_error_t *
00640 svn_diff_file_output_unified4(svn_stream_t *output_stream,
00641                               svn_diff_t *diff,
00642                               const char *original_path,
00643                               const char *modified_path,
00644                               const char *original_header,
00645                               const char *modified_header,
00646                               const char *header_encoding,
00647                               const char *relative_to_dir,
00648                               svn_boolean_t show_c_function,
00649                               int context_size,
00650                               svn_cancel_func_t cancel_func,
00651                               void *cancel_baton,
00652                               apr_pool_t *scratch_pool);
00653 
00654 /** Similar to svn_diff_file_output_unified4(), but without cancel
00655  * support and with @a context_size set to -1.
00656  *
00657  * @since New in 1.5.
00658  * @deprecated Provided for backwards compatibility with the 1.8 API.
00659  */
00660 SVN_DEPRECATED
00661 svn_error_t *
00662 svn_diff_file_output_unified3(svn_stream_t *output_stream,
00663                               svn_diff_t *diff,
00664                               const char *original_path,
00665                               const char *modified_path,
00666                               const char *original_header,
00667                               const char *modified_header,
00668                               const char *header_encoding,
00669                               const char *relative_to_dir,
00670                               svn_boolean_t show_c_function,
00671                               apr_pool_t *pool);
00672 
00673 /** Similar to svn_diff_file_output_unified3(), but with @a relative_to_dir
00674  * set to NULL and @a show_c_function to false.
00675  *
00676  * @deprecated Provided for backwards compatibility with the 1.4 API.
00677  */
00678 SVN_DEPRECATED
00679 svn_error_t *
00680 svn_diff_file_output_unified2(svn_stream_t *output_stream,
00681                               svn_diff_t *diff,
00682                               const char *original_path,
00683                               const char *modified_path,
00684                               const char *original_header,
00685                               const char *modified_header,
00686                               const char *header_encoding,
00687                               apr_pool_t *pool);
00688 
00689 /** Similar to svn_diff_file_output_unified2(), but with @a header_encoding
00690  * set to @c APR_LOCALE_CHARSET.
00691  *
00692  * @deprecated Provided for backward compatibility with the 1.2 API.
00693  */
00694 SVN_DEPRECATED
00695 svn_error_t *
00696 svn_diff_file_output_unified(svn_stream_t *output_stream,
00697                              svn_diff_t *diff,
00698                              const char *original_path,
00699                              const char *modified_path,
00700                              const char *original_header,
00701                              const char *modified_header,
00702                              apr_pool_t *pool);
00703 
00704 
00705 /** A convenience function to produce diff3 output from the
00706  * diff generated by svn_diff_file_diff3().
00707  *
00708  * Output a @a diff between @a original_path, @a modified_path and
00709  * @a latest_path in merged format to @a output_stream.  Optionally supply
00710  * @a conflict_modified, @a conflict_original, @a conflict_separator and/or
00711  * @a conflict_latest to be displayed as conflict markers in the output.
00712  * If @a conflict_original, @a conflict_modified, @a conflict_latest and/or
00713  * @a conflict_separator is @c NULL, a default marker will be displayed.
00714  * @a conflict_style dictates how conflicts are displayed. 
00715  * Uses @a scratch_pool for temporary allocations.
00716  *
00717  * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple
00718  * times while processing larger diffs.
00719  *
00720  * @since New in 1.9.
00721  */
00722 svn_error_t *
00723 svn_diff_file_output_merge3(svn_stream_t *output_stream,
00724                             svn_diff_t *diff,
00725                             const char *original_path,
00726                             const char *modified_path,
00727                             const char *latest_path,
00728                             const char *conflict_original,
00729                             const char *conflict_modified,
00730                             const char *conflict_latest,
00731                             const char *conflict_separator,
00732                             svn_diff_conflict_display_style_t conflict_style,
00733                             svn_cancel_func_t cancel_func,
00734                             void *cancel_baton,
00735                             apr_pool_t *scratch_pool);
00736 
00737 /** Similar to svn_diff_file_output_merge3, but without cancel support.
00738  *
00739  * @since New in 1.6.
00740  *
00741  * @deprecated Provided for backward compatibility with the 1.8 API.
00742  */
00743 SVN_DEPRECATED
00744 svn_error_t *
00745 svn_diff_file_output_merge2(svn_stream_t *output_stream,
00746                             svn_diff_t *diff,
00747                             const char *original_path,
00748                             const char *modified_path,
00749                             const char *latest_path,
00750                             const char *conflict_original,
00751                             const char *conflict_modified,
00752                             const char *conflict_latest,
00753                             const char *conflict_separator,
00754                             svn_diff_conflict_display_style_t conflict_style,
00755                             apr_pool_t *pool);
00756 
00757 
00758 /** Similar to svn_diff_file_output_merge2, but with @a
00759  * display_original_in_conflict and @a display_resolved_conflicts
00760  * booleans instead of the @a conflict_style enum.
00761  *
00762  * If both booleans are false, acts like
00763  * svn_diff_conflict_display_modified_latest; if @a
00764  * display_original_in_conflict is true, acts like
00765  * svn_diff_conflict_display_modified_original_latest; if @a
00766  * display_resolved_conflicts is true, acts like
00767  * svn_diff_conflict_display_resolved_modified_latest.  The booleans
00768  * may not both be true.
00769  *
00770  * @deprecated Provided for backward compatibility with the 1.5 API.
00771  */
00772 SVN_DEPRECATED
00773 svn_error_t *
00774 svn_diff_file_output_merge(svn_stream_t *output_stream,
00775                            svn_diff_t *diff,
00776                            const char *original_path,
00777                            const char *modified_path,
00778                            const char *latest_path,
00779                            const char *conflict_original,
00780                            const char *conflict_modified,
00781                            const char *conflict_latest,
00782                            const char *conflict_separator,
00783                            svn_boolean_t display_original_in_conflict,
00784                            svn_boolean_t display_resolved_conflicts,
00785                            apr_pool_t *pool);
00786 
00787 /** Creates a git-like binary diff hunk describing the differences between
00788  * @a original and @a latest. It does this by either producing either the
00789  * literal content of both versions in a compressed format, or by describing
00790  * one way transforms.
00791  *
00792  * Either @a original or @a latest may be NULL to describe that the version
00793  * didn't exist.
00794  *
00795  * Writes the output to @a output_stream.
00796  *
00797  * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple
00798  * times while processing larger diffs.
00799  *
00800  * @since New in 1.9.
00801  */
00802 svn_error_t *
00803 svn_diff_output_binary(svn_stream_t *output_stream,
00804                        svn_stream_t *original,
00805                        svn_stream_t *latest,
00806                        svn_cancel_func_t cancel_func,
00807                        void *cancel_baton,
00808                        apr_pool_t *scratch_pool);
00809 
00810 /* Diffs on in-memory structures */
00811 
00812 /** Generate @a diff output from the @a original and @a modified
00813  * in-memory strings.  @a diff will be allocated from @a pool.
00814  *
00815  * @since New in 1.5.
00816  */
00817 svn_error_t *
00818 svn_diff_mem_string_diff(svn_diff_t **diff,
00819                          const svn_string_t *original,
00820                          const svn_string_t *modified,
00821                          const svn_diff_file_options_t *options,
00822                          apr_pool_t *pool);
00823 
00824 
00825 /** Generate @a diff output from the @a original, @a modified and @a latest
00826  * in-memory strings.  @a diff will be allocated in @a pool.
00827  *
00828  * @since New in 1.5.
00829  */
00830 svn_error_t *
00831 svn_diff_mem_string_diff3(svn_diff_t **diff,
00832                           const svn_string_t *original,
00833                           const svn_string_t *modified,
00834                           const svn_string_t *latest,
00835                           const svn_diff_file_options_t *options,
00836                           apr_pool_t *pool);
00837 
00838 
00839 /** Generate @a diff output from the @a original, @a modified and @a latest
00840  * in-memory strings, using @a ancestor.  @a diff will be allocated in @a pool.
00841  *
00842  * @since New in 1.5.
00843  */
00844 svn_error_t *
00845 svn_diff_mem_string_diff4(svn_diff_t **diff,
00846                           const svn_string_t *original,
00847                           const svn_string_t *modified,
00848                           const svn_string_t *latest,
00849                           const svn_string_t *ancestor,
00850                           const svn_diff_file_options_t *options,
00851                           apr_pool_t *pool);
00852 
00853 /** Outputs the @a diff object generated by svn_diff_mem_string_diff()
00854  * in unified diff format on @a output_stream, using @a original
00855  * and @a modified for the text in the output.
00856  *
00857  * If @a with_diff_header is TRUE, write a diff header ("---" and "+++"
00858  * lines), using @a original_header and @a modified_header to fill the field
00859  * after the "---" and "+++" markers; otherwise @a original_header and
00860  * @a modified_header are ignored and may be NULL.
00861  *
00862  * Outputs the header and hunk delimiters in @a header_encoding.
00863  * A @a hunk_delimiter can optionally be specified.
00864  * If @a hunk_delimiter is NULL, use the default hunk delimiter "@@".
00865  *
00866  * As a special case, if the hunk delimiter is "##", then for an incomplete
00867  * final line use the text "\ No newline at end of property" instead of
00868  * "\ No newline at end of file".
00869  *
00870  * If @a context_size is not negative, then this number of context lines
00871  * will be used in the generated diff output. Otherwise the legacy compile
00872  * time default will be used.
00873  *
00874  * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple
00875  * times while processing larger diffs.
00876  *
00877  * Uses @a scratch_pool for temporary allocations.
00878  *
00879  * @since New in 1.9
00880  */
00881 svn_error_t *
00882 svn_diff_mem_string_output_unified3(svn_stream_t *output_stream,
00883                                     svn_diff_t *diff,
00884                                     svn_boolean_t with_diff_header,
00885                                     const char *hunk_delimiter,
00886                                     const char *original_header,
00887                                     const char *modified_header,
00888                                     const char *header_encoding,
00889                                     const svn_string_t *original,
00890                                     const svn_string_t *modified,
00891                                     int context_size,
00892                                     svn_cancel_func_t cancel_func,
00893                                     void *cancel_baton,
00894                                     apr_pool_t *scratch_pool);
00895 
00896 /** Similar to svn_diff_mem_string_output_unified3() but without
00897  * cancel support and with @a context_size set to -1.
00898  *
00899  * @since New in 1.7. Hunk delimiter "##" has the special meaning since 1.8.
00900  *
00901  * @deprecated Provided for backwards compatibility with the 1.8 API.
00902  */
00903 SVN_DEPRECATED
00904 svn_error_t *
00905 svn_diff_mem_string_output_unified2(svn_stream_t *output_stream,
00906                                     svn_diff_t *diff,
00907                                     svn_boolean_t with_diff_header,
00908                                     const char *hunk_delimiter,
00909                                     const char *original_header,
00910                                     const char *modified_header,
00911                                     const char *header_encoding,
00912                                     const svn_string_t *original,
00913                                     const svn_string_t *modified,
00914                                     apr_pool_t *pool);
00915 
00916 /** Similar to svn_diff_mem_string_output_unified2() but with
00917  * @a with_diff_header always set to TRUE and @a hunk_delimiter always
00918  * set to NULL.
00919  *
00920  * @since New in 1.5.
00921  *
00922  * @deprecated Provided for backwards compatibility with the 1.8 API.
00923  */
00924 SVN_DEPRECATED
00925 svn_error_t *
00926 svn_diff_mem_string_output_unified(svn_stream_t *output_stream,
00927                                    svn_diff_t *diff,
00928                                    const char *original_header,
00929                                    const char *modified_header,
00930                                    const char *header_encoding,
00931                                    const svn_string_t *original,
00932                                    const svn_string_t *modified,
00933                                    apr_pool_t *pool);
00934 
00935 /** Output the @a diff generated by svn_diff_mem_string_diff3() in diff3
00936  * format on @a output_stream, using @a original, @a modified and @a latest
00937  * for content changes.
00938  *
00939  * Use the conflict markers @a conflict_original, @a conflict_modified,
00940  * @a conflict_latest and @a conflict_separator or the default one for
00941  * each of these if @c NULL is passed.
00942  *
00943  * @a conflict_style dictates how conflicts are displayed.
00944  *
00945  * If not @c NULL, call @a cancel_func with @a cancel_baton once or multiple
00946  * times while processing larger diffs.
00947  *
00948  * Uses @a scratch_pool for temporary allocations.
00949  *
00950  * @since New in 1.9.
00951  */
00952 svn_error_t *
00953 svn_diff_mem_string_output_merge3(svn_stream_t *output_stream,
00954                                   svn_diff_t *diff,
00955                                   const svn_string_t *original,
00956                                   const svn_string_t *modified,
00957                                   const svn_string_t *latest,
00958                                   const char *conflict_original,
00959                                   const char *conflict_modified,
00960                                   const char *conflict_latest,
00961                                   const char *conflict_separator,
00962                                   svn_diff_conflict_display_style_t style,
00963                                   svn_cancel_func_t cancel_func,
00964                                   void *cancel_baton,
00965                                   apr_pool_t *scratch_pool);
00966 
00967 /** Similar to svn_diff_mem_string_output_merge2(), but without cancel support.
00968  *
00969  * @since New in 1.6.
00970  *
00971  * @deprecated Provided for backwards compatibility with the 1.8 API.
00972  */
00973 SVN_DEPRECATED
00974 svn_error_t *
00975 svn_diff_mem_string_output_merge2(svn_stream_t *output_stream,
00976                                   svn_diff_t *diff,
00977                                   const svn_string_t *original,
00978                                   const svn_string_t *modified,
00979                                   const svn_string_t *latest,
00980                                   const char *conflict_original,
00981                                   const char *conflict_modified,
00982                                   const char *conflict_latest,
00983                                   const char *conflict_separator,
00984                                   svn_diff_conflict_display_style_t style,
00985                                   apr_pool_t *pool);
00986 
00987 /** Similar to svn_diff_mem_string_output_merge2, but with @a
00988  * display_original_in_conflict and @a display_resolved_conflicts
00989  * booleans instead of the @a conflict_style enum.
00990  *
00991  * If both booleans are false, acts like
00992  * svn_diff_conflict_display_modified_latest; if @a
00993  * display_original_in_conflict is true, acts like
00994  * svn_diff_conflict_display_modified_original_latest; if @a
00995  * display_resolved_conflicts is true, acts like
00996  * svn_diff_conflict_display_resolved_modified_latest.  The booleans
00997  * may not both be true.
00998  *
00999  * @deprecated Provided for backward compatibility with the 1.5 API.
01000  */
01001 SVN_DEPRECATED
01002 svn_error_t *
01003 svn_diff_mem_string_output_merge(svn_stream_t *output_stream,
01004                                  svn_diff_t *diff,
01005                                  const svn_string_t *original,
01006                                  const svn_string_t *modified,
01007                                  const svn_string_t *latest,
01008                                  const char *conflict_original,
01009                                  const char *conflict_modified,
01010                                  const char *conflict_latest,
01011                                  const char *conflict_separator,
01012                                  svn_boolean_t display_original_in_conflict,
01013                                  svn_boolean_t display_resolved_conflicts,
01014                                  apr_pool_t *pool);
01015 
01016 
01017 
01018 /* Diff parsing. If you want to apply a patch to a working copy
01019  * rather than parse it, see svn_client_patch(). */
01020 
01021 /**
01022  * Describes what operation has been performed on a file.
01023  *
01024  * @since New in 1.7.
01025  */
01026 typedef enum svn_diff_operation_kind_e
01027 {
01028   svn_diff_op_unchanged,
01029   svn_diff_op_added,
01030   svn_diff_op_deleted,
01031   svn_diff_op_copied,
01032   svn_diff_op_moved,
01033   /* There's no tree changes, just text modifications. */
01034   svn_diff_op_modified
01035 } svn_diff_operation_kind_t;
01036 
01037 /**
01038  * A single hunk inside a patch.
01039  *
01040  * The lines of text comprising the hunk can be interpreted in three ways:
01041  *   - diff text       The hunk as it appears in the unidiff patch file,
01042  *                     including the hunk header line ("@@ ... @@")
01043  *   - original text   The text the patch was based on.
01044  *   - modified text   The result of patching the original text.
01045  *
01046  * For example, consider a hunk with the following diff text:
01047  *
01048  * @verbatim
01049      @@ -1,5 +1,5 @@
01050       #include <stdio.h>
01051       int main(int argc, char *argv[]) {
01052      -        printf("Hello World!\n");
01053      +        printf("I like Subversion!\n");
01054       } @endverbatim
01055  *
01056  * The original text of this hunk is:
01057  *
01058  * @verbatim
01059      #include <stdio.h>
01060      int main(int argc, char *argv[]) {
01061              printf("Hello World!\n");
01062      } @endverbatim
01063  *
01064  * And the modified text is:
01065  *
01066  * @verbatim
01067      #include <stdio.h>
01068      int main(int argc, char *argv[]) {
01069              printf("I like Subversion!\n");
01070      } @endverbatim
01071  *
01072  * @see svn_diff_hunk_readline_diff_text()
01073  * @see svn_diff_hunk_readline_original_text()
01074  * @see svn_diff_hunk_readline_modified_text()
01075  *
01076  * @since New in 1.7. */
01077 typedef struct svn_diff_hunk_t svn_diff_hunk_t;
01078 
01079 /**
01080  * Allocate @a *stringbuf in @a result_pool, and read into it one line
01081  * of the diff text of @a hunk. The hunk header is not returned only the
01082  * unidiff data lines (starting with '+', '-', or ' ') are returned.
01083  * If the @a hunk is being interpreted in reverse (i.e. the reverse
01084  * parameter of svn_diff_parse_next_patch() was @c TRUE), the diff
01085  * text will be returned in reversed form.
01086  * The line-terminator is detected automatically and stored in @a *eol
01087  * if @a eol is not NULL.
01088  * If EOF is reached, set @a *eof to TRUE, and set @a *eol to NULL if the
01089  * hunk does not end with a newline character and @a eol is not NULL.
01090  * Temporary allocations will be performed in @a scratch_pool.
01091  *
01092  * @note The hunk header information can be retrieved with the following
01093  * functions:
01094  * @see svn_diff_hunk_get_original_start()
01095  * @see svn_diff_hunk_get_original_length()
01096  * @see svn_diff_hunk_get_modified_start()
01097  * @see svn_diff_hunk_get_modified_length()
01098  *
01099  * @since New in 1.7.
01100  */
01101 svn_error_t *
01102 svn_diff_hunk_readline_diff_text(svn_diff_hunk_t *hunk,
01103                                  svn_stringbuf_t **stringbuf,
01104                                  const char **eol,
01105                                  svn_boolean_t *eof,
01106                                  apr_pool_t *result_pool,
01107                                  apr_pool_t *scratch_pool);
01108 
01109 /**
01110  * Allocate @a *stringbuf in @a result_pool, and read into it one line
01111  * of the original text of @a hunk.
01112  * The line-terminator is detected automatically and stored in @a *eol
01113  * if @a eol is not NULL.
01114  * If EOF is reached, set @a *eof to TRUE, and set @a *eol to NULL if the
01115  * hunk text does not end with a newline character and @a eol is not NULL.
01116  * Temporary allocations will be performed in @a scratch_pool.
01117  *
01118  * @see svn_diff_hunk_t
01119  * @since New in 1.7.
01120  */
01121 svn_error_t *
01122 svn_diff_hunk_readline_original_text(svn_diff_hunk_t *hunk,
01123                                      svn_stringbuf_t **stringbuf,
01124                                      const char **eol,
01125                                      svn_boolean_t *eof,
01126                                      apr_pool_t *result_pool,
01127                                      apr_pool_t *scratch_pool);
01128 
01129 /**
01130  * Like svn_diff_hunk_readline_original_text(), but it returns lines from
01131  * the modified text of the hunk.
01132  *
01133  * @see svn_diff_hunk_t
01134  * @since New in 1.7.
01135  */
01136 svn_error_t *
01137 svn_diff_hunk_readline_modified_text(svn_diff_hunk_t *hunk,
01138                                      svn_stringbuf_t **stringbuf,
01139                                      const char **eol,
01140                                      svn_boolean_t *eof,
01141                                      apr_pool_t *result_pool,
01142                                      apr_pool_t *scratch_pool);
01143 
01144 /** Reset the diff text of @a hunk so it can be read again from the start.
01145  * @since New in 1.7. */
01146 void
01147 svn_diff_hunk_reset_diff_text(svn_diff_hunk_t *hunk);
01148 
01149 /** Reset the original text of @a hunk so it can be read again from the start.
01150  * @since New in 1.7. */
01151 void
01152 svn_diff_hunk_reset_original_text(svn_diff_hunk_t *hunk);
01153 
01154 /** Reset the modified text of @a hunk so it can be read again from the start.
01155  * @since New in 1.7. */
01156 void
01157 svn_diff_hunk_reset_modified_text(svn_diff_hunk_t *hunk);
01158 
01159 /** Return the line offset of the original hunk text,
01160  * as parsed from the hunk header.
01161  * @since New in 1.7. */
01162 svn_linenum_t
01163 svn_diff_hunk_get_original_start(const svn_diff_hunk_t *hunk);
01164 
01165 /** Return the number of lines in the original @a hunk text,
01166  * as parsed from the hunk header.
01167  * @since New in 1.7. */
01168 svn_linenum_t
01169 svn_diff_hunk_get_original_length(const svn_diff_hunk_t *hunk);
01170 
01171 /** Return the line offset of the modified @a hunk text,
01172  * as parsed from the hunk header.
01173  * @since New in 1.7. */
01174 svn_linenum_t
01175 svn_diff_hunk_get_modified_start(const svn_diff_hunk_t *hunk);
01176 
01177 /** Return the number of lines in the modified @a hunk text,
01178  * as parsed from the hunk header.
01179  * @since New in 1.7. */
01180 svn_linenum_t
01181 svn_diff_hunk_get_modified_length(const svn_diff_hunk_t *hunk);
01182 
01183 /** Return the number of lines of leading context of @a hunk,
01184  * i.e. the number of lines starting with ' ' before the first line
01185  * that starts with a '+' or '-'.
01186  * @since New in 1.7. */
01187 svn_linenum_t
01188 svn_diff_hunk_get_leading_context(const svn_diff_hunk_t *hunk);
01189 
01190 /** Return the number of lines of trailing context of @a hunk,
01191  * i.e. the number of lines starting with ' ' after the last line
01192  * that starts with a '+' or '-'.
01193  * @since New in 1.7. */
01194 svn_linenum_t
01195 svn_diff_hunk_get_trailing_context(const svn_diff_hunk_t *hunk);
01196 
01197 /**
01198  * Data type to manage parsing of properties in patches.
01199  * API users should not allocate structures of this type directly.
01200  *
01201  * @since New in 1.7. */
01202 typedef struct svn_prop_patch_t {
01203   const char *name;
01204 
01205   /** Represents the operation performed on the property */
01206   svn_diff_operation_kind_t operation;
01207 
01208   /**
01209    * An array containing an svn_diff_hunk_t object for each hunk parsed
01210    * from the patch associated with our property name */
01211   apr_array_header_t *hunks;
01212 } svn_prop_patch_t;
01213 
01214 /**
01215  * Data type to manage parsing of patches.
01216  * API users should not allocate structures of this type directly.
01217  *
01218  * @since New in 1.7. */
01219 typedef struct svn_patch_t {
01220   /**
01221    * The old and new file names as retrieved from the patch file.
01222    * These paths are UTF-8 encoded and canonicalized, but otherwise
01223    * left unchanged from how they appeared in the patch file. */
01224   const char *old_filename;
01225   const char *new_filename;
01226 
01227   /**
01228    * An array containing an svn_diff_hunk_t * for each hunk parsed
01229    * from the patch. */
01230   apr_array_header_t *hunks;
01231 
01232   /**
01233    * A hash table keyed by property names containing svn_prop_patch_t
01234    * object for each property parsed from the patch. */
01235   apr_hash_t *prop_patches;
01236 
01237   /**
01238    * Represents the operation performed on the file. */
01239   svn_diff_operation_kind_t operation;
01240 
01241   /**
01242    * Indicates whether the patch is being interpreted in reverse. */
01243   svn_boolean_t reverse;
01244 
01245   /**
01246    * Mergeinfo parsed from svn:mergeinfo diff data, with one entry for
01247    * forward merges and one for reverse merges.
01248    * Either entry can be @c NULL if no such merges are part of the diff.
01249    * @since New in 1.9. */
01250   svn_mergeinfo_t mergeinfo;
01251   svn_mergeinfo_t reverse_mergeinfo;
01252 } svn_patch_t;
01253 
01254 /** An opaque type representing an open patch file.
01255  *
01256  * @since New in 1.7. */
01257 typedef struct svn_patch_file_t svn_patch_file_t;
01258 
01259 /** Open @a patch_file at @a local_abspath.
01260  * Allocate @a patch_file in @a result_pool.
01261  *
01262  * @since New in 1.7. */
01263 svn_error_t *
01264 svn_diff_open_patch_file(svn_patch_file_t **patch_file,
01265                          const char *local_abspath,
01266                          apr_pool_t *result_pool);
01267 
01268 /**
01269  * Return the next @a *patch in @a patch_file.
01270  * If no patch can be found, set @a *patch to NULL.
01271  * If @a reverse is TRUE, invert the patch while parsing it.
01272  * If @a ignore_whitespace is TRUE, allow patches with no leading
01273  * whitespace to be parsed.
01274  * Allocate results in @a result_pool.
01275  * Use @a scratch_pool for all other allocations.
01276  *
01277  * @since New in 1.7. */
01278 svn_error_t *
01279 svn_diff_parse_next_patch(svn_patch_t **patch,
01280                           svn_patch_file_t *patch_file,
01281                           svn_boolean_t reverse,
01282                           svn_boolean_t ignore_whitespace,
01283                           apr_pool_t *result_pool,
01284                           apr_pool_t *scratch_pool);
01285 
01286 /**
01287  * Dispose of @a patch_file.
01288  * Use @a scratch_pool for all temporary allocations.
01289  *
01290  * @since New in 1.7.
01291  */
01292 svn_error_t *
01293 svn_diff_close_patch_file(svn_patch_file_t *patch_file,
01294                           apr_pool_t *scratch_pool);
01295 
01296 #ifdef __cplusplus
01297 }
01298 #endif /* __cplusplus */
01299 
01300 #endif /* SVN_DIFF_H */

Generated on Mon Jun 1 14:45:53 2015 for Subversion by  doxygen 1.4.7