~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_wc/diff_editor.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
#include "svn_hash.h"
65
65
#include "svn_sorts.h"
66
66
 
 
67
#include "private/svn_diff_tree.h"
 
68
#include "private/svn_editor.h"
 
69
#include "private/svn_sorts_private.h"
67
70
#include "private/svn_subr_private.h"
68
71
#include "private/svn_wc_private.h"
69
 
#include "private/svn_diff_tree.h"
70
 
#include "private/svn_editor.h"
71
72
 
72
73
#include "wc.h"
73
74
#include "props.h"
241
242
                svn_wc__db_t *db,
242
243
                const char *anchor_abspath,
243
244
                const char *target,
244
 
                const svn_diff_tree_processor_t *processor,
 
245
                const svn_diff_tree_processor_t *diff_processor,
245
246
                svn_depth_t depth,
246
247
                svn_boolean_t ignore_ancestry,
247
 
                svn_boolean_t show_copies_as_adds,
248
248
                svn_boolean_t use_text_base,
249
249
                svn_boolean_t reverse_order,
250
250
                svn_cancel_func_t cancel_func,
255
255
 
256
256
  SVN_ERR_ASSERT(svn_dirent_is_absolute(anchor_abspath));
257
257
 
258
 
  if (reverse_order)
259
 
    processor = svn_diff__tree_processor_reverse_create(processor, NULL, pool);
260
 
 
261
 
  /* --show-copies-as-adds implies --notice-ancestry */
262
 
  if (show_copies_as_adds)
263
 
    ignore_ancestry = FALSE;
264
 
 
265
 
  if (! show_copies_as_adds)
266
 
    processor = svn_diff__tree_processor_copy_as_changed_create(processor,
267
 
                                                                pool);
268
 
 
269
258
  eb = apr_pcalloc(pool, sizeof(*eb));
270
259
  eb->db = db;
271
260
  eb->anchor_abspath = apr_pstrdup(pool, anchor_abspath);
272
261
  eb->target = apr_pstrdup(pool, target);
273
 
  eb->processor = processor;
 
262
  eb->processor = diff_processor;
274
263
  eb->depth = depth;
275
264
  eb->ignore_ancestry = ignore_ancestry;
276
265
  eb->local_before_remote = reverse_order;
566
555
 
567
556
  SVN_ERR(svn_wc__db_read_children_info(&db->local_info, &conflicts,
568
557
                                        db->eb->db, db->local_abspath,
 
558
                                        FALSE /* base_tree_only */,
569
559
                                        db->pool, scratch_pool));
570
560
 
571
561
  return SVN_NO_ERROR;
655
645
 
656
646
      SVN_ERR(svn_wc__db_read_children_info(&nodes, &conflicts,
657
647
                                            db, local_abspath,
 
648
                                            FALSE /* base_tree_only */,
658
649
                                            scratch_pool, iterpool));
659
650
 
660
651
      children = svn_sort__hash(nodes, svn_sort_compare_items_lexically,
703
694
          if (!info->have_base)
704
695
            {
705
696
              local_only = TRUE; /* Only report additions */
 
697
 
 
698
              if (info->status == svn_wc__db_status_deleted)
 
699
                continue; /* Nothing added (deleted copy) */
706
700
            }
707
701
          else if (info->status == svn_wc__db_status_normal)
708
702
            {
1042
1036
  svn_boolean_t skip_children = FALSE;
1043
1037
  svn_diff_source_t *right_src = svn_diff__source_create(SVN_INVALID_REVNUM,
1044
1038
                                                         scratch_pool);
1045
 
  svn_depth_t depth_below_here = depth;
1046
 
  apr_hash_t *nodes;
1047
 
  apr_hash_t *conflicts;
1048
1039
 
1049
1040
  SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL,
1050
1041
                               NULL, NULL, NULL, NULL, NULL, NULL,
1098
1089
                                processor_parent_baton,
1099
1090
                                processor,
1100
1091
                                scratch_pool, iterpool));
1101
 
  /* ### skip_children is not used */
1102
 
 
1103
 
  SVN_ERR(svn_wc__db_read_children_info(&nodes, &conflicts, db, local_abspath,
1104
 
                                        scratch_pool, iterpool));
1105
 
 
1106
 
  if (depth_below_here == svn_depth_immediates)
1107
 
    depth_below_here = svn_depth_empty;
1108
 
 
1109
 
  children = svn_sort__hash(nodes, svn_sort_compare_items_lexically,
1110
 
                            scratch_pool);
1111
 
 
1112
 
  for (i = 0; i < children->nelts; i++)
 
1092
 
 
1093
  if ((depth > svn_depth_empty || depth == svn_depth_unknown)
 
1094
      && ! skip_children)
1113
1095
    {
1114
 
      svn_sort__item_t *item = &APR_ARRAY_IDX(children, i, svn_sort__item_t);
1115
 
      const char *name = item->key;
1116
 
      struct svn_wc__db_info_t *info = item->value;
1117
 
      const char *child_abspath;
1118
 
      const char *child_relpath;
1119
 
 
1120
 
      svn_pool_clear(iterpool);
1121
 
 
1122
 
      if (cancel_func)
1123
 
        SVN_ERR(cancel_func(cancel_baton));
1124
 
 
1125
 
      child_abspath = svn_dirent_join(local_abspath, name, iterpool);
1126
 
 
1127
 
      if (NOT_PRESENT(info->status))
1128
 
        {
1129
 
          continue;
1130
 
        }
1131
 
 
1132
 
      /* If comparing against WORKING, skip entries that are
1133
 
         schedule-deleted - they don't really exist. */
1134
 
      if (!diff_pristine && info->status == svn_wc__db_status_deleted)
1135
 
        continue;
1136
 
 
1137
 
      child_relpath = svn_relpath_join(relpath, name, iterpool);
1138
 
 
1139
 
      switch (info->kind)
1140
 
        {
1141
 
        case svn_node_file:
1142
 
        case svn_node_symlink:
1143
 
          SVN_ERR(svn_wc__diff_local_only_file(db, child_abspath,
1144
 
                                               child_relpath,
1145
 
                                               processor, pdb,
1146
 
                                               diff_pristine,
1147
 
                                               cancel_func, cancel_baton,
1148
 
                                               scratch_pool));
1149
 
          break;
1150
 
 
1151
 
        case svn_node_dir:
1152
 
          if (depth > svn_depth_files || depth == svn_depth_unknown)
1153
 
            {
1154
 
              SVN_ERR(svn_wc__diff_local_only_dir(db, child_abspath,
1155
 
                                                  child_relpath, depth_below_here,
1156
 
                                                  processor, pdb,
1157
 
                                                  diff_pristine,
1158
 
                                                  cancel_func, cancel_baton,
1159
 
                                                  iterpool));
1160
 
            }
1161
 
          break;
1162
 
 
1163
 
        default:
1164
 
          break;
 
1096
      svn_depth_t depth_below_here = depth;
 
1097
      apr_hash_t *nodes;
 
1098
      apr_hash_t *conflicts;
 
1099
 
 
1100
      if (depth_below_here == svn_depth_immediates)
 
1101
        depth_below_here = svn_depth_empty;
 
1102
 
 
1103
      SVN_ERR(svn_wc__db_read_children_info(&nodes, &conflicts,
 
1104
                                            db, local_abspath,
 
1105
                                            FALSE /* base_tree_only */,
 
1106
                                            scratch_pool, iterpool));
 
1107
 
 
1108
 
 
1109
      children = svn_sort__hash(nodes, svn_sort_compare_items_lexically,
 
1110
                                scratch_pool);
 
1111
 
 
1112
      for (i = 0; i < children->nelts; i++)
 
1113
        {
 
1114
          svn_sort__item_t *item = &APR_ARRAY_IDX(children, i, svn_sort__item_t);
 
1115
          const char *name = item->key;
 
1116
          struct svn_wc__db_info_t *info = item->value;
 
1117
          const char *child_abspath;
 
1118
          const char *child_relpath;
 
1119
 
 
1120
          svn_pool_clear(iterpool);
 
1121
 
 
1122
          if (cancel_func)
 
1123
            SVN_ERR(cancel_func(cancel_baton));
 
1124
 
 
1125
          child_abspath = svn_dirent_join(local_abspath, name, iterpool);
 
1126
 
 
1127
          if (NOT_PRESENT(info->status))
 
1128
            {
 
1129
              continue;
 
1130
            }
 
1131
 
 
1132
          /* If comparing against WORKING, skip entries that are
 
1133
             schedule-deleted - they don't really exist. */
 
1134
          if (!diff_pristine && info->status == svn_wc__db_status_deleted)
 
1135
            continue;
 
1136
 
 
1137
          child_relpath = svn_relpath_join(relpath, name, iterpool);
 
1138
 
 
1139
          switch (info->kind)
 
1140
            {
 
1141
            case svn_node_file:
 
1142
            case svn_node_symlink:
 
1143
              SVN_ERR(svn_wc__diff_local_only_file(db, child_abspath,
 
1144
                                                   child_relpath,
 
1145
                                                   processor, pdb,
 
1146
                                                   diff_pristine,
 
1147
                                                   cancel_func, cancel_baton,
 
1148
                                                   scratch_pool));
 
1149
              break;
 
1150
 
 
1151
            case svn_node_dir:
 
1152
              if (depth > svn_depth_files || depth == svn_depth_unknown)
 
1153
                {
 
1154
                  SVN_ERR(svn_wc__diff_local_only_dir(db, child_abspath,
 
1155
                                                      child_relpath,
 
1156
                                                      depth_below_here,
 
1157
                                                      processor, pdb,
 
1158
                                                      diff_pristine,
 
1159
                                                      cancel_func,
 
1160
                                                      cancel_baton,
 
1161
                                                      iterpool));
 
1162
                }
 
1163
              break;
 
1164
 
 
1165
            default:
 
1166
              break;
 
1167
            }
1165
1168
        }
1166
1169
    }
1167
1170
 
2193
2196
 
2194
2197
  propchange = apr_array_push(fb->propchanges);
2195
2198
  propchange->name = apr_pstrdup(fb->pool, name);
2196
 
  propchange->value = value ? svn_string_dup(value, fb->pool) : NULL;
 
2199
  propchange->value = svn_string_dup(value, fb->pool);
2197
2200
 
2198
2201
  return SVN_NO_ERROR;
2199
2202
}
2218
2221
 
2219
2222
  propchange = apr_array_push(db->propchanges);
2220
2223
  propchange->name = apr_pstrdup(db->pool, name);
2221
 
  propchange->value = value ? svn_string_dup(value, db->pool) : NULL;
 
2224
  propchange->value = svn_string_dup(value, db->pool);
2222
2225
 
2223
2226
  return SVN_NO_ERROR;
2224
2227
}
2257
2260
                        const char *target,
2258
2261
                        svn_depth_t depth,
2259
2262
                        svn_boolean_t ignore_ancestry,
2260
 
                        svn_boolean_t show_copies_as_adds,
2261
 
                        svn_boolean_t use_git_diff_format,
2262
2263
                        svn_boolean_t use_text_base,
2263
2264
                        svn_boolean_t reverse_order,
2264
2265
                        svn_boolean_t server_performs_filtering,
2265
2266
                        const apr_array_header_t *changelist_filter,
2266
 
                        const svn_wc_diff_callbacks4_t *callbacks,
2267
 
                        void *callback_baton,
 
2267
                        const svn_diff_tree_processor_t *diff_processor,
2268
2268
                        svn_cancel_func_t cancel_func,
2269
2269
                        void *cancel_baton,
2270
2270
                        apr_pool_t *result_pool,
2277
2277
  struct svn_wc__shim_fetch_baton_t *sfb;
2278
2278
  svn_delta_shim_callbacks_t *shim_callbacks =
2279
2279
                                svn_delta_shim_callbacks_default(result_pool);
2280
 
  const svn_diff_tree_processor_t *diff_processor;
2281
2280
 
2282
2281
  SVN_ERR_ASSERT(svn_dirent_is_absolute(anchor_abspath));
2283
2282
 
2284
 
  /* --git implies --show-copies-as-adds */
2285
 
  if (use_git_diff_format)
2286
 
    show_copies_as_adds = TRUE;
2287
 
 
2288
 
  SVN_ERR(svn_wc__wrap_diff_callbacks(&diff_processor,
2289
 
                                      callbacks, callback_baton, TRUE,
2290
 
                                      result_pool, scratch_pool));
2291
 
 
2292
2283
  /* Apply changelist filtering to the output */
2293
2284
  if (changelist_filter && changelist_filter->nelts)
2294
2285
    {
2305
2296
                          wc_ctx->db,
2306
2297
                          anchor_abspath, target,
2307
2298
                          diff_processor,
2308
 
                          depth, ignore_ancestry, show_copies_as_adds,
 
2299
                          depth, ignore_ancestry,
2309
2300
                          use_text_base, reverse_order,
2310
2301
                          cancel_func, cancel_baton,
2311
2302
                          result_pool));
2458
2449
/* svn_diff_tree_processor_t function */
2459
2450
static svn_error_t *
2460
2451
wrap_dir_added(const char *relpath,
 
2452
               const svn_diff_source_t *copyfrom_source,
2461
2453
               const svn_diff_source_t *right_source,
2462
 
               const svn_diff_source_t *copyfrom_source,
2463
2454
               /*const*/ apr_hash_t *copyfrom_props,
2464
2455
               /*const*/ apr_hash_t *right_props,
2465
2456
               void *dir_baton,