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 32static svn_error_t * 33set_target_revision(void *edit_baton, 34 svn_revnum_t target_revision, 35 apr_pool_t *pool) 36{ 37 return SVN_NO_ERROR; 38} 39static svn_error_t * 40add_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 52static svn_error_t * 53single_baton_func(void *baton, 54 apr_pool_t *pool) 55{ 56 return SVN_NO_ERROR; 57} 58 59 60static svn_error_t * 61absent_xxx_func(const char *path, 62 void *baton, 63 apr_pool_t *pool) 64{ 65 return SVN_NO_ERROR; 66} 67 68 69static svn_error_t * 70open_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 79static svn_error_t * 80delete_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 88static svn_error_t * 89open_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 99static svn_error_t * 100change_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 108svn_error_t *svn_delta_noop_window_handler(svn_txdelta_window_t *window, 109 void *baton) 110{ 111 return SVN_NO_ERROR; 112} 113 114static svn_error_t * 115apply_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 127static svn_error_t * 128close_file(void *file_baton, 129 const char *text_checksum, 130 apr_pool_t *pool) 131{ 132 return SVN_NO_ERROR; 133} 134 135 136 137static 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 157svn_delta_editor_t * 158svn_delta_default_editor(apr_pool_t *pool) 159{ 160 return apr_pmemdup(pool, &default_editor, sizeof(default_editor)); 161} 162