svnrdump.h revision 299742
1/*
2 *  svnrdump.h: Internal header file for svnrdump.
3 *
4 * ====================================================================
5 *    Licensed to the Apache Software Foundation (ASF) under one
6 *    or more contributor license agreements.  See the NOTICE file
7 *    distributed with this work for additional information
8 *    regarding copyright ownership.  The ASF licenses this file
9 *    to you under the Apache License, Version 2.0 (the
10 *    "License"); you may not use this file except in compliance
11 *    with the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 *    Unless required by applicable law or agreed to in writing,
16 *    software distributed under the License is distributed on an
17 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 *    KIND, either express or implied.  See the License for the
19 *    specific language governing permissions and limitations
20 *    under the License.
21 * ====================================================================
22 */
23
24
25#ifndef SVNRDUMP_H
26#define SVNRDUMP_H
27
28/*** Includes. ***/
29#include "svn_error.h"
30#include "svn_pools.h"
31#include "svn_hash.h"
32#include "svn_delta.h"
33#include "svn_ra.h"
34
35#include "private/svn_editor.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif /* __cplusplus */
40
41
42/**
43 * Get a dump editor @a editor along with a @a edit_baton allocated in
44 * @a pool.  The editor will write output to @a stream.
45 *
46 * @a update_anchor_relpath is the repository relative path of the
47 * anchor of the update-style drive which will happen on @a *editor;
48 * if a replay-style drive will instead be used, it should be passed
49 * as @c NULL.
50 *
51 * Use @a cancel_func and @a cancel_baton to check for user
52 * cancellation of the operation (for timely-but-safe termination).
53 */
54svn_error_t *
55svn_rdump__get_dump_editor(const svn_delta_editor_t **editor,
56                           void **edit_baton,
57                           svn_revnum_t revision,
58                           svn_stream_t *stream,
59                           svn_ra_session_t *ra_session,
60                           const char *update_anchor_relpath,
61                           svn_cancel_func_t cancel_func,
62                           void *cancel_baton,
63                           apr_pool_t *pool);
64
65/* Same as above, only returns an Ev2 editor. */
66svn_error_t *
67svn_rdump__get_dump_editor_v2(svn_editor_t **editor,
68                              svn_revnum_t revision,
69                              svn_stream_t *stream,
70                              svn_ra_session_t *ra_session,
71                              const char *edit_root_relpath,
72                              svn_cancel_func_t cancel_func,
73                              void *cancel_baton,
74                              apr_pool_t *scratch_pool,
75                              apr_pool_t *result_pool);
76
77
78/**
79 * Load the dumpstream carried in @a stream to the location described
80 * by @a session.  Use @a aux_session (which is opened to the same URL
81 * as @a session) for any secondary, out-of-band RA communications
82 * required.  If @a quiet is set, suppress notifications.  Use @a pool
83 * for all memory allocations.  Use @a cancel_func and @a cancel_baton
84 * to check for user cancellation of the operation (for
85 * timely-but-safe termination).
86 */
87svn_error_t *
88svn_rdump__load_dumpstream(svn_stream_t *stream,
89                           svn_ra_session_t *session,
90                           svn_ra_session_t *aux_session,
91                           svn_boolean_t quiet,
92                           apr_hash_t *skip_revprops,
93                           svn_cancel_func_t cancel_func,
94                           void *cancel_baton,
95                           apr_pool_t *pool);
96
97
98/* Normalize the line ending style of the values of properties in PROPS
99 * that "need translation" (according to svn_prop_needs_translation(),
100 * currently all svn:* props) so that they contain only LF (\n) line endings.
101 *
102 * Put the normalized props into NORMAL_PROPS, allocated in RESULT_POOL.
103 *
104 * Note: this function does not do a deep copy; it is expected that PROPS has
105 * a longer lifetime than NORMAL_PROPS.
106 */
107svn_error_t *
108svn_rdump__normalize_props(apr_hash_t **normal_props,
109                           apr_hash_t *props,
110                           apr_pool_t *result_pool);
111
112/* Normalize the line ending style of a single property that "needs
113 * translation" (according to svn_prop_needs_translation(),
114 * currently all svn:* props) so that they contain only LF (\n) line endings.
115 * "\r" characters found mid-line are replaced with "\n".
116 * "\r\n" sequences are replaced with "\n"
117 *
118 * NAME is used to check that VALUE should be normalized, and if this is the
119 * case, VALUE is then normalized, allocated from RESULT_POOL
120 */
121svn_error_t *
122svn_rdump__normalize_prop(const char *name,
123                          const svn_string_t **value,
124                          apr_pool_t *result_pool);
125
126#ifdef __cplusplus
127}
128#endif /* __cplusplus */
129
130#endif /* SVNRDUMP_H */
131