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

« back to all changes in this revision

Viewing changes to subversion/libsvn_wc/node.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:
54
54
 
55
55
 
56
56
/* Set *CHILDREN_ABSPATHS to a new array of the full paths formed by joining
57
 
 * each name in REL_CHILDREN onto DIR_ABSPATH.  If SHOW_HIDDEN is false then
58
 
 * omit any paths that are reported as 'hidden' by svn_wc__db_node_hidden().
 
57
 * each name in REL_CHILDREN onto DIR_ABSPATH.
59
58
 *
60
59
 * Allocate the output array and its elements in RESULT_POOL. */
61
 
static svn_error_t *
62
 
filter_and_make_absolute(const apr_array_header_t **children_abspaths,
63
 
                         svn_wc_context_t *wc_ctx,
64
 
                         const char *dir_abspath,
65
 
                         const apr_array_header_t *rel_children,
66
 
                         svn_boolean_t show_hidden,
67
 
                         apr_pool_t *result_pool,
68
 
                         apr_pool_t *scratch_pool)
 
60
static void
 
61
make_absolute(const apr_array_header_t **children_abspaths,
 
62
              const char *dir_abspath,
 
63
              const apr_array_header_t *rel_children,
 
64
              apr_pool_t *result_pool)
69
65
{
70
66
  apr_array_header_t *children;
71
67
  int i;
74
70
                            sizeof(const char *));
75
71
  for (i = 0; i < rel_children->nelts; i++)
76
72
    {
77
 
      const char *child_abspath = svn_dirent_join(dir_abspath,
78
 
                                                  APR_ARRAY_IDX(rel_children,
79
 
                                                                i,
80
 
                                                                const char *),
81
 
                                                  result_pool);
82
 
 
83
 
      /* Don't add hidden nodes to *CHILDREN if we don't want them. */
84
 
      if (!show_hidden)
85
 
        {
86
 
          svn_boolean_t child_is_hidden;
87
 
 
88
 
          SVN_ERR(svn_wc__db_node_hidden(&child_is_hidden, wc_ctx->db,
89
 
                                         child_abspath, scratch_pool));
90
 
          if (child_is_hidden)
91
 
            continue;
92
 
        }
93
 
 
94
 
      APR_ARRAY_PUSH(children, const char *) = child_abspath;
 
73
      const char *name = APR_ARRAY_IDX(rel_children, i, const char *);
 
74
      APR_ARRAY_PUSH(children, const char *) =
 
75
                        svn_dirent_join(dir_abspath, name,
 
76
                                        result_pool);
95
77
    }
96
78
 
97
79
  *children_abspaths = children;
98
 
 
99
 
  return SVN_NO_ERROR;
100
80
}
101
81
 
102
82
 
104
84
svn_wc__node_get_children_of_working_node(const apr_array_header_t **children,
105
85
                                          svn_wc_context_t *wc_ctx,
106
86
                                          const char *dir_abspath,
107
 
                                          svn_boolean_t show_hidden,
108
87
                                          apr_pool_t *result_pool,
109
88
                                          apr_pool_t *scratch_pool)
110
89
{
111
 
  const apr_array_header_t *rel_children;
 
90
  const apr_array_header_t *child_names;
112
91
 
113
 
  SVN_ERR(svn_wc__db_read_children_of_working_node(&rel_children,
 
92
  SVN_ERR(svn_wc__db_read_children_of_working_node(&child_names,
114
93
                                                   wc_ctx->db, dir_abspath,
115
94
                                                   scratch_pool, scratch_pool));
116
 
  SVN_ERR(filter_and_make_absolute(children, wc_ctx, dir_abspath,
117
 
                                   rel_children, show_hidden,
118
 
                                   result_pool, scratch_pool));
119
 
  return SVN_NO_ERROR;
120
 
}
 
95
  make_absolute(children, dir_abspath, child_names, result_pool);
 
96
  return SVN_NO_ERROR;
 
97
}
 
98
 
 
99
svn_error_t *
 
100
svn_wc__node_get_not_present_children(const apr_array_header_t **children,
 
101
                                      svn_wc_context_t *wc_ctx,
 
102
                                      const char *dir_abspath,
 
103
                                      apr_pool_t *result_pool,
 
104
                                      apr_pool_t *scratch_pool)
 
105
{
 
106
  const apr_array_header_t *child_names;
 
107
 
 
108
  SVN_ERR(svn_wc__db_base_read_not_present_children(
 
109
                                   &child_names,
 
110
                                   wc_ctx->db, dir_abspath,
 
111
                                   scratch_pool, scratch_pool));
 
112
  make_absolute(children, dir_abspath, child_names, result_pool);
 
113
  return SVN_NO_ERROR;
 
114
}
 
115
 
121
116
 
122
117
svn_error_t *
123
 
svn_wc__node_get_children(const apr_array_header_t **children,
124
 
                          svn_wc_context_t *wc_ctx,
125
 
                          const char *dir_abspath,
126
 
                          svn_boolean_t show_hidden,
127
 
                          apr_pool_t *result_pool,
128
 
                          apr_pool_t *scratch_pool)
129
 
{
130
 
  const apr_array_header_t *rel_children;
131
 
 
132
 
  SVN_ERR(svn_wc__db_read_children(&rel_children, wc_ctx->db, dir_abspath,
133
 
                                   scratch_pool, scratch_pool));
134
 
  SVN_ERR(filter_and_make_absolute(children, wc_ctx, dir_abspath,
135
 
                                   rel_children, show_hidden,
136
 
                                   result_pool, scratch_pool));
137
 
  return SVN_NO_ERROR;
138
 
}
139
 
 
140
 
 
141
 
svn_error_t *
142
 
svn_wc__internal_get_repos_info(svn_revnum_t *revision,
143
 
                                const char **repos_relpath,
144
 
                                const char **repos_root_url,
145
 
                                const char **repos_uuid,
146
 
                                svn_wc__db_t *db,
147
 
                                const char *local_abspath,
148
 
                                apr_pool_t *result_pool,
149
 
                                apr_pool_t *scratch_pool)
150
 
{
151
 
  svn_wc__db_status_t status;
152
 
  svn_boolean_t have_work;
153
 
 
154
 
  SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, repos_relpath,
155
 
                               repos_root_url, repos_uuid,
156
 
                               NULL, NULL, NULL, NULL, NULL, NULL,
157
 
                               NULL, NULL, NULL, NULL, NULL, NULL,
158
 
                               NULL, NULL, NULL, NULL, NULL, NULL,
159
 
                               NULL, NULL, &have_work,
160
 
                               db, local_abspath,
161
 
                               result_pool, scratch_pool));
162
 
 
163
 
  if ((repos_relpath ? *repos_relpath != NULL : TRUE)
164
 
      && (repos_root_url ? *repos_root_url  != NULL: TRUE)
165
 
      && (repos_uuid ? *repos_uuid != NULL : TRUE))
166
 
    return SVN_NO_ERROR; /* We got the requested information */
167
 
 
168
 
  if (!have_work) /* not-present, (server-)excluded? */
169
 
    {
170
 
      return SVN_NO_ERROR; /* Can't fetch more */
171
 
    }
172
 
 
173
 
  if (status == svn_wc__db_status_deleted)
174
 
    {
175
 
      const char *base_del_abspath, *wrk_del_abspath;
176
 
 
177
 
      SVN_ERR(svn_wc__db_scan_deletion(&base_del_abspath, NULL,
178
 
                                       &wrk_del_abspath, NULL,
179
 
                                       db, local_abspath,
180
 
                                       scratch_pool, scratch_pool));
181
 
 
182
 
      if (base_del_abspath)
183
 
        {
184
 
          SVN_ERR(svn_wc__db_base_get_info(NULL, NULL, NULL, repos_relpath,
185
 
                                           repos_root_url, repos_uuid, NULL,
186
 
                                           NULL, NULL, NULL, NULL, NULL, NULL,
187
 
                                           NULL, NULL, NULL,
188
 
                                           db, base_del_abspath,
189
 
                                           result_pool, scratch_pool));
190
 
 
191
 
          /* If we have a repos_relpath, it is of the op-root */
192
 
          if (repos_relpath)
193
 
            *repos_relpath = svn_relpath_join(*repos_relpath,
194
 
                                svn_dirent_skip_ancestor(base_del_abspath,
195
 
                                                         local_abspath),
196
 
                                              result_pool);
197
 
          /* We keep revision as SVN_INVALID_REVNUM */
198
 
        }
199
 
      else if (wrk_del_abspath)
200
 
        {
201
 
          const char *op_root_abspath = NULL;
202
 
 
203
 
          SVN_ERR(svn_wc__db_scan_addition(NULL, repos_relpath
204
 
                                                    ? &op_root_abspath : NULL,
205
 
                                           repos_relpath, repos_root_url,
206
 
                                           repos_uuid, NULL, NULL, NULL, NULL,
207
 
                                           db, svn_dirent_dirname(
208
 
                                                   wrk_del_abspath,
209
 
                                                   scratch_pool),
210
 
                                           result_pool, scratch_pool));
211
 
 
212
 
          /* If we have a repos_relpath, it is of the op-root */
213
 
          if (repos_relpath)
214
 
            *repos_relpath = svn_relpath_join(
215
 
                                    *repos_relpath,
216
 
                                    svn_dirent_skip_ancestor(op_root_abspath,
217
 
                                                             local_abspath),
218
 
                                    result_pool);
219
 
        }
220
 
    }
221
 
  else /* added, or WORKING incomplete */
222
 
    {
223
 
      const char *op_root_abspath = NULL;
224
 
 
225
 
      /* We have an addition. scan_addition() will find the intended
226
 
         repository location by scanning up the tree.  */
227
 
      SVN_ERR(svn_wc__db_scan_addition(NULL, repos_relpath
228
 
                                                    ? &op_root_abspath : NULL,
229
 
                                       repos_relpath, repos_root_url,
230
 
                                       repos_uuid, NULL, NULL, NULL, NULL,
231
 
                                       db, local_abspath,
 
118
svn_wc__node_get_repos_info(svn_revnum_t *revision,
 
119
                            const char **repos_relpath,
 
120
                            const char **repos_root_url,
 
121
                            const char **repos_uuid,
 
122
                            svn_wc_context_t *wc_ctx,
 
123
                            const char *local_abspath,
 
124
                            apr_pool_t *result_pool,
 
125
                            apr_pool_t *scratch_pool)
 
126
{
 
127
  return svn_error_trace(
 
128
            svn_wc__db_read_repos_info(revision,
 
129
                                       repos_relpath,
 
130
                                       repos_root_url,
 
131
                                       repos_uuid,
 
132
                                       wc_ctx->db, local_abspath,
232
133
                                       result_pool, scratch_pool));
233
 
    }
234
 
 
235
 
  SVN_ERR_ASSERT(repos_root_url == NULL || *repos_root_url != NULL);
236
 
  SVN_ERR_ASSERT(repos_uuid == NULL || *repos_uuid != NULL);
237
 
  return SVN_NO_ERROR;
238
 
}
239
 
 
240
 
svn_error_t *
241
 
svn_wc__node_get_repos_info(svn_revnum_t *revision,
242
 
                            const char **repos_relpath,
243
 
                            const char **repos_root_url,
244
 
                            const char **repos_uuid,
245
 
                            svn_wc_context_t *wc_ctx,
246
 
                            const char *local_abspath,
247
 
                            apr_pool_t *result_pool,
248
 
                            apr_pool_t *scratch_pool)
249
 
{
250
 
  return svn_error_trace(
251
 
            svn_wc__internal_get_repos_info(revision,
252
 
                                            repos_relpath,
253
 
                                            repos_root_url,
254
 
                                            repos_uuid,
255
 
                                            wc_ctx->db, local_abspath,
256
 
                                            result_pool, scratch_pool));
257
134
}
258
135
 
259
136
/* Convert DB_KIND into the appropriate NODE_KIND value.
323
200
}
324
201
 
325
202
svn_error_t *
326
 
svn_wc__node_get_depth(svn_depth_t *depth,
327
 
                       svn_wc_context_t *wc_ctx,
328
 
                       const char *local_abspath,
329
 
                       apr_pool_t *scratch_pool)
330
 
{
331
 
  return svn_error_trace(
332
 
    svn_wc__db_read_info(NULL, NULL, NULL, NULL, NULL, NULL, NULL,
333
 
                         NULL, NULL, depth, NULL, NULL, NULL, NULL,
334
 
                         NULL, NULL, NULL, NULL, NULL, NULL, NULL,
335
 
                         NULL, NULL, NULL, NULL, NULL, NULL,
336
 
                         wc_ctx->db, local_abspath, scratch_pool,
337
 
                         scratch_pool));
338
 
}
339
 
 
340
 
svn_error_t *
341
203
svn_wc__node_get_changed_info(svn_revnum_t *changed_rev,
342
204
                              apr_time_t *changed_date,
343
205
                              const char **changed_author,
362
224
                     apr_pool_t *result_pool,
363
225
                     apr_pool_t *scratch_pool)
364
226
{
365
 
  return svn_error_trace(svn_wc__db_read_url(url, wc_ctx->db, local_abspath,
366
 
                                             result_pool, scratch_pool));
 
227
  const char *repos_root_url;
 
228
  const char *repos_relpath;
 
229
 
 
230
  SVN_ERR(svn_wc__db_read_repos_info(NULL, &repos_relpath, &repos_root_url,
 
231
                                     NULL,
 
232
                                     wc_ctx->db, local_abspath,
 
233
                                     scratch_pool, scratch_pool));
 
234
 
 
235
  *url = svn_path_url_add_component2(repos_root_url, repos_relpath,
 
236
                                     result_pool);
 
237
 
 
238
  return SVN_NO_ERROR;
367
239
}
368
240
 
369
241
/* A recursive node-walker, helper for svn_wc__internal_walk_children().
388
260
              void *cancel_baton,
389
261
              apr_pool_t *scratch_pool)
390
262
{
391
 
  apr_hash_t *rel_children_info;
392
 
  apr_hash_index_t *hi;
393
263
  apr_pool_t *iterpool;
 
264
  const apr_array_header_t *items;
 
265
  int i;
394
266
 
395
267
  if (depth == svn_depth_empty)
396
268
    return SVN_NO_ERROR;
397
269
 
398
 
  SVN_ERR(svn_wc__db_read_children_walker_info(&rel_children_info, db,
 
270
  iterpool = svn_pool_create(scratch_pool);
 
271
 
 
272
  SVN_ERR(svn_wc__db_read_children_walker_info(&items, db,
399
273
                                               dir_abspath, scratch_pool,
400
 
                                               scratch_pool));
401
 
 
402
 
 
403
 
  iterpool = svn_pool_create(scratch_pool);
404
 
  for (hi = apr_hash_first(scratch_pool, rel_children_info);
405
 
       hi;
406
 
       hi = apr_hash_next(hi))
 
274
                                               iterpool));
 
275
 
 
276
  for (i = 0; i < items->nelts; i++)
407
277
    {
408
 
      const char *child_name = svn__apr_hash_index_key(hi);
409
 
      struct svn_wc__db_walker_info_t *wi = svn__apr_hash_index_val(hi);
 
278
      struct svn_wc__db_walker_info_t *wi =
 
279
              APR_ARRAY_IDX(items, i, struct svn_wc__db_walker_info_t *);
 
280
      const char *child_name = wi->name;
410
281
      svn_node_kind_t child_kind = wi->kind;
411
282
      svn_wc__db_status_t child_status = wi->status;
412
283
      const char *child_abspath;
489
360
  svn_node_kind_t kind;
490
361
  svn_wc__db_status_t status;
491
362
  apr_hash_t *changelist_hash = NULL;
 
363
  const char *changelist = NULL;
492
364
 
493
365
  SVN_ERR_ASSERT(walk_depth >= svn_depth_empty
494
366
                 && walk_depth <= svn_depth_infinity);
501
373
  SVN_ERR(svn_wc__db_read_info(&status, &db_kind, NULL, NULL, NULL, NULL,
502
374
                               NULL, NULL, NULL, NULL, NULL, NULL,
503
375
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
504
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
376
                               changelist_hash ? &changelist : NULL,
 
377
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
505
378
                               db, local_abspath, scratch_pool, scratch_pool));
506
379
 
507
380
  SVN_ERR(convert_db_kind_to_node_kind(&kind, db_kind, status, show_hidden));
508
381
 
509
 
  if (svn_wc__internal_changelist_match(db, local_abspath,
510
 
                                        changelist_hash, scratch_pool))
511
 
    SVN_ERR(walk_callback(local_abspath, kind, walk_baton, scratch_pool));
 
382
  if (!changelist_hash
 
383
      || (changelist && svn_hash_gets(changelist_hash, changelist)))
 
384
    {
 
385
      SVN_ERR(walk_callback(local_abspath, kind, walk_baton, scratch_pool));
 
386
    }
512
387
 
513
388
  if (db_kind == svn_node_file
514
389
      || status == svn_wc__db_status_not_present
531
406
}
532
407
 
533
408
svn_error_t *
534
 
svn_wc__node_is_status_deleted(svn_boolean_t *is_deleted,
535
 
                               svn_wc_context_t *wc_ctx,
536
 
                               const char *local_abspath,
537
 
                               apr_pool_t *scratch_pool)
538
 
{
539
 
  svn_wc__db_status_t status;
540
 
 
541
 
  SVN_ERR(svn_wc__db_read_info(&status,
542
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
543
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
544
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
545
 
                               NULL, NULL, NULL, NULL, NULL,
546
 
                               wc_ctx->db, local_abspath,
547
 
                               scratch_pool, scratch_pool));
548
 
 
549
 
  *is_deleted = (status == svn_wc__db_status_deleted);
550
 
 
551
 
  return SVN_NO_ERROR;
552
 
}
553
 
 
554
 
svn_error_t *
555
 
svn_wc__node_get_deleted_ancestor(const char **deleted_ancestor_abspath,
556
 
                                  svn_wc_context_t *wc_ctx,
557
 
                                  const char *local_abspath,
558
 
                                  apr_pool_t *result_pool,
559
 
                                  apr_pool_t *scratch_pool)
560
 
{
561
 
  svn_wc__db_status_t status;
562
 
 
563
 
  *deleted_ancestor_abspath = NULL;
564
 
 
565
 
  SVN_ERR(svn_wc__db_read_info(&status,
566
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
567
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
568
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
569
 
                               NULL, NULL, NULL, NULL, NULL,
570
 
                               wc_ctx->db, local_abspath,
571
 
                               scratch_pool, scratch_pool));
572
 
 
573
 
  if (status == svn_wc__db_status_deleted)
574
 
    SVN_ERR(svn_wc__db_scan_deletion(deleted_ancestor_abspath, NULL, NULL,
575
 
                                     NULL, wc_ctx->db, local_abspath,
576
 
                                     result_pool, scratch_pool));
577
 
 
578
 
  return SVN_NO_ERROR;
579
 
}
580
 
 
581
 
svn_error_t *
582
409
svn_wc__node_is_not_present(svn_boolean_t *is_not_present,
583
410
                            svn_boolean_t *is_excluded,
584
411
                            svn_boolean_t *is_server_excluded,
671
498
                      svn_wc_context_t *wc_ctx,
672
499
                      const char *local_abspath,
673
500
                      svn_boolean_t ignore_enoent,
674
 
                      svn_boolean_t show_hidden,
675
501
                      apr_pool_t *result_pool,
676
502
                      apr_pool_t *scratch_pool)
677
503
{
691
517
  if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
692
518
    return svn_error_trace(err);
693
519
  else if (err
694
 
           || (!err && !show_hidden
695
 
               && (status != svn_wc__db_status_normal
696
 
                   && status != svn_wc__db_status_incomplete)))
 
520
           || (status != svn_wc__db_status_normal
 
521
               && status != svn_wc__db_status_incomplete))
697
522
    {
698
523
      if (!ignore_enoent)
699
524
        {
783
608
}
784
609
 
785
610
svn_error_t *
786
 
svn_wc__internal_node_get_schedule(svn_wc_schedule_t *schedule,
787
 
                                   svn_boolean_t *copied,
788
 
                                   svn_wc__db_t *db,
789
 
                                   const char *local_abspath,
790
 
                                   apr_pool_t *scratch_pool)
791
 
{
792
 
  svn_wc__db_status_t status;
793
 
  svn_boolean_t op_root;
794
 
  svn_boolean_t have_base;
795
 
  svn_boolean_t have_work;
796
 
  svn_boolean_t have_more_work;
797
 
  const char *copyfrom_relpath;
798
 
 
799
 
  if (schedule)
800
 
    *schedule = svn_wc_schedule_normal;
801
 
  if (copied)
802
 
    *copied = FALSE;
803
 
 
804
 
  SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL, NULL,
805
 
                               NULL, NULL, NULL, NULL, NULL, &copyfrom_relpath,
806
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
807
 
                               &op_root, NULL, NULL,
808
 
                               &have_base, &have_more_work, &have_work,
809
 
                               db, local_abspath, scratch_pool, scratch_pool));
810
 
 
811
 
  switch (status)
812
 
    {
813
 
      case svn_wc__db_status_not_present:
814
 
      case svn_wc__db_status_server_excluded:
815
 
      case svn_wc__db_status_excluded:
816
 
        /* We used status normal in the entries world. */
817
 
        if (schedule)
818
 
          *schedule = svn_wc_schedule_normal;
819
 
        break;
820
 
      case svn_wc__db_status_normal:
821
 
      case svn_wc__db_status_incomplete:
822
 
        break;
823
 
 
824
 
      case svn_wc__db_status_deleted:
825
 
        {
826
 
          if (schedule)
827
 
            *schedule = svn_wc_schedule_delete;
828
 
 
829
 
          if (!copied)
830
 
            break;
831
 
 
832
 
          if (have_more_work || !have_base)
833
 
            *copied = TRUE;
834
 
          else
835
 
            {
836
 
              const char *work_del_abspath;
837
 
 
838
 
              /* Find out details of our deletion.  */
839
 
              SVN_ERR(svn_wc__db_scan_deletion(NULL, NULL,
840
 
                                               &work_del_abspath, NULL,
841
 
                                               db, local_abspath,
842
 
                                               scratch_pool, scratch_pool));
843
 
 
844
 
              if (work_del_abspath)
845
 
                *copied = TRUE; /* Working deletion */
846
 
            }
847
 
          break;
848
 
        }
849
 
      case svn_wc__db_status_added:
850
 
        {
851
 
          if (!op_root)
852
 
            {
853
 
              if (copied)
854
 
                *copied = TRUE;
855
 
 
856
 
              if (schedule)
857
 
                *schedule = svn_wc_schedule_normal;
858
 
 
859
 
              break;
860
 
            }
861
 
 
862
 
          if (copied)
863
 
            *copied = (copyfrom_relpath != NULL);
864
 
 
865
 
          if (schedule)
866
 
            *schedule = svn_wc_schedule_add;
867
 
          else
868
 
            break;
869
 
 
870
 
          /* Check for replaced */
871
 
          if (have_base || have_more_work)
872
 
            {
873
 
              svn_wc__db_status_t below_working;
874
 
              SVN_ERR(svn_wc__db_info_below_working(&have_base, &have_work,
875
 
                                                    &below_working,
876
 
                                                    db, local_abspath,
877
 
                                                    scratch_pool));
878
 
 
879
 
              /* If the node is not present or deleted (read: not present
880
 
                 in working), then the node is not a replacement */
881
 
              if (below_working != svn_wc__db_status_not_present
882
 
                  && below_working != svn_wc__db_status_deleted)
883
 
                {
884
 
                  *schedule = svn_wc_schedule_replace;
885
 
                  break;
886
 
                }
887
 
            }
888
 
          break;
889
 
        }
890
 
      default:
891
 
        SVN_ERR_MALFUNCTION();
892
 
    }
893
 
 
894
 
  return SVN_NO_ERROR;
895
 
}
896
 
 
897
 
svn_error_t *
898
 
svn_wc__node_get_schedule(svn_wc_schedule_t *schedule,
899
 
                          svn_boolean_t *copied,
900
 
                          svn_wc_context_t *wc_ctx,
901
 
                          const char *local_abspath,
902
 
                          apr_pool_t *scratch_pool)
903
 
{
904
 
  return svn_error_trace(
905
 
           svn_wc__internal_node_get_schedule(schedule,
906
 
                                              copied,
907
 
                                              wc_ctx->db,
908
 
                                              local_abspath,
909
 
                                              scratch_pool));
910
 
}
911
 
 
912
 
svn_error_t *
913
611
svn_wc__node_clear_dav_cache_recursive(svn_wc_context_t *wc_ctx,
914
612
                                       const char *local_abspath,
915
613
                                       apr_pool_t *scratch_pool)
952
650
                            const char **repos_relpath,
953
651
                            const char **repos_root_url,
954
652
                            const char **repos_uuid,
 
653
                            svn_depth_t *depth,
955
654
                            const char **copy_root_abspath,
956
655
                            svn_wc__db_t *db,
957
656
                            const char *local_abspath,
964
663
  const char *original_repos_uuid;
965
664
  svn_revnum_t original_revision;
966
665
  svn_wc__db_status_t status;
 
666
  svn_boolean_t have_more_work;
 
667
  svn_boolean_t op_root;
967
668
 
968
669
  const char *tmp_repos_relpath;
969
670
 
 
671
  if (copy_root_abspath)
 
672
    *copy_root_abspath = NULL;
970
673
  if (!repos_relpath)
971
674
    repos_relpath = &tmp_repos_relpath;
972
675
 
973
676
  SVN_ERR(svn_wc__db_read_info(&status, NULL, revision, repos_relpath,
974
677
                               repos_root_url, repos_uuid, NULL, NULL, NULL,
975
 
                               NULL, NULL, NULL,
 
678
                               depth, NULL, NULL,
976
679
                               &original_repos_relpath,
977
680
                               &original_repos_root_url,
978
681
                               &original_repos_uuid, &original_revision,
979
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
980
 
                               NULL, NULL, is_copy,
 
682
                               NULL, NULL, NULL, NULL, NULL, &op_root, NULL,
 
683
                               NULL, NULL, &have_more_work, is_copy,
981
684
                               db, local_abspath, result_pool, scratch_pool));
982
685
 
983
686
  if (*repos_relpath)
995
698
 
996
699
  if (original_repos_relpath)
997
700
    {
 
701
      /* We an have a copy */
998
702
      *repos_relpath = original_repos_relpath;
999
703
      if (revision)
1000
704
        *revision = original_revision;
1005
709
 
1006
710
      if (copy_root_abspath == NULL)
1007
711
        return SVN_NO_ERROR;
 
712
      else if (op_root)
 
713
        {
 
714
          *copy_root_abspath = apr_pstrdup(result_pool, local_abspath);
 
715
          return SVN_NO_ERROR;
 
716
        }
1008
717
    }
1009
718
 
1010
719
  {
1011
720
    svn_boolean_t scan_working = FALSE;
1012
721
 
1013
 
    if (status == svn_wc__db_status_added)
 
722
    if (status == svn_wc__db_status_added
 
723
        || (status == svn_wc__db_status_deleted && have_more_work))
1014
724
      scan_working = TRUE;
1015
 
    else if (status == svn_wc__db_status_deleted)
1016
 
      {
1017
 
        svn_boolean_t have_base;
1018
 
        /* Is this a BASE or a WORKING delete? */
1019
 
        SVN_ERR(svn_wc__db_info_below_working(&have_base, &scan_working,
1020
 
                                              &status, db, local_abspath,
1021
 
                                              scratch_pool));
1022
 
      }
1023
725
 
1024
726
    if (scan_working)
1025
727
      {
1079
781
                        const char **repos_relpath,
1080
782
                        const char **repos_root_url,
1081
783
                        const char **repos_uuid,
 
784
                        svn_depth_t *depth,
1082
785
                        const char **copy_root_abspath,
1083
786
                        svn_wc_context_t *wc_ctx,
1084
787
                        const char *local_abspath,
1088
791
{
1089
792
  return svn_error_trace(svn_wc__internal_get_origin(is_copy, revision,
1090
793
                           repos_relpath, repos_root_url, repos_uuid,
1091
 
                           copy_root_abspath,
 
794
                           depth, copy_root_abspath,
1092
795
                           wc_ctx->db, local_abspath, scan_deleted,
1093
796
                           result_pool, scratch_pool));
1094
797
}
1364
1067
                            apr_pool_t *result_pool,
1365
1068
                            apr_pool_t *scratch_pool)
1366
1069
{
1367
 
  svn_boolean_t is_deleted;
 
1070
  svn_wc__db_status_t status;
1368
1071
 
1369
1072
  if (moved_to_abspath)
1370
1073
    *moved_to_abspath = NULL;
1371
1074
  if (op_root_abspath)
1372
1075
    *op_root_abspath = NULL;
1373
1076
 
1374
 
  SVN_ERR(svn_wc__node_is_status_deleted(&is_deleted, wc_ctx, local_abspath,
1375
 
                                         scratch_pool));
1376
 
  if (is_deleted)
 
1077
  SVN_ERR(svn_wc__db_read_info(&status,
 
1078
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
1079
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
1080
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
1081
                               NULL, NULL, NULL, NULL, NULL,
 
1082
                               wc_ctx->db, local_abspath,
 
1083
                               scratch_pool, scratch_pool));
 
1084
 
 
1085
  if (status == svn_wc__db_status_deleted)
1377
1086
    SVN_ERR(svn_wc__db_scan_deletion(NULL, moved_to_abspath, NULL,
1378
1087
                                     op_root_abspath, wc_ctx->db,
1379
1088
                                     local_abspath,