1/*
2 * lock.h:  routines for diffing local files and directories.
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#ifndef SVN_LIBSVN_WC_DIFF_H
25#define SVN_LIBSVN_WC_DIFF_H
26
27#include <apr_pools.h>
28#include <apr_hash.h>
29
30#include "svn_types.h"
31#include "svn_error.h"
32#include "svn_wc.h"
33
34#include "wc_db.h"
35#include "private/svn_diff_tree.h"
36
37#ifdef __cplusplus
38extern "C" {
39#endif /* __cplusplus */
40
41/* A function to diff locally added and locally copied files.
42
43   Reports the file LOCAL_ABSPATH as ADDED file with relpath RELPATH to
44   PROCESSOR with as parent baton PROCESSOR_PARENT_BATON.
45
46   The node is expected to have status svn_wc__db_status_normal, or
47   svn_wc__db_status_added. When DIFF_PRISTINE is TRUE, report the pristine
48   version of LOCAL_ABSPATH as ADDED. In this case an
49   svn_wc__db_status_deleted may shadow an added or deleted node.
50 */
51svn_error_t *
52svn_wc__diff_local_only_file(svn_wc__db_t *db,
53                             const char *local_abspath,
54                             const char *relpath,
55                             const char *moved_from_relpath,
56                             const svn_diff_tree_processor_t *processor,
57                             void *processor_parent_baton,
58                             svn_boolean_t diff_pristine,
59                             svn_cancel_func_t cancel_func,
60                             void *cancel_baton,
61                             apr_pool_t *scratch_pool);
62
63/* A function to diff locally added and locally copied directories.
64
65   Reports the directory LOCAL_ABSPATH and everything below it (limited by
66   DEPTH) as added with relpath RELPATH to PROCESSOR with as parent baton
67   PROCESSOR_PARENT_BATON.
68
69   The node is expected to have status svn_wc__db_status_normal, or
70   svn_wc__db_status_added. When DIFF_PRISTINE is TRUE, report the pristine
71   version of LOCAL_ABSPATH as ADDED. In this case an
72   svn_wc__db_status_deleted may shadow an added or deleted node.
73 */
74svn_error_t *
75svn_wc__diff_local_only_dir(svn_wc__db_t *db,
76                            const char *local_abspath,
77                            const char *relpath,
78                            svn_depth_t depth,
79                            const char *moved_from_relpath,
80                            const svn_diff_tree_processor_t *processor,
81                            void *processor_parent_baton,
82                            svn_boolean_t diff_pristine,
83                            svn_cancel_func_t cancel_func,
84                            void *cancel_baton,
85                            apr_pool_t *scratch_pool);
86
87/* Reports the BASE-file LOCAL_ABSPATH as deleted to PROCESSOR with relpath
88   RELPATH, revision REVISION and parent baton PROCESSOR_PARENT_BATON.
89
90   If REVISION is invalid, the revision as stored in BASE is used.
91
92   The node is expected to have status svn_wc__db_status_normal in BASE. */
93svn_error_t *
94svn_wc__diff_base_only_file(svn_wc__db_t *db,
95                            const char *local_abspath,
96                            const char *relpath,
97                            svn_revnum_t revision,
98                            const svn_diff_tree_processor_t *processor,
99                            void *processor_parent_baton,
100                            apr_pool_t *scratch_pool);
101
102/* Reports the BASE-directory LOCAL_ABSPATH and everything below it (limited
103   by DEPTH) as deleted to PROCESSOR with relpath RELPATH and parent baton
104   PROCESSOR_PARENT_BATON.
105
106   If REVISION is invalid, the revision as stored in BASE is used.
107
108   The node is expected to have status svn_wc__db_status_normal in BASE. */
109svn_error_t *
110svn_wc__diff_base_only_dir(svn_wc__db_t *db,
111                           const char *local_abspath,
112                           const char *relpath,
113                           svn_revnum_t revision,
114                           svn_depth_t depth,
115                           const svn_diff_tree_processor_t *processor,
116                           void *processor_parent_baton,
117                           svn_cancel_func_t cancel_func,
118                           void *cancel_baton,
119                           apr_pool_t *scratch_pool);
120
121/* Diff the file PATH against the text base of its BASE layer.  At this
122 * stage we are dealing with a file that does exist in the working copy.
123 */
124svn_error_t *
125svn_wc__diff_base_working_diff(svn_wc__db_t *db,
126                               const char *local_abspath,
127                               const char *relpath,
128                               svn_revnum_t revision,
129                               const svn_diff_tree_processor_t *processor,
130                               void *processor_dir_baton,
131                               svn_boolean_t diff_pristine,
132                               svn_cancel_func_t cancel_func,
133                               void *cancel_baton,
134                               apr_pool_t *scratch_pool);
135
136/* Return a tree processor filter that filters by changelist membership.
137 *
138 * This filter only passes on the changes for a file if the file's path
139 * (in the WC) is assigned to one of the changelists in @a changelist_hash.
140 * It also passes on the opening and closing of each directory that contains
141 * such a change, and possibly also of other directories, but not addition
142 * or deletion or changes to a directory.
143 *
144 * If @a changelist_hash is null then no filtering is performed and the
145 * returned diff processor is driven exactly like the input @a processor.
146 *
147 * @a wc_ctx is the WC context and @a root_local_abspath is the WC path of
148 * the root of the diff (for which relpath = "" in the diff processor).
149 *
150 * Allocate the returned diff processor in @a result_pool, or if no
151 * filtering is required then the input pointer @a processor itself may be
152 * returned.
153 */
154const svn_diff_tree_processor_t *
155svn_wc__changelist_filter_tree_processor_create(
156                                const svn_diff_tree_processor_t *processor,
157                                svn_wc_context_t *wc_ctx,
158                                const char *root_local_abspath,
159                                apr_hash_t *changelist_hash,
160                                apr_pool_t *result_pool);
161
162
163#ifdef __cplusplus
164}
165#endif /* __cplusplus */
166
167#endif /* SVN_LIBSVN_WC_DIFF_H */
168