summaryrefslogtreecommitdiff
path: root/subversion/include/private/svn_diff_private.h
blob: 48b4d52662006bfacd5e33d737e4a9f7614a79fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/**
 * @copyright
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 * @endcopyright
 */


#ifndef SVN_DIFF_PRIVATE_H
#define SVN_DIFF_PRIVATE_H

#include <apr_pools.h>
#include <apr_tables.h>

#include "svn_types.h"
#include "svn_io.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */



/* The separator string used below the "Index:" or similar line of
 * Subversion's Unidiff-like diff format.  */
#define SVN_DIFF__EQUAL_STRING \
  "==================================================================="

/* The separator string used below the "Properties on ..." line of
 * Subversion's Unidiff-like diff format.  */
#define SVN_DIFF__UNDER_STRING \
  "___________________________________________________________________"

/* The string used to mark a line in a hunk that doesn't end with a newline,
 * when diffing a file.  Intentionally not marked for translation, for wider
 * interoperability with patch(1) programs. */
#define SVN_DIFF__NO_NEWLINE_AT_END_OF_FILE \
          "\\ No newline at end of file"

/* The string used to mark a line in a hunk that doesn't end with a newline,
 * when diffing a Subversion property. */
#define SVN_DIFF__NO_NEWLINE_AT_END_OF_PROPERTY \
          "\\ No newline at end of property"

/* Write a unidiff "---" and "+++" header to OUTPUT_STREAM.
 *
 * Write "---" followed by a space and OLD_HEADER and a newline,
 * then "+++" followed by a space and NEW_HEADER and a newline.
 *
 * The text will be encoded into HEADER_ENCODING.
 */
svn_error_t *
svn_diff__unidiff_write_header(svn_stream_t *output_stream,
                               const char *header_encoding,
                               const char *old_header,
                               const char *new_header,
                               apr_pool_t *scratch_pool);

/* Display property changes in pseudo-Unidiff format.
 *
 * Write to @a outstream the changes described by @a propchanges based on
 * original properties @a original_props.
 *
 * Write all mark-up text (headers and so on) using the character encoding
 * @a encoding.
 *
 *   ### I think the idea is: we want the output to use @a encoding, and
 *       we will assume the text of the user's files and the values of any
 *       user-defined properties are already using @a encoding, so we don't
 *       want to re-code the *whole* output.
 *       So, shouldn't we also convert all prop names and all 'svn:*' prop
 *       values to @a encoding, since we know those are stored in UTF-8?
 *
 * @a original_props is a hash mapping (const char *) property names to
 * (svn_string_t *) values.  @a propchanges is an array of svn_prop_t
 * representing the new values for any of the properties that changed, with
 * a NULL value to represent deletion.
 *
 * If @a pretty_print_mergeinfo is true, then describe 'svn:mergeinfo'
 * property changes in a human-readable form that says what changes were
 * merged or reverse merged; otherwise (or if the mergeinfo property values
 * don't parse correctly) display them just like any other property.
 *
 * Pass @a context_size, @a cancel_func and @a cancel_baton to the diff
 * output functions.
 *
 * Use @a scratch_pool for temporary allocations.
 */
svn_error_t *
svn_diff__display_prop_diffs(svn_stream_t *outstream,
                             const char *encoding,
                             const apr_array_header_t *propchanges,
                             apr_hash_t *original_props,
                             svn_boolean_t pretty_print_mergeinfo,
                             int context_size,
                             svn_cancel_func_t cancel_func,
                             void *cancel_baton,
                             apr_pool_t *scratch_pool);


#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* SVN_DIFF_PRIVATE_H */