52 #include <apr_pools.h>
53 #include <apr_tables.h>
114 apr_off_t *prefix_lines,
115 apr_off_t *suffix_lines,
117 apr_size_t datasources_len);
127 svn_error_t *(*datasource_get_next_token)(apr_uint32_t *hash,
void **token,
164 svn_error_t *(*datasource_get_next_token)(apr_uint32_t *hash,
void **token,
173 void (*token_discard)(
void *diff_baton,
176 void (*token_discard_all)(
void *diff_baton);
308 apr_off_t original_start,
309 apr_off_t original_length,
310 apr_off_t modified_start,
311 apr_off_t modified_length,
312 apr_off_t latest_start,
313 apr_off_t latest_length);
327 apr_off_t original_start,
328 apr_off_t original_length,
329 apr_off_t modified_start,
330 apr_off_t modified_length,
331 apr_off_t latest_start,
332 apr_off_t latest_length);
341 apr_off_t original_start,
342 apr_off_t original_length,
343 apr_off_t modified_start,
344 apr_off_t modified_length,
345 apr_off_t latest_start,
346 apr_off_t latest_length);
353 apr_off_t original_start,
354 apr_off_t original_length,
355 apr_off_t modified_start,
356 apr_off_t modified_length,
357 apr_off_t latest_start,
358 apr_off_t latest_length);
370 apr_off_t original_start,
371 apr_off_t original_length,
372 apr_off_t modified_start,
373 apr_off_t modified_length,
374 apr_off_t latest_start,
375 apr_off_t latest_length,
517 const apr_array_header_t *args,
533 const char *original,
534 const char *modified,
546 const char *original,
547 const char *modified,
562 const char *original,
563 const char *modified,
576 const char *original,
577 const char *modified,
593 const char *original,
594 const char *modified,
596 const char *ancestor,
608 const char *original,
609 const char *modified,
611 const char *ancestor,
642 const char *original_path,
643 const char *modified_path,
644 const char *original_header,
645 const char *modified_header,
646 const char *header_encoding,
647 const char *relative_to_dir,
652 apr_pool_t *scratch_pool);
664 const char *original_path,
665 const char *modified_path,
666 const char *original_header,
667 const char *modified_header,
668 const char *header_encoding,
669 const char *relative_to_dir,
682 const char *original_path,
683 const char *modified_path,
684 const char *original_header,
685 const char *modified_header,
686 const char *header_encoding,
698 const char *original_path,
699 const char *modified_path,
700 const char *original_header,
701 const char *modified_header,
725 const char *original_path,
726 const char *modified_path,
727 const char *latest_path,
728 const char *conflict_original,
729 const char *conflict_modified,
730 const char *conflict_latest,
731 const char *conflict_separator,
735 apr_pool_t *scratch_pool);
747 const char *original_path,
748 const char *modified_path,
749 const char *latest_path,
750 const char *conflict_original,
751 const char *conflict_modified,
752 const char *conflict_latest,
753 const char *conflict_separator,
776 const char *original_path,
777 const char *modified_path,
778 const char *latest_path,
779 const char *conflict_original,
780 const char *conflict_modified,
781 const char *conflict_latest,
782 const char *conflict_separator,
808 apr_pool_t *scratch_pool);
885 const char *hunk_delimiter,
886 const char *original_header,
887 const char *modified_header,
888 const char *header_encoding,
894 apr_pool_t *scratch_pool);
908 const char *hunk_delimiter,
909 const char *original_header,
910 const char *modified_header,
911 const char *header_encoding,
928 const char *original_header,
929 const char *modified_header,
930 const char *header_encoding,
958 const char *conflict_original,
959 const char *conflict_modified,
960 const char *conflict_latest,
961 const char *conflict_separator,
965 apr_pool_t *scratch_pool);
980 const char *conflict_original,
981 const char *conflict_modified,
982 const char *conflict_latest,
983 const char *conflict_separator,
1008 const char *conflict_original,
1009 const char *conflict_modified,
1010 const char *conflict_latest,
1011 const char *conflict_separator,
1028 svn_diff_op_unchanged,
1030 svn_diff_op_deleted,
1034 svn_diff_op_modified
1106 apr_pool_t *result_pool,
1107 apr_pool_t *scratch_pool);
1126 apr_pool_t *result_pool,
1127 apr_pool_t *scratch_pool);
1141 apr_pool_t *result_pool,
1142 apr_pool_t *scratch_pool);
1225 const char *new_filename;
1265 const char *local_abspath,
1266 apr_pool_t *result_pool);
1283 apr_pool_t *result_pool,
1284 apr_pool_t *scratch_pool);
1294 apr_pool_t *scratch_pool);
Options to control the behaviour of the file diff routines.
svn_error_t * svn_diff_open_patch_file(svn_patch_file_t **patch_file, const char *local_abspath, apr_pool_t *result_pool)
Open patch_file at local_abspath.
svn_error_t * svn_diff_output2(svn_diff_t *diff, void *output_baton, const svn_diff_output_fns_t *output_fns, svn_cancel_func_t cancel_func, void *cancel_baton)
Given a vtable of output_fns/output_baton for consuming differences, output the differences in diff...
Counted-length strings for Subversion, plus some C string goodies.
struct svn_diff_fns2_t svn_diff_fns2_t
A vtable for reading data from the three datasources.
svn_error_t * svn_diff_hunk_readline_diff_text(svn_diff_hunk_t *hunk, svn_stringbuf_t **stringbuf, const char **eol, svn_boolean_t *eof, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Allocate *stringbuf in result_pool, and read into it one line of the diff text of hunk...
int context_size
The number of context lines produced above and below modifications, if available. ...
A vtable for displaying (or consuming) differences between datasources.
svn_error_t * svn_diff_mem_string_diff(svn_diff_t **diff, const svn_string_t *original, const svn_string_t *modified, const svn_diff_file_options_t *options, apr_pool_t *pool)
Generate diff output from the original and modified in-memory strings.
svn_linenum_t svn_diff_hunk_get_original_length(const svn_diff_hunk_t *hunk)
Return the number of lines in the original hunk text, as parsed from the hunk header.
struct svn_prop_patch_t svn_prop_patch_t
Data type to manage parsing of properties in patches.
svn_linenum_t svn_diff_hunk_get_trailing_context(const svn_diff_hunk_t *hunk)
Return the number of lines of trailing context of hunk, i.e.
svn_error_t * svn_diff_diff_2(svn_diff_t **diff, void *diff_baton, const svn_diff_fns2_t *diff_fns, apr_pool_t *pool)
Given a vtable of diff_fns/diff_baton for reading datasources, return a diff object in *diff that rep...
Ignore changes in sequences of whitespace characters, treating each sequence of whitespace characters...
svn_boolean_t ignore_eol_style
Whether to treat all end-of-line markers the same when comparing lines.
struct svn_diff_t svn_diff_t
An opaque type that represents a difference between either two or three datasources.
apr_hash_t * svn_mergeinfo_t
A hash mapping merge source paths to non-empty rangelist arrays.
svn_error_t * svn_diff_diff4_2(svn_diff_t **diff, void *diff_baton, const svn_diff_fns2_t *diff_fns, apr_pool_t *pool)
Given a vtable of diff_fns/diff_baton for reading datasources, return a diff object in *diff that rep...
svn_error_t * svn_diff_mem_string_output_unified3(svn_stream_t *output_stream, svn_diff_t *diff, svn_boolean_t with_diff_header, const char *hunk_delimiter, const char *original_header, const char *modified_header, const char *header_encoding, const svn_string_t *original, const svn_string_t *modified, int context_size, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *scratch_pool)
Outputs the diff object generated by svn_diff_mem_string_diff() in unified diff format on output_stre...
svn_error_t * svn_diff_file_options_parse(svn_diff_file_options_t *options, const apr_array_header_t *args, apr_pool_t *pool)
Parse args, an array of const char * command line switches and adjust options accordingly.
svn_linenum_t svn_diff_hunk_get_modified_start(const svn_diff_hunk_t *hunk)
Return the line offset of the modified hunk text, as parsed from the hunk header. ...
svn_boolean_t show_c_function
Whether the "@@" lines of the unified diff output should include a prefix of the nearest preceding li...
svn_error_t * svn_diff_diff(svn_diff_t **diff, void *diff_baton, const svn_diff_fns_t *diff_fns, apr_pool_t *pool)
Like svn_diff_diff_2() but using svn_diff_fns_t instead of svn_diff_fns2_t.
const char * old_filename
The old and new file names as retrieved from the patch file.
Display modified and latest, with conflict markers.
svn_boolean_t reverse
Indicates whether the patch is being interpreted in reverse.
Display modified, original, and latest, with conflict markers.
General file I/O for Subversion.
svn_diff_file_ignore_space_t ignore_space
To what extent whitespace should be ignored when comparing lines.
struct svn_diff_output_fns_t svn_diff_output_fns_t
A vtable for displaying (or consuming) differences between datasources.
svn_error_t * svn_diff_file_output_merge3(svn_stream_t *output_stream, svn_diff_t *diff, const char *original_path, const char *modified_path, const char *latest_path, const char *conflict_original, const char *conflict_modified, const char *conflict_latest, const char *conflict_separator, svn_diff_conflict_display_style_t conflict_style, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *scratch_pool)
A convenience function to produce diff3 output from the diff generated by svn_diff_file_diff3().
Data type to manage parsing of patches.
svn_diff_datasource_e
There are four types of datasources.
svn_error_t * svn_diff_mem_string_output_merge(svn_stream_t *output_stream, svn_diff_t *diff, const svn_string_t *original, const svn_string_t *modified, const svn_string_t *latest, const char *conflict_original, const char *conflict_modified, const char *conflict_latest, const char *conflict_separator, svn_boolean_t display_original_in_conflict, svn_boolean_t display_resolved_conflicts, apr_pool_t *pool)
Similar to svn_diff_mem_string_output_merge2, but with display_original_in_conflict and display_resol...
Just display modified, with no markers.
void(* token_discard_all)(void *diff_baton)
Free all tokens from memory, they're no longer needed.
The common ancestor of original and modified.
svn_mergeinfo_t mergeinfo
Mergeinfo parsed from svn:mergeinfo diff data, with one entry for forward merges and one for reverse ...
svn_error_t * svn_diff_file_output_unified3(svn_stream_t *output_stream, svn_diff_t *diff, const char *original_path, const char *modified_path, const char *original_header, const char *modified_header, const char *header_encoding, const char *relative_to_dir, svn_boolean_t show_c_function, apr_pool_t *pool)
Similar to svn_diff_file_output_unified4(), but without cancel support and with context_size set to -...
svn_error_t * svn_diff_file_output_merge2(svn_stream_t *output_stream, svn_diff_t *diff, const char *original_path, const char *modified_path, const char *latest_path, const char *conflict_original, const char *conflict_modified, const char *conflict_latest, const char *conflict_separator, svn_diff_conflict_display_style_t conflict_style, apr_pool_t *pool)
Similar to svn_diff_file_output_merge3, but without cancel support.
struct svn_patch_t svn_patch_t
Data type to manage parsing of patches.
apr_hash_t * prop_patches
A hash table keyed by property names containing svn_prop_patch_t object for each property parsed from...
void svn_diff_hunk_reset_modified_text(svn_diff_hunk_t *hunk)
Reset the modified text of hunk so it can be read again from the start.
svn_error_t * svn_diff_hunk_readline_original_text(svn_diff_hunk_t *hunk, svn_stringbuf_t **stringbuf, const char **eol, svn_boolean_t *eof, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Allocate *stringbuf in result_pool, and read into it one line of the original text of hunk...
apr_array_header_t * hunks
An array containing an svn_diff_hunk_t * for each hunk parsed from the patch.
const svn_version_t * svn_diff_version(void)
Get libsvn_diff version information.
struct svn_diff_file_options_t svn_diff_file_options_t
Options to control the behaviour of the file diff routines.
A vtable for reading data from the three datasources.
svn_error_t * svn_diff_file_output_unified(svn_stream_t *output_stream, svn_diff_t *diff, const char *original_path, const char *modified_path, const char *original_header, const char *modified_header, apr_pool_t *pool)
Similar to svn_diff_file_output_unified2(), but with header_encoding set to APR_LOCALE_CHARSET.
svn_error_t * svn_diff_mem_string_output_unified(svn_stream_t *output_stream, svn_diff_t *diff, const char *original_header, const char *modified_header, const char *header_encoding, const svn_string_t *original, const svn_string_t *modified, apr_pool_t *pool)
Similar to svn_diff_mem_string_output_unified2() but with with_diff_header always set to TRUE and hun...
svn_diff_file_ignore_space_t
To what extent whitespace should be ignored when comparing lines.
void(* token_discard)(void *diff_baton, void *token)
Free token from memory, the diff algorithm is done with it.
struct svn_diff_fns_t svn_diff_fns_t
Like svn_diff_fns2_t except with datasource_open() instead of datasources_open(). ...
void svn_diff_hunk_reset_original_text(svn_diff_hunk_t *hunk)
Reset the original text of hunk so it can be read again from the start.
struct svn_patch_file_t svn_patch_file_t
An opaque type representing an open patch file.
svn_boolean_t svn_diff_contains_conflicts(svn_diff_t *diff)
Determine if a diff object contains conflicts.
enum svn_diff_operation_kind_e svn_diff_operation_kind_t
Describes what operation has been performed on a file.
The latest version of the data, possibly different than the user's modified version.
svn_error_t * svn_diff_diff3(svn_diff_t **diff, void *diff_baton, const svn_diff_fns_t *diff_fns, apr_pool_t *pool)
Like svn_diff_diff3_2() but using svn_diff_fns_t instead of svn_diff_fns2_t.
svn_error_t * svn_diff_mem_string_diff3(svn_diff_t **diff, const svn_string_t *original, const svn_string_t *modified, const svn_string_t *latest, const svn_diff_file_options_t *options, apr_pool_t *pool)
Generate diff output from the original, modified and latest in-memory strings.
svn_error_t * svn_diff_mem_string_output_merge2(svn_stream_t *output_stream, svn_diff_t *diff, const svn_string_t *original, const svn_string_t *modified, const svn_string_t *latest, const char *conflict_original, const char *conflict_modified, const char *conflict_latest, const char *conflict_separator, svn_diff_conflict_display_style_t style, apr_pool_t *pool)
Similar to svn_diff_mem_string_output_merge2(), but without cancel support.
svn_error_t * svn_diff_file_diff(svn_diff_t **diff, const char *original, const char *modified, apr_pool_t *pool)
Similar to svn_file_diff_2(), but with options set to a struct with default options.
svn_error_t * svn_diff_mem_string_output_merge3(svn_stream_t *output_stream, svn_diff_t *diff, const svn_string_t *original, const svn_string_t *modified, const svn_string_t *latest, const char *conflict_original, const char *conflict_modified, const char *conflict_latest, const char *conflict_separator, svn_diff_conflict_display_style_t style, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *scratch_pool)
Output the diff generated by svn_diff_mem_string_diff3() in diff3 format on output_stream, using original, modified and latest for content changes.
svn_error_t * svn_diff_file_diff_2(svn_diff_t **diff, const char *original, const char *modified, const svn_diff_file_options_t *options, apr_pool_t *pool)
A convenience function to produce a diff between two files.
unsigned long svn_linenum_t
A line number, such as in a file or a stream.
svn_error_t * svn_diff_diff3_2(svn_diff_t **diff, void *diff_baton, const svn_diff_fns2_t *diff_fns, apr_pool_t *pool)
Given a vtable of diff_fns/diff_baton for reading datasources, return a diff object in *diff that rep...
svn_linenum_t svn_diff_hunk_get_original_start(const svn_diff_hunk_t *hunk)
Return the line offset of the original hunk text, as parsed from the hunk header. ...
Just display latest, with no markers.
struct svn_stream_t svn_stream_t
An abstract stream of bytes–either incoming or outgoing or both.
svn_diff_operation_kind_e
Describes what operation has been performed on a file.
svn_error_t * svn_diff_output(svn_diff_t *diff, void *output_baton, const svn_diff_output_fns_t *output_fns)
Similar to svn_diff_output2(), but without cancel support.
Subversion's data types.
svn_error_t * svn_diff_file_output_unified4(svn_stream_t *output_stream, svn_diff_t *diff, const char *original_path, const char *modified_path, const char *original_header, const char *modified_header, const char *header_encoding, const char *relative_to_dir, svn_boolean_t show_c_function, int context_size, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *scratch_pool)
A convenience function to produce unified diff output from the diff generated by svn_diff_file_diff()...
svn_linenum_t svn_diff_hunk_get_leading_context(const svn_diff_hunk_t *hunk)
Return the number of lines of leading context of hunk, i.e.
svn_error_t * svn_diff_output_binary(svn_stream_t *output_stream, svn_stream_t *original, svn_stream_t *latest, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *scratch_pool)
Creates a git-like binary diff hunk describing the differences between original and latest...
svn_error_t * svn_diff_close_patch_file(svn_patch_file_t *patch_file, apr_pool_t *scratch_pool)
Dispose of patch_file.
struct svn_diff_hunk_t svn_diff_hunk_t
A single hunk inside a patch.
svn_error_t * svn_diff_file_output_merge(svn_stream_t *output_stream, svn_diff_t *diff, const char *original_path, const char *modified_path, const char *latest_path, const char *conflict_original, const char *conflict_modified, const char *conflict_latest, const char *conflict_separator, svn_boolean_t display_original_in_conflict, svn_boolean_t display_resolved_conflicts, apr_pool_t *pool)
Similar to svn_diff_file_output_merge2, but with display_original_in_conflict and display_resolved_co...
Like svn_diff_conflict_display_modified_latest, but with an extra effort to identify common sequences...
svn_error_t * svn_diff_mem_string_diff4(svn_diff_t **diff, const svn_string_t *original, const svn_string_t *modified, const svn_string_t *latest, const svn_string_t *ancestor, const svn_diff_file_options_t *options, apr_pool_t *pool)
Generate diff output from the original, modified and latest in-memory strings, using ancestor...
#define SVN_DEPRECATED
Macro used to mark deprecated functions.
Data type to manage parsing of properties in patches.
svn_error_t * svn_diff_file_diff3_2(svn_diff_t **diff, const char *original, const char *modified, const char *latest, const svn_diff_file_options_t *options, apr_pool_t *pool)
A convenience function to produce a diff between three files.
svn_diff_file_options_t * svn_diff_file_options_create(apr_pool_t *pool)
Allocate a svn_diff_file_options_t structure in pool, initializing it with default values...
svn_boolean_t svn_diff_contains_diffs(svn_diff_t *diff)
Determine if a diff object contains actual differences between the datasources.
svn_error_t * svn_diff_hunk_readline_modified_text(svn_diff_hunk_t *hunk, svn_stringbuf_t **stringbuf, const char **eol, svn_boolean_t *eof, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Like svn_diff_hunk_readline_original_text(), but it returns lines from the modified text of the hunk...
svn_error_t * svn_diff_file_output_unified2(svn_stream_t *output_stream, svn_diff_t *diff, const char *original_path, const char *modified_path, const char *original_header, const char *modified_header, const char *header_encoding, apr_pool_t *pool)
Similar to svn_diff_file_output_unified3(), but with relative_to_dir set to NULL and show_c_function ...
Like svn_diff_fns2_t except with datasource_open() instead of datasources_open(). ...
svn_error_t * svn_diff_file_diff4_2(svn_diff_t **diff, const char *original, const char *modified, const char *latest, const char *ancestor, const svn_diff_file_options_t *options, apr_pool_t *pool)
A convenience function to produce a diff between four files.
Like svn_diff_conflict_display_modified_original_latest, but only* showing conflicts.
svn_error_t *(* svn_cancel_func_t)(void *cancel_baton)
A user defined callback that subversion will call with a user defined baton to see if the current ope...
svn_error_t * svn_diff_mem_string_output_unified2(svn_stream_t *output_stream, svn_diff_t *diff, svn_boolean_t with_diff_header, const char *hunk_delimiter, const char *original_header, const char *modified_header, const char *header_encoding, const svn_string_t *original, const svn_string_t *modified, apr_pool_t *pool)
Similar to svn_diff_mem_string_output_unified3() but without cancel support and with context_size set...
Ignore all whitespace characters.
svn_diff_operation_kind_t operation
Represents the operation performed on the property.
void svn_diff_hunk_reset_diff_text(svn_diff_hunk_t *hunk)
Reset the diff text of hunk so it can be read again from the start.
svn_linenum_t svn_diff_hunk_get_modified_length(const svn_diff_hunk_t *hunk)
Return the number of lines in the modified hunk text, as parsed from the hunk header.
The oldest form of the data.
svn_error_t * svn_diff_file_diff4(svn_diff_t **diff, const char *original, const char *modified, const char *latest, const char *ancestor, apr_pool_t *pool)
Similar to svn_file_diff4_2(), but with options set to a struct with default options.
svn_error_t * svn_diff_parse_next_patch(svn_patch_t **patch, svn_patch_file_t *patch_file, svn_boolean_t reverse, svn_boolean_t ignore_whitespace, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Return the next *patch in patch_file.
int svn_boolean_t
YABT: Yet Another Boolean Type.
apr_array_header_t * hunks
An array containing an svn_diff_hunk_t object for each hunk parsed from the patch associated with our...
mergeinfo handling and processing
The same data, but potentially changed by the user.
svn_error_t * svn_diff_file_diff3(svn_diff_t **diff, const char *original, const char *modified, const char *latest, apr_pool_t *pool)
Similar to svn_diff_file_diff3_2(), but with options set to a struct with default options...
svn_error_t * svn_diff_diff4(svn_diff_t **diff, void *diff_baton, const svn_diff_fns_t *diff_fns, apr_pool_t *pool)
Like svn_diff_diff4_2() but using svn_diff_fns_t instead of svn_diff_fns2_t.
svn_diff_conflict_display_style_t
Style for displaying conflicts during diff3 output.
A buffered string, capable of appending without an allocation and copy for each append.
svn_diff_operation_kind_t operation
Represents the operation performed on the file.