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

« back to all changes in this revision

Viewing changes to subversion/libsvn_wc/adm_crawler.c

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <apr_file_io.h>
31
31
#include <apr_hash.h>
32
32
 
 
33
#include "svn_hash.h"
33
34
#include "svn_types.h"
34
35
#include "svn_pools.h"
35
36
#include "svn_wc.h"
58
59
   last-commit-time.  Either way, set entry-timestamp to match that of
59
60
   the working file when all is finished.
60
61
 
61
 
   If REMOVE_TEXT_CONFLICT is TRUE, remove an existing text conflict
62
 
   from LOCAL_ABSPATH.
 
62
   If MARK_RESOLVED_TEXT_CONFLICT is TRUE, mark as resolved any existing
 
63
   text conflict on LOCAL_ABSPATH.
63
64
 
64
65
   Not that a valid access baton with a write lock to the directory of
65
66
   LOCAL_ABSPATH must be available in DB.*/
67
68
restore_file(svn_wc__db_t *db,
68
69
             const char *local_abspath,
69
70
             svn_boolean_t use_commit_times,
70
 
             svn_boolean_t remove_text_conflicts,
 
71
             svn_boolean_t mark_resolved_text_conflict,
71
72
             apr_pool_t *scratch_pool)
72
73
{
73
74
  svn_skel_t *work_item;
89
90
                         scratch_pool));
90
91
 
91
92
  /* Remove any text conflict */
92
 
  if (remove_text_conflicts)
93
 
    SVN_ERR(svn_wc__resolve_text_conflict(db, local_abspath, scratch_pool));
 
93
  if (mark_resolved_text_conflict)
 
94
    SVN_ERR(svn_wc__mark_resolved_text_conflict(db, local_abspath, scratch_pool));
94
95
 
95
96
  return SVN_NO_ERROR;
96
97
}
102
103
               apr_pool_t *scratch_pool)
103
104
{
104
105
  svn_wc__db_status_t status;
105
 
  svn_wc__db_kind_t kind;
 
106
  svn_node_kind_t kind;
106
107
  svn_node_kind_t disk_kind;
 
108
  const svn_checksum_t *checksum;
107
109
 
108
110
  SVN_ERR(svn_io_check_path(local_abspath, &disk_kind, scratch_pool));
109
111
 
113
115
                             svn_dirent_local_style(local_abspath,
114
116
                                                    scratch_pool));
115
117
 
116
 
 
117
 
 
118
118
  SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL, NULL,
119
 
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
119
                               NULL, NULL, NULL, &checksum, NULL, NULL, NULL, NULL,
120
120
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
121
121
                               NULL, NULL, NULL, NULL,
122
122
                               wc_ctx->db, local_abspath,
123
123
                               scratch_pool, scratch_pool));
124
124
 
125
 
  if (status == svn_wc__db_status_added)
126
 
    SVN_ERR(svn_wc__db_scan_addition(&status, NULL, NULL, NULL, NULL, NULL,
127
 
                                         NULL, NULL, NULL,
128
 
                                         wc_ctx->db, local_abspath,
129
 
                                         scratch_pool, scratch_pool));
130
 
 
131
125
  if (status != svn_wc__db_status_normal
132
 
      && status != svn_wc__db_status_copied
133
 
      && status != svn_wc__db_status_moved_here
134
 
      && !(kind == svn_wc__db_kind_dir
135
 
           && (status == svn_wc__db_status_added
136
 
               || status == svn_wc__db_status_incomplete)))
 
126
      && !((status == svn_wc__db_status_added
 
127
            || status == svn_wc__db_status_incomplete)
 
128
           && (kind == svn_node_dir
 
129
               || (kind == svn_node_file && checksum != NULL)
 
130
               /* || (kind == svn_node_symlink && target)*/)))
137
131
    {
138
132
      return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
139
133
                               _("The node '%s' can not be restored."),
141
135
                                                      scratch_pool));
142
136
    }
143
137
 
144
 
  if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink)
145
 
    SVN_ERR(restore_file(wc_ctx->db, local_abspath, use_commit_times, FALSE,
 
138
  if (kind == svn_node_file || kind == svn_node_symlink)
 
139
    SVN_ERR(restore_file(wc_ctx->db, local_abspath, use_commit_times,
 
140
                         FALSE /*mark_resolved_text_conflict*/,
146
141
                         scratch_pool));
147
142
  else
148
143
    SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
160
155
static svn_error_t *
161
156
restore_node(svn_wc__db_t *db,
162
157
             const char *local_abspath,
163
 
             svn_wc__db_kind_t kind,
 
158
             svn_node_kind_t kind,
164
159
             svn_boolean_t use_commit_times,
165
160
             svn_wc_notify_func2_t notify_func,
166
161
             void *notify_baton,
167
162
             apr_pool_t *scratch_pool)
168
163
{
169
 
  if (kind == svn_wc__db_kind_file || kind == svn_wc__db_kind_symlink)
 
164
  if (kind == svn_node_file || kind == svn_node_symlink)
170
165
    {
171
 
      /* Recreate file from text-base */
172
 
      SVN_ERR(restore_file(db, local_abspath, use_commit_times, TRUE,
 
166
      /* Recreate file from text-base; mark any text conflict as resolved */
 
167
      SVN_ERR(restore_file(db, local_abspath, use_commit_times,
 
168
                           TRUE /*mark_resolved_text_conflict*/,
173
169
                           scratch_pool));
174
170
    }
175
 
  else if (kind == svn_wc__db_kind_dir)
 
171
  else if (kind == svn_node_dir)
176
172
    {
177
173
      /* Recreating a directory is just a mkdir */
178
174
      SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
278
274
                  || SVN__APR_STATUS_IS_ENOTDIR(err->apr_err)))
279
275
        {
280
276
          svn_error_clear(err);
281
 
          dirents = apr_hash_make(scratch_pool);
 
277
          /* There is no directory, and if we could create the directory
 
278
             we would have already created it when walking the parent
 
279
             directory */
 
280
          restore_files = FALSE;
 
281
          dirents = NULL;
282
282
        }
283
283
      else
284
284
        SVN_ERR(err);
370
370
 
371
371
      /* Is the entry NOT on the disk? We may be able to restore it.  */
372
372
      if (restore_files
373
 
          && apr_hash_get(dirents, child, APR_HASH_KEY_STRING) == NULL)
 
373
          && svn_hash_gets(dirents, child) == NULL)
374
374
        {
375
375
          svn_wc__db_status_t wrk_status;
376
 
          svn_wc__db_kind_t wrk_kind;
 
376
          svn_node_kind_t wrk_kind;
 
377
          const svn_checksum_t *checksum;
377
378
 
378
379
          SVN_ERR(svn_wc__db_read_info(&wrk_status, &wrk_kind, NULL, NULL,
379
380
                                       NULL, NULL, NULL, NULL, NULL, NULL,
380
 
                                       NULL, NULL, NULL, NULL, NULL, NULL,
 
381
                                       &checksum, NULL, NULL, NULL, NULL, NULL,
381
382
                                       NULL, NULL, NULL, NULL, NULL, NULL,
382
383
                                       NULL, NULL, NULL, NULL, NULL,
383
384
                                       db, this_abspath, iterpool, iterpool));
384
385
 
385
 
          if (wrk_status == svn_wc__db_status_added)
386
 
            SVN_ERR(svn_wc__db_scan_addition(&wrk_status, NULL, NULL, NULL,
387
 
                                             NULL, NULL, NULL, NULL, NULL,
388
 
                                             db, this_abspath,
389
 
                                             iterpool, iterpool));
390
 
 
391
 
          if (wrk_status == svn_wc__db_status_normal
392
 
              || wrk_status == svn_wc__db_status_copied
393
 
              || wrk_status == svn_wc__db_status_moved_here
394
 
              || (wrk_kind == svn_wc__db_kind_dir
395
 
                  && (wrk_status == svn_wc__db_status_added
396
 
                      || wrk_status == svn_wc__db_status_incomplete)))
 
386
          if ((wrk_status == svn_wc__db_status_normal
 
387
               || wrk_status == svn_wc__db_status_added
 
388
               || wrk_status == svn_wc__db_status_incomplete)
 
389
              && (wrk_kind == svn_node_dir || checksum))
397
390
            {
398
391
              svn_node_kind_t dirent_kind;
399
392
 
420
413
        }
421
414
      else
422
415
        {
423
 
          const char *childname = svn_relpath__is_child(dir_repos_relpath,
424
 
                                                        ths->repos_relpath,
425
 
                                                        NULL);
 
416
          const char *childname
 
417
            = svn_relpath_skip_ancestor(dir_repos_relpath, ths->repos_relpath);
426
418
 
427
419
          if (childname == NULL || strcmp(childname, child) != 0)
428
420
            {
435
427
        ths->depth = svn_depth_infinity;
436
428
 
437
429
      /*** Files ***/
438
 
      if (ths->kind == svn_wc__db_kind_file ||
439
 
               ths->kind == svn_wc__db_kind_symlink)
 
430
      if (ths->kind == svn_node_file
 
431
          || ths->kind == svn_node_symlink)
440
432
        {
441
433
          if (report_everything)
442
434
            {
489
481
        } /* end file case */
490
482
 
491
483
      /*** Directories (in recursive mode) ***/
492
 
      else if (ths->kind == svn_wc__db_kind_dir
 
484
      else if (ths->kind == svn_node_dir
493
485
               && (depth > svn_depth_files
494
486
                   || depth == svn_depth_unknown))
495
487
        {
646
638
  svn_revnum_t target_rev = SVN_INVALID_REVNUM;
647
639
  svn_boolean_t start_empty;
648
640
  svn_wc__db_status_t status;
649
 
  svn_wc__db_kind_t target_kind;
 
641
  svn_node_kind_t target_kind;
650
642
  const char *repos_relpath, *repos_root_url;
651
643
  svn_depth_t target_depth;
652
644
  svn_wc__db_lock_t *target_lock;
660
652
                                 &repos_relpath, &repos_root_url,
661
653
                                 NULL, NULL, NULL, NULL, &target_depth,
662
654
                                 NULL, NULL, &target_lock,
663
 
                                 NULL, NULL,
 
655
                                 NULL, NULL, NULL,
664
656
                                 db, local_abspath, scratch_pool,
665
657
                                 scratch_pool);
666
658
 
693
685
      return SVN_NO_ERROR;
694
686
    }
695
687
 
696
 
  if (! repos_relpath)
697
 
    SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath, &repos_root_url, NULL,
698
 
                                       db, local_abspath,
699
 
                                       scratch_pool, scratch_pool));
700
 
 
701
688
  if (target_depth == svn_depth_unknown)
702
689
    target_depth = svn_depth_infinity;
703
690
 
719
706
      && disk_kind == svn_node_none)
720
707
    {
721
708
      svn_wc__db_status_t wrk_status;
722
 
      svn_wc__db_kind_t wrk_kind;
 
709
      svn_node_kind_t wrk_kind;
 
710
      const svn_checksum_t *checksum;
 
711
 
723
712
      err = svn_wc__db_read_info(&wrk_status, &wrk_kind, NULL, NULL, NULL,
724
 
                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
713
                                 NULL, NULL, NULL, NULL, NULL, &checksum, NULL,
725
714
                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
726
715
                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
727
716
                                 NULL,
733
722
        {
734
723
          svn_error_clear(err);
735
724
          wrk_status = svn_wc__db_status_not_present;
736
 
          wrk_kind = svn_wc__db_kind_file;
 
725
          wrk_kind = svn_node_file;
737
726
        }
738
727
      else
739
728
        SVN_ERR(err);
740
729
 
741
 
      if (wrk_status == svn_wc__db_status_added)
742
 
        SVN_ERR(svn_wc__db_scan_addition(&wrk_status, NULL, NULL, NULL, NULL,
743
 
                                         NULL, NULL, NULL, NULL,
744
 
                                         db, local_abspath,
745
 
                                         scratch_pool, scratch_pool));
746
 
 
747
 
      if (wrk_status == svn_wc__db_status_normal
748
 
          || wrk_status == svn_wc__db_status_copied
749
 
          || wrk_status == svn_wc__db_status_moved_here
750
 
          || (wrk_kind == svn_wc__db_kind_dir
751
 
              && (wrk_status == svn_wc__db_status_added
752
 
                  || wrk_status == svn_wc__db_status_incomplete)))
 
730
      if ((wrk_status == svn_wc__db_status_normal
 
731
          || wrk_status == svn_wc__db_status_added
 
732
          || wrk_status == svn_wc__db_status_incomplete)
 
733
          && (wrk_kind == svn_node_dir || checksum))
753
734
        {
754
735
          SVN_ERR(restore_node(wc_ctx->db, local_abspath,
755
736
                               wrk_kind, use_commit_times,
772
753
    SVN_ERR(reporter->set_path(report_baton, "", target_rev, report_depth,
773
754
                               start_empty, NULL, scratch_pool));
774
755
  }
775
 
  if (target_kind == svn_wc__db_kind_dir)
 
756
  if (target_kind == svn_node_dir)
776
757
    {
777
758
      if (depth != svn_depth_empty)
778
759
        {
799
780
        }
800
781
    }
801
782
 
802
 
  else if (target_kind == svn_wc__db_kind_file ||
803
 
           target_kind == svn_wc__db_kind_symlink)
 
783
  else if (target_kind == svn_node_file || target_kind == svn_node_symlink)
804
784
    {
805
785
      const char *parent_abspath, *base;
806
786
      svn_wc__db_status_t parent_status;
814
794
      err = svn_wc__db_base_get_info(&parent_status, NULL, NULL,
815
795
                                     &parent_repos_relpath, NULL, NULL, NULL,
816
796
                                     NULL, NULL, NULL, NULL, NULL, NULL,
817
 
                                     NULL, NULL,
 
797
                                     NULL, NULL, NULL,
818
798
                                     db, parent_abspath,
819
799
                                     scratch_pool, scratch_pool);
820
800
 
1211
1191
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
1212
1192
  int i;
1213
1193
  apr_array_header_t *propmods;
1214
 
  svn_wc__db_kind_t kind;
1215
 
 
1216
 
  SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath, FALSE, iterpool));
 
1194
  svn_node_kind_t kind;
 
1195
 
 
1196
  SVN_ERR(svn_wc__db_read_kind(&kind, db, local_abspath,
 
1197
                               FALSE /* allow_missing */,
 
1198
                               FALSE /* show_deleted */,
 
1199
                               FALSE /* show_hidden */,
 
1200
                               iterpool));
 
1201
 
 
1202
  if (kind == svn_node_none)
 
1203
    return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
 
1204
                             _("The node '%s' was not found."),
 
1205
                             svn_dirent_local_style(local_abspath, iterpool));
1217
1206
 
1218
1207
  /* Get an array of local changes by comparing the hashes. */
1219
1208
  SVN_ERR(svn_wc__internal_propdiff(&propmods, NULL, db, local_abspath,
1226
1215
 
1227
1216
      svn_pool_clear(iterpool);
1228
1217
 
1229
 
      if (kind == svn_wc__db_kind_file)
 
1218
      if (kind == svn_node_file)
1230
1219
        SVN_ERR(editor->change_file_prop(baton, p->name, p->value,
1231
1220
                                         iterpool));
1232
1221
      else