svn_diff_private.h revision 299742
1/** 2 * @copyright 3 * ==================================================================== 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * ==================================================================== 21 * @endcopyright 22 */ 23 24 25#ifndef SVN_DIFF_PRIVATE_H 26#define SVN_DIFF_PRIVATE_H 27 28#include <apr_pools.h> 29#include <apr_tables.h> 30 31#include "svn_types.h" 32#include "svn_io.h" 33 34#ifdef __cplusplus 35extern "C" { 36#endif /* __cplusplus */ 37 38 39 40/* The separator string used below the "Index:" or similar line of 41 * Subversion's Unidiff-like diff format. */ 42#define SVN_DIFF__EQUAL_STRING \ 43 "===================================================================" 44 45/* The separator string used below the "Properties on ..." line of 46 * Subversion's Unidiff-like diff format. */ 47#define SVN_DIFF__UNDER_STRING \ 48 "___________________________________________________________________" 49 50/* The string used to mark a line in a hunk that doesn't end with a newline, 51 * when diffing a file. Intentionally not marked for translation, for wider 52 * interoperability with patch(1) programs. */ 53#define SVN_DIFF__NO_NEWLINE_AT_END_OF_FILE \ 54 "\\ No newline at end of file" 55 56/* The string used to mark a line in a hunk that doesn't end with a newline, 57 * when diffing a Subversion property. */ 58#define SVN_DIFF__NO_NEWLINE_AT_END_OF_PROPERTY \ 59 "\\ No newline at end of property" 60 61/* Write a unidiff "---" and "+++" header to OUTPUT_STREAM. 62 * 63 * Write "---" followed by a space and OLD_HEADER and a newline, 64 * then "+++" followed by a space and NEW_HEADER and a newline. 65 * 66 * The text will be encoded into HEADER_ENCODING. 67 */ 68svn_error_t * 69svn_diff__unidiff_write_header(svn_stream_t *output_stream, 70 const char *header_encoding, 71 const char *old_header, 72 const char *new_header, 73 apr_pool_t *scratch_pool); 74 75/* Display property changes in pseudo-Unidiff format. 76 * 77 * Write to @a outstream the changes described by @a propchanges based on 78 * original properties @a original_props. 79 * 80 * Write all mark-up text (headers and so on) using the character encoding 81 * @a encoding. 82 * 83 * ### I think the idea is: we want the output to use @a encoding, and 84 * we will assume the text of the user's files and the values of any 85 * user-defined properties are already using @a encoding, so we don't 86 * want to re-code the *whole* output. 87 * So, shouldn't we also convert all prop names and all 'svn:*' prop 88 * values to @a encoding, since we know those are stored in UTF-8? 89 * 90 * @a original_props is a hash mapping (const char *) property names to 91 * (svn_string_t *) values. @a propchanges is an array of svn_prop_t 92 * representing the new values for any of the properties that changed, with 93 * a NULL value to represent deletion. 94 * 95 * If @a pretty_print_mergeinfo is true, then describe 'svn:mergeinfo' 96 * property changes in a human-readable form that says what changes were 97 * merged or reverse merged; otherwise (or if the mergeinfo property values 98 * don't parse correctly) display them just like any other property. 99 * 100 * Pass @a context_size, @a cancel_func and @a cancel_baton to the diff 101 * output functions. 102 * 103 * Use @a scratch_pool for temporary allocations. 104 */ 105svn_error_t * 106svn_diff__display_prop_diffs(svn_stream_t *outstream, 107 const char *encoding, 108 const apr_array_header_t *propchanges, 109 apr_hash_t *original_props, 110 svn_boolean_t pretty_print_mergeinfo, 111 int context_size, 112 svn_cancel_func_t cancel_func, 113 void *cancel_baton, 114 apr_pool_t *scratch_pool); 115 116 117#ifdef __cplusplus 118} 119#endif /* __cplusplus */ 120 121#endif /* SVN_DIFF_PRIVATE_H */ 122