1251881Speter/*
2251881Speter * sync.h :  The synchronization editor for svnsync.
3251881Speter *
4251881Speter * ====================================================================
5251881Speter *    Licensed to the Apache Software Foundation (ASF) under one
6251881Speter *    or more contributor license agreements.  See the NOTICE file
7251881Speter *    distributed with this work for additional information
8251881Speter *    regarding copyright ownership.  The ASF licenses this file
9251881Speter *    to you under the Apache License, Version 2.0 (the
10251881Speter *    "License"); you may not use this file except in compliance
11251881Speter *    with the License.  You may obtain a copy of the License at
12251881Speter *
13251881Speter *      http://www.apache.org/licenses/LICENSE-2.0
14251881Speter *
15251881Speter *    Unless required by applicable law or agreed to in writing,
16251881Speter *    software distributed under the License is distributed on an
17251881Speter *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18251881Speter *    KIND, either express or implied.  See the License for the
19251881Speter *    specific language governing permissions and limitations
20251881Speter *    under the License.
21251881Speter * ====================================================================
22251881Speter */
23251881Speter
24251881Speter#ifndef SYNC_H
25251881Speter#define SYNC_H
26251881Speter
27251881Speter#ifdef __cplusplus
28251881Speterextern "C" {
29251881Speter#endif /* __cplusplus */
30251881Speter
31251881Speter
32251881Speter#include "svn_types.h"
33251881Speter#include "svn_delta.h"
34251881Speter
35251881Speter
36251881Speter/* Normalize the encoding and line ending style of the values of properties
37251881Speter * in REV_PROPS that "need translation" (according to
38251881Speter * svn_prop_needs_translation(), which is currently all svn:* props) so that
39251881Speter * they are encoded in UTF-8 and contain only LF (\n) line endings.
40251881Speter *
41251881Speter * The number of properties that needed line ending normalization is returned in
42251881Speter * *NORMALIZED_COUNT.
43251881Speter *
44251881Speter * No re-encoding is performed if SOURCE_PROP_ENCODING is NULL.
45251881Speter */
46251881Spetersvn_error_t *
47251881Spetersvnsync_normalize_revprops(apr_hash_t *rev_props,
48251881Speter                           int *normalized_count,
49251881Speter                           const char *source_prop_encoding,
50251881Speter                           apr_pool_t *pool);
51251881Speter
52251881Speter
53251881Speter/* Set WRAPPED_EDITOR and WRAPPED_EDIT_BATON to an editor/baton pair
54251881Speter * that wraps our own commit EDITOR/EDIT_BATON.  BASE_REVISION is the
55251881Speter * revision on which the driver of this returned editor will be basing
56251881Speter * the commit.  TO_URL is the URL of the root of the repository into
57251881Speter * which the commit is being made.
58251881Speter *
59251881Speter * If SOURCE_PROP_ENCODING is NULL, then property values are presumed to be
60251881Speter * encoded in UTF-8 and are not re-encoded. Otherwise, the property values are
61251881Speter * presumed to be encoded in SOURCE_PROP_ENCODING, and are normalized to UTF-8.
62251881Speter *
63251881Speter * As the sync editor encounters property values, it might see the need to
64251881Speter * normalize them (re-encode and/or change to LF line endings). Each carried-out
65251881Speter * line ending normalization adds 1 to the *NORMALIZED_NODE_PROPS_COUNTER
66251881Speter * (for notification).
67251881Speter */
68251881Spetersvn_error_t *
69251881Spetersvnsync_get_sync_editor(const svn_delta_editor_t *wrapped_editor,
70251881Speter                        void *wrapped_edit_baton,
71251881Speter                        svn_revnum_t base_revision,
72251881Speter                        const char *to_url,
73251881Speter                        const char *source_prop_encoding,
74251881Speter                        svn_boolean_t quiet,
75251881Speter                        const svn_delta_editor_t **editor,
76251881Speter                        void **edit_baton,
77251881Speter                        int *normalized_node_props_counter,
78251881Speter                        apr_pool_t *pool);
79251881Speter
80251881Speter
81251881Speter#ifdef __cplusplus
82251881Speter}
83251881Speter#endif /* __cplusplus */
84251881Speter
85251881Speter#endif  /* SYNC_H */
86