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

« back to all changes in this revision

Viewing changes to subversion/libsvn_client/merge.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2014-05-20 22:45:32 UTC
  • mfrom: (0.2.12)
  • Revision ID: package-import@ubuntu.com-20140520224532-4fec3gohdzyy692g
Tags: 1.8.9-1
* New upstream release
* Merge changes from Ubuntu:
  - Add DEB-8 test for Apache functionality
  - debian/rules: Create pot file on build.
  - debian/rules: Ensure the doxygen output directory exists
  - Move svn2cl to subversion-tools' Suggests on Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
322
322
  const char *diff3_cmd;
323
323
  const apr_array_header_t *merge_options;
324
324
 
 
325
  /* Array of file extension patterns to preserve as extensions in
 
326
     generated conflict files. */
 
327
  const apr_array_header_t *ext_patterns;
 
328
 
325
329
  /* RA sessions used throughout a merge operation.  Opened/re-parented
326
330
     as needed.
327
331
 
2023
2027
    {
2024
2028
      svn_boolean_t has_local_mods;
2025
2029
      enum svn_wc_merge_outcome_t content_outcome;
 
2030
      const char *target_label;
 
2031
      const char *left_label;
 
2032
      const char *right_label;
 
2033
      const char *path_ext = "";
 
2034
 
 
2035
      if (merge_b->ext_patterns && merge_b->ext_patterns->nelts)
 
2036
        {
 
2037
          svn_path_splitext(NULL, &path_ext, local_abspath, scratch_pool);
 
2038
          if (! (*path_ext
 
2039
                 && svn_cstring_match_glob_list(path_ext,
 
2040
                                                merge_b->ext_patterns)))
 
2041
            {
 
2042
              path_ext = "";
 
2043
            }
 
2044
        }
2026
2045
 
2027
2046
      /* xgettext: the '.working', '.merge-left.r%ld' and
2028
2047
         '.merge-right.r%ld' strings are used to tag onto a file
2029
2048
         name in case of a merge conflict */
2030
 
      const char *target_label = _(".working");
2031
 
      const char *left_label = apr_psprintf(scratch_pool,
2032
 
                                            _(".merge-left.r%ld"),
2033
 
                                            left_source->revision);
2034
 
      const char *right_label = apr_psprintf(scratch_pool,
2035
 
                                             _(".merge-right.r%ld"),
2036
 
                                             right_source->revision);
 
2049
 
 
2050
      target_label = apr_psprintf(scratch_pool, _(".working%s%s"),
 
2051
                                  *path_ext ? "." : "", path_ext);
 
2052
      left_label = apr_psprintf(scratch_pool,
 
2053
                                _(".merge-left.r%ld%s%s"),
 
2054
                                left_source->revision,
 
2055
                                *path_ext ? "." : "", path_ext);
 
2056
      right_label = apr_psprintf(scratch_pool,
 
2057
                                 _(".merge-right.r%ld%s%s"),
 
2058
                                 right_source->revision,
 
2059
                                 *path_ext ? "." : "", path_ext);
2037
2060
 
2038
2061
      SVN_ERR(svn_wc_text_modified_p2(&has_local_mods, ctx->wc_ctx,
2039
2062
                                      local_abspath, FALSE, scratch_pool));
3062
3085
  struct merge_dir_baton_t *db = dir_baton;
3063
3086
  const char *local_abspath = svn_dirent_join(merge_b->target->abspath,
3064
3087
                                              relpath, scratch_pool);
3065
 
  struct dir_delete_baton_t *delb;
3066
3088
  svn_boolean_t same;
3067
3089
  apr_hash_t *working_props;
3068
3090
 
3093
3115
                            scratch_pool, scratch_pool));
3094
3116
 
3095
3117
  if (merge_b->force_delete)
3096
 
    same = TRUE;
 
3118
    {
 
3119
      /* In this legacy mode we just assume that a directory delete
 
3120
         matches any directory. db->delete_state is NULL */
 
3121
      same = TRUE;
 
3122
    }
3097
3123
  else
3098
3124
    {
 
3125
      struct dir_delete_baton_t *delb;
 
3126
 
3099
3127
      /* Compare the properties */
3100
3128
      SVN_ERR(properties_same_p(&same, left_props, working_props,
3101
3129
                                scratch_pool));
3102
 
    }
3103
 
 
3104
 
  delb = db->delete_state;
3105
 
  assert(delb != NULL);
3106
 
 
3107
 
  if (! same)
3108
 
    {
3109
 
      delb->found_edit = TRUE;
3110
 
    }
3111
 
  else
3112
 
    {
3113
 
      store_path(delb->compared_abspaths, local_abspath);
3114
 
    }
3115
 
 
3116
 
  if (delb->del_root != db)
3117
 
    return SVN_NO_ERROR;
3118
 
 
3119
 
  if (delb->found_edit)
3120
 
    same = FALSE;
3121
 
  else if (merge_b->force_delete)
3122
 
    same = TRUE;
3123
 
  else
3124
 
    {
3125
 
      apr_array_header_t *ignores;
3126
 
      svn_error_t *err;
3127
 
      same = TRUE;
3128
 
 
3129
 
      SVN_ERR(svn_wc_get_default_ignores(&ignores, merge_b->ctx->config,
3130
 
                                         scratch_pool));
3131
 
 
3132
 
      /* None of the descendants was modified, but maybe there are
3133
 
         descendants we haven't walked?
3134
 
 
3135
 
         Note that we aren't interested in changes, as we already verified
3136
 
         changes in the paths touched by the merge. And the existance of
3137
 
         other paths is enough to mark the directory edited */
3138
 
      err = svn_wc_walk_status(merge_b->ctx->wc_ctx, local_abspath,
3139
 
                               svn_depth_infinity, TRUE /* get-all */,
3140
 
                               FALSE /* no-ignore */,
3141
 
                               TRUE /* ignore-text-mods */, ignores,
3142
 
                               verify_touched_by_del_check, delb,
3143
 
                               merge_b->ctx->cancel_func,
3144
 
                               merge_b->ctx->cancel_baton,
3145
 
                               scratch_pool);
3146
 
 
3147
 
      if (err)
3148
 
        {
3149
 
          if (err->apr_err != SVN_ERR_CEASE_INVOCATION)
3150
 
            return svn_error_trace(err);
3151
 
 
3152
 
          svn_error_clear(err);
3153
 
        }
3154
 
 
3155
 
      same = ! delb->found_edit;
 
3130
      delb = db->delete_state;
 
3131
      assert(delb != NULL);
 
3132
 
 
3133
      if (! same)
 
3134
        {
 
3135
          delb->found_edit = TRUE;
 
3136
        }
 
3137
      else
 
3138
        {
 
3139
          store_path(delb->compared_abspaths, local_abspath);
 
3140
        }
 
3141
 
 
3142
      if (delb->del_root != db)
 
3143
        return SVN_NO_ERROR;
 
3144
 
 
3145
      if (delb->found_edit)
 
3146
        same = FALSE;
 
3147
      else
 
3148
        {
 
3149
          apr_array_header_t *ignores;
 
3150
          svn_error_t *err;
 
3151
          same = TRUE;
 
3152
 
 
3153
          SVN_ERR(svn_wc_get_default_ignores(&ignores, merge_b->ctx->config,
 
3154
                                             scratch_pool));
 
3155
 
 
3156
          /* None of the descendants was modified, but maybe there are
 
3157
             descendants we haven't walked?
 
3158
 
 
3159
             Note that we aren't interested in changes, as we already verified
 
3160
             changes in the paths touched by the merge. And the existence of
 
3161
             other paths is enough to mark the directory edited */
 
3162
          err = svn_wc_walk_status(merge_b->ctx->wc_ctx, local_abspath,
 
3163
                                   svn_depth_infinity, TRUE /* get-all */,
 
3164
                                   FALSE /* no-ignore */,
 
3165
                                   TRUE /* ignore-text-mods */, ignores,
 
3166
                                   verify_touched_by_del_check, delb,
 
3167
                                   merge_b->ctx->cancel_func,
 
3168
                                   merge_b->ctx->cancel_baton,
 
3169
                                   scratch_pool);
 
3170
 
 
3171
          if (err)
 
3172
            {
 
3173
              if (err->apr_err != SVN_ERR_CEASE_INVOCATION)
 
3174
                return svn_error_trace(err);
 
3175
 
 
3176
              svn_error_clear(err);
 
3177
            }
 
3178
 
 
3179
          same = ! delb->found_edit;
 
3180
        }
3156
3181
    }
3157
3182
 
3158
3183
  if (same && !merge_b->dry_run)
9668
9693
  merge_cmd_baton_t merge_cmd_baton = { 0 };
9669
9694
  svn_config_t *cfg;
9670
9695
  const char *diff3_cmd;
 
9696
  const char *preserved_exts_str;
9671
9697
  int i;
9672
9698
  svn_boolean_t checked_mergeinfo_capability = FALSE;
9673
9699
  svn_ra_session_t *ra_session1 = NULL, *ra_session2 = NULL;
9728
9754
  if (diff3_cmd != NULL)
9729
9755
    SVN_ERR(svn_path_cstring_to_utf8(&diff3_cmd, diff3_cmd, scratch_pool));
9730
9756
 
 
9757
    /* See which files the user wants to preserve the extension of when
 
9758
     conflict files are made. */
 
9759
  svn_config_get(cfg, &preserved_exts_str, SVN_CONFIG_SECTION_MISCELLANY,
 
9760
                 SVN_CONFIG_OPTION_PRESERVED_CF_EXTS, "");
 
9761
 
9731
9762
  /* Build the merge context baton (or at least the parts of it that
9732
9763
     don't need to be reset for each merge source).  */
9733
9764
  merge_cmd_baton.force_delete = force_delete;
9743
9774
  merge_cmd_baton.pool = iterpool;
9744
9775
  merge_cmd_baton.merge_options = merge_options;
9745
9776
  merge_cmd_baton.diff3_cmd = diff3_cmd;
 
9777
  merge_cmd_baton.ext_patterns = *preserved_exts_str
 
9778
                          ? svn_cstring_split(preserved_exts_str, "\n\r\t\v ",
 
9779
                                              FALSE, scratch_pool)
 
9780
                          : NULL;
 
9781
 
9746
9782
  merge_cmd_baton.use_sleep = use_sleep;
9747
9783
 
9748
9784
  /* Do we already know the specific subtrees with mergeinfo we want
10447
10483
    }
10448
10484
  else
10449
10485
    {
10450
 
      merge_source_t source;
10451
 
 
10452
 
      source.loc1 = source1_loc;
10453
 
      source.loc2 = source2_loc;
10454
 
      source.ancestral = FALSE;
10455
 
 
10456
10486
      /* Build a single-item merge_source_t array. */
10457
10487
      merge_sources = apr_array_make(scratch_pool, 1, sizeof(merge_source_t *));
10458
 
      APR_ARRAY_PUSH(merge_sources, merge_source_t *) = &source;
 
10488
      APR_ARRAY_PUSH(merge_sources, merge_source_t *)
 
10489
        = merge_source_create(source1_loc, source2_loc, FALSE, scratch_pool);
10459
10490
    }
10460
10491
 
10461
10492
  err = do_merge(NULL, NULL, conflict_report, &use_sleep,
10761
10792
   UNMERGED_CATALOG represents the history (as mergeinfo) from
10762
10793
   TARGET_LOC that is not represented in SOURCE_LOC's
10763
10794
   explicit/inherited mergeinfo as represented by MERGED_CATALOG.
10764
 
   MERGEINFO_CATALOG may be empty if the source has no explicit or inherited
 
10795
   MERGED_CATALOG may be empty if the source has no explicit or inherited
10765
10796
   mergeinfo.
10766
10797
 
10767
10798
   Check that all of the unmerged revisions in UNMERGED_CATALOG's
11464
11495
         prefix. */
11465
11496
      svn_mergeinfo_catalog_t final_unmerged_catalog = apr_hash_make(scratch_pool);
11466
11497
 
11467
 
      SVN_ERR(find_unsynced_ranges(source_loc, yc_ancestor,
 
11498
      SVN_ERR(find_unsynced_ranges(source_loc, &target->loc,
11468
11499
                                   unmerged_to_source_mergeinfo_catalog,
11469
11500
                                   merged_to_source_mergeinfo_catalog,
11470
11501
                                   final_unmerged_catalog,