1251881Speter/**
2251881Speter * @copyright
3251881Speter * ====================================================================
4251881Speter *    Licensed to the Apache Software Foundation (ASF) under one
5251881Speter *    or more contributor license agreements.  See the NOTICE file
6251881Speter *    distributed with this work for additional information
7251881Speter *    regarding copyright ownership.  The ASF licenses this file
8251881Speter *    to you under the Apache License, Version 2.0 (the
9251881Speter *    "License"); you may not use this file except in compliance
10251881Speter *    with the License.  You may obtain a copy of the License at
11251881Speter *
12251881Speter *      http://www.apache.org/licenses/LICENSE-2.0
13251881Speter *
14251881Speter *    Unless required by applicable law or agreed to in writing,
15251881Speter *    software distributed under the License is distributed on an
16251881Speter *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17251881Speter *    KIND, either express or implied.  See the License for the
18251881Speter *    specific language governing permissions and limitations
19251881Speter *    under the License.
20251881Speter * ====================================================================
21251881Speter * @endcopyright
22251881Speter */
23251881Speter
24251881Speter
25251881Speter#ifndef SVN_DIFF_PRIVATE_H
26251881Speter#define SVN_DIFF_PRIVATE_H
27251881Speter
28251881Speter#include <apr_pools.h>
29251881Speter#include <apr_tables.h>
30251881Speter
31251881Speter#include "svn_types.h"
32251881Speter#include "svn_io.h"
33251881Speter
34251881Speter#ifdef __cplusplus
35251881Speterextern "C" {
36251881Speter#endif /* __cplusplus */
37251881Speter
38251881Speter
39251881Speter
40251881Speter/* The separator string used below the "Index:" or similar line of
41251881Speter * Subversion's Unidiff-like diff format.  */
42251881Speter#define SVN_DIFF__EQUAL_STRING \
43251881Speter  "==================================================================="
44251881Speter
45251881Speter/* The separator string used below the "Properties on ..." line of
46251881Speter * Subversion's Unidiff-like diff format.  */
47251881Speter#define SVN_DIFF__UNDER_STRING \
48251881Speter  "___________________________________________________________________"
49251881Speter
50251881Speter/* The string used to mark a line in a hunk that doesn't end with a newline,
51251881Speter * when diffing a file.  Intentionally not marked for translation, for wider
52251881Speter * interoperability with patch(1) programs. */
53251881Speter#define SVN_DIFF__NO_NEWLINE_AT_END_OF_FILE \
54251881Speter          "\\ No newline at end of file"
55251881Speter
56251881Speter/* The string used to mark a line in a hunk that doesn't end with a newline,
57251881Speter * when diffing a Subversion property. */
58251881Speter#define SVN_DIFF__NO_NEWLINE_AT_END_OF_PROPERTY \
59251881Speter          "\\ No newline at end of property"
60251881Speter
61251881Speter/* Write a unidiff "---" and "+++" header to OUTPUT_STREAM.
62251881Speter *
63251881Speter * Write "---" followed by a space and OLD_HEADER and a newline,
64251881Speter * then "+++" followed by a space and NEW_HEADER and a newline.
65251881Speter *
66251881Speter * The text will be encoded into HEADER_ENCODING.
67251881Speter */
68251881Spetersvn_error_t *
69251881Spetersvn_diff__unidiff_write_header(svn_stream_t *output_stream,
70251881Speter                               const char *header_encoding,
71251881Speter                               const char *old_header,
72251881Speter                               const char *new_header,
73251881Speter                               apr_pool_t *scratch_pool);
74251881Speter
75251881Speter/* Display property changes in pseudo-Unidiff format.
76251881Speter *
77251881Speter * Write to @a outstream the changes described by @a propchanges based on
78251881Speter * original properties @a original_props.
79251881Speter *
80251881Speter * Write all mark-up text (headers and so on) using the character encoding
81251881Speter * @a encoding.
82251881Speter *
83251881Speter *   ### I think the idea is: we want the output to use @a encoding, and
84251881Speter *       we will assume the text of the user's files and the values of any
85251881Speter *       user-defined properties are already using @a encoding, so we don't
86251881Speter *       want to re-code the *whole* output.
87251881Speter *       So, shouldn't we also convert all prop names and all 'svn:*' prop
88251881Speter *       values to @a encoding, since we know those are stored in UTF-8?
89251881Speter *
90251881Speter * @a original_props is a hash mapping (const char *) property names to
91251881Speter * (svn_string_t *) values.  @a propchanges is an array of svn_prop_t
92251881Speter * representing the new values for any of the properties that changed, with
93251881Speter * a NULL value to represent deletion.
94251881Speter *
95251881Speter * If @a pretty_print_mergeinfo is true, then describe 'svn:mergeinfo'
96251881Speter * property changes in a human-readable form that says what changes were
97251881Speter * merged or reverse merged; otherwise (or if the mergeinfo property values
98251881Speter * don't parse correctly) display them just like any other property.
99251881Speter *
100251881Speter * Use @a pool for temporary allocations.
101251881Speter */
102251881Spetersvn_error_t *
103251881Spetersvn_diff__display_prop_diffs(svn_stream_t *outstream,
104251881Speter                             const char *encoding,
105251881Speter                             const apr_array_header_t *propchanges,
106251881Speter                             apr_hash_t *original_props,
107251881Speter                             svn_boolean_t pretty_print_mergeinfo,
108251881Speter                             apr_pool_t *pool);
109251881Speter
110251881Speter
111251881Speter#ifdef __cplusplus
112251881Speter}
113251881Speter#endif /* __cplusplus */
114251881Speter
115251881Speter#endif /* SVN_DIFF_PRIVATE_H */
116