Sync with upstream
[svnrdump.git] / load_editor.h
blob3422aed21c0ac67c6ce3d59628d40960092b5723
1 /**
2 * @copyright
3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 * ====================================================================
21 * @endcopyright
23 * @file load_editor.h
24 * @brief The svn_delta_editor_t editor used by svnrdump to load
25 * revisions.
28 #ifndef LOAD_EDITOR_H_
29 #define LOAD_EDITOR_H_
31 /**
32 * General baton used by the parser functions.
34 struct parse_baton
36 const svn_delta_editor_t *commit_editor;
37 void *commit_edit_baton;
38 svn_ra_session_t *session;
39 const char *uuid;
40 const char *root_url;
43 /**
44 * Use to wrap the dir_context_t in commit.c so we can keep track of
45 * depth, relpath and parent for open_directory and close_directory.
47 struct directory_baton
49 void *baton;
50 const char *relpath;
51 int depth;
52 struct directory_baton *parent;
55 /**
56 * Baton used to represent a node; to be used by the parser
57 * functions. Contains a link to the revision baton.
59 struct node_baton
61 const char *path;
62 svn_node_kind_t kind;
63 enum svn_node_action action;
65 svn_revnum_t copyfrom_rev;
66 const char *copyfrom_path;
68 void *file_baton;
69 const char *base_checksum;
71 struct revision_baton *rb;
74 /**
75 * Baton used to represet a revision; used by the parser
76 * functions. Contains a link to the parser baton.
78 struct revision_baton
80 svn_revnum_t rev;
81 apr_hash_t *revprop_table;
83 const svn_string_t *datestamp;
84 const svn_string_t *author;
86 struct parse_baton *pb;
87 struct directory_baton *db;
88 apr_pool_t *pool;
91 /**
92 * Build up a dumpstream parser @a parser (and corresponding baton @a
93 * parse_baton) to fire the appropriate callbacks in a commit editor
94 * set to commit to session @a session. Use @a pool for all memory
95 * allocations.
97 svn_error_t *
98 get_dumpstream_loader(const svn_repos_parse_fns2_t **parser,
99 void **parse_baton,
100 svn_ra_session_t *session,
101 apr_pool_t *pool);
104 * Drive the dumpstream loader described by @a parser and @a
105 * parse_baton to parse and commit the stream @a stream to the
106 * location described by @a session. Use @a pool for all memory
107 * allocations. Use @a cancel_func and @a cancel_baton to check for
108 * user cancellation of the operation (for timely-but-safe
109 * termination).
111 svn_error_t *
112 drive_dumpstream_loader(svn_stream_t *stream,
113 const svn_repos_parse_fns2_t *parser,
114 void *parse_baton,
115 svn_ra_session_t *session,
116 svn_cancel_func_t cancel_func,
117 void *cancel_baton,
118 apr_pool_t *pool);
120 #endif