1251881Speter/*
2251881Speter *  svnrdump.h: Internal header file for svnrdump.
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
25251881Speter#ifndef SVNRDUMP_H
26251881Speter#define SVNRDUMP_H
27251881Speter
28251881Speter/*** Includes. ***/
29251881Speter#include "svn_error.h"
30251881Speter#include "svn_pools.h"
31251881Speter#include "svn_hash.h"
32251881Speter#include "svn_delta.h"
33251881Speter#include "svn_ra.h"
34251881Speter
35251881Speter#include "private/svn_editor.h"
36251881Speter
37251881Speter#ifdef __cplusplus
38251881Speterextern "C" {
39251881Speter#endif /* __cplusplus */
40251881Speter
41251881Speter
42251881Speter/**
43251881Speter * Get a dump editor @a editor along with a @a edit_baton allocated in
44251881Speter * @a pool.  The editor will write output to @a stream.
45251881Speter *
46251881Speter * @a update_anchor_relpath is the repository relative path of the
47251881Speter * anchor of the update-style drive which will happen on @a *editor;
48251881Speter * if a replay-style drive will instead be used, it should be passed
49251881Speter * as @c NULL.
50251881Speter *
51251881Speter * Use @a cancel_func and @a cancel_baton to check for user
52251881Speter * cancellation of the operation (for timely-but-safe termination).
53251881Speter */
54251881Spetersvn_error_t *
55251881Spetersvn_rdump__get_dump_editor(const svn_delta_editor_t **editor,
56251881Speter                           void **edit_baton,
57251881Speter                           svn_revnum_t revision,
58251881Speter                           svn_stream_t *stream,
59251881Speter                           svn_ra_session_t *ra_session,
60251881Speter                           const char *update_anchor_relpath,
61251881Speter                           svn_cancel_func_t cancel_func,
62251881Speter                           void *cancel_baton,
63251881Speter                           apr_pool_t *pool);
64251881Speter
65251881Speter/* Same as above, only returns an Ev2 editor. */
66251881Spetersvn_error_t *
67251881Spetersvn_rdump__get_dump_editor_v2(svn_editor_t **editor,
68251881Speter                              svn_revnum_t revision,
69251881Speter                              svn_stream_t *stream,
70251881Speter                              svn_ra_session_t *ra_session,
71251881Speter                              const char *edit_root_relpath,
72251881Speter                              svn_cancel_func_t cancel_func,
73251881Speter                              void *cancel_baton,
74251881Speter                              apr_pool_t *scratch_pool,
75251881Speter                              apr_pool_t *result_pool);
76251881Speter
77251881Speter
78251881Speter/**
79251881Speter * Load the dumpstream carried in @a stream to the location described
80251881Speter * by @a session.  Use @a aux_session (which is opened to the same URL
81251881Speter * as @a session) for any secondary, out-of-band RA communications
82251881Speter * required.  If @a quiet is set, suppress notifications.  Use @a pool
83251881Speter * for all memory allocations.  Use @a cancel_func and @a cancel_baton
84251881Speter * to check for user cancellation of the operation (for
85251881Speter * timely-but-safe termination).
86251881Speter */
87251881Spetersvn_error_t *
88251881Spetersvn_rdump__load_dumpstream(svn_stream_t *stream,
89251881Speter                           svn_ra_session_t *session,
90251881Speter                           svn_ra_session_t *aux_session,
91251881Speter                           svn_boolean_t quiet,
92251881Speter                           svn_cancel_func_t cancel_func,
93251881Speter                           void *cancel_baton,
94251881Speter                           apr_pool_t *pool);
95251881Speter
96251881Speter
97251881Speter/* Normalize the line ending style of the values of properties in PROPS
98251881Speter * that "need translation" (according to svn_prop_needs_translation(),
99251881Speter * currently all svn:* props) so that they contain only LF (\n) line endings.
100251881Speter *
101251881Speter * Put the normalized props into NORMAL_PROPS, allocated in RESULT_POOL.
102251881Speter *
103251881Speter * Note: this function does not do a deep copy; it is expected that PROPS has
104251881Speter * a longer lifetime than NORMAL_PROPS.
105251881Speter */
106251881Spetersvn_error_t *
107251881Spetersvn_rdump__normalize_props(apr_hash_t **normal_props,
108251881Speter                           apr_hash_t *props,
109251881Speter                           apr_pool_t *result_pool);
110251881Speter
111251881Speter/* Normalize the line ending style of a single property that "needs
112251881Speter * translation" (according to svn_prop_needs_translation(),
113251881Speter * currently all svn:* props) so that they contain only LF (\n) line endings.
114251881Speter * "\r" characters found mid-line are replaced with "\n".
115251881Speter * "\r\n" sequences are replaced with "\n"
116251881Speter *
117251881Speter * NAME is used to check that VALUE should be normalized, and if this is the
118251881Speter * case, VALUE is then normalized, allocated from RESULT_POOL
119251881Speter */
120251881Spetersvn_error_t *
121251881Spetersvn_rdump__normalize_prop(const char *name,
122251881Speter                          const svn_string_t **value,
123251881Speter                          apr_pool_t *result_pool);
124251881Speter
125251881Speter#ifdef __cplusplus
126251881Speter}
127251881Speter#endif /* __cplusplus */
128251881Speter
129251881Speter#endif /* SVNRDUMP_H */
130