]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/libsvn_delta/default_editor.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / libsvn_delta / default_editor.c
1 /*
2  * default_editor.c -- provide a basic svn_delta_editor_t
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 #include <apr_pools.h>
26 #include <apr_strings.h>
27
28 #include "svn_types.h"
29 #include "svn_delta.h"
30
31 \f
32 static svn_error_t *
33 set_target_revision(void *edit_baton,
34                     svn_revnum_t target_revision,
35                     apr_pool_t *pool)
36 {
37   return SVN_NO_ERROR;
38 }
39 static svn_error_t *
40 add_item(const char *path,
41          void *parent_baton,
42          const char *copyfrom_path,
43          svn_revnum_t copyfrom_revision,
44          apr_pool_t *pool,
45          void **baton)
46 {
47   *baton = NULL;
48   return SVN_NO_ERROR;
49 }
50
51
52 static svn_error_t *
53 single_baton_func(void *baton,
54                   apr_pool_t *pool)
55 {
56   return SVN_NO_ERROR;
57 }
58
59
60 static svn_error_t *
61 absent_xxx_func(const char *path,
62                 void *baton,
63                 apr_pool_t *pool)
64 {
65   return SVN_NO_ERROR;
66 }
67
68
69 static svn_error_t *
70 open_root(void *edit_baton,
71           svn_revnum_t base_revision,
72           apr_pool_t *dir_pool,
73           void **root_baton)
74 {
75   *root_baton = NULL;
76   return SVN_NO_ERROR;
77 }
78
79 static svn_error_t *
80 delete_entry(const char *path,
81              svn_revnum_t revision,
82              void *parent_baton,
83              apr_pool_t *pool)
84 {
85   return SVN_NO_ERROR;
86 }
87
88 static svn_error_t *
89 open_item(const char *path,
90           void *parent_baton,
91           svn_revnum_t base_revision,
92           apr_pool_t *pool,
93           void **baton)
94 {
95   *baton = NULL;
96   return SVN_NO_ERROR;
97 }
98
99 static svn_error_t *
100 change_prop(void *file_baton,
101             const char *name,
102             const svn_string_t *value,
103             apr_pool_t *pool)
104 {
105   return SVN_NO_ERROR;
106 }
107
108 svn_error_t *svn_delta_noop_window_handler(svn_txdelta_window_t *window,
109                                            void *baton)
110 {
111   return SVN_NO_ERROR;
112 }
113
114 static svn_error_t *
115 apply_textdelta(void *file_baton,
116                 const char *base_checksum,
117                 apr_pool_t *pool,
118                 svn_txdelta_window_handler_t *handler,
119                 void **handler_baton)
120 {
121   *handler = svn_delta_noop_window_handler;
122   *handler_baton = NULL;
123   return SVN_NO_ERROR;
124 }
125
126
127 static svn_error_t *
128 close_file(void *file_baton,
129            const char *text_checksum,
130            apr_pool_t *pool)
131 {
132   return SVN_NO_ERROR;
133 }
134
135
136 \f
137 static const svn_delta_editor_t default_editor =
138 {
139   set_target_revision,
140   open_root,
141   delete_entry,
142   add_item,
143   open_item,
144   change_prop,
145   single_baton_func,
146   absent_xxx_func,
147   add_item,
148   open_item,
149   apply_textdelta,
150   change_prop,
151   close_file,
152   absent_xxx_func,
153   single_baton_func,
154   single_baton_func
155 };
156
157 svn_delta_editor_t *
158 svn_delta_default_editor(apr_pool_t *pool)
159 {
160   return apr_pmemdup(pool, &default_editor, sizeof(default_editor));
161 }