FreeBSD/contrib/subversion/subversion/libsvn_wc/wc_db_update_move.c
/* Create a tree-conflict for recording on LOCAL_RELPATH if such
   a tree-conflict does not already exist. */
Create a tree-conflict for recording on LOCAL_RELPATH if such
a tree-conflict does not already exist.
Create a tree - conflict for recording on LOCAL_RELPATH if such a tree - conflict does not already exist .
static svn_error_t *
create_tree_conflict(svn_skel_t **conflict_p,
                     svn_wc__db_wcroot_t *wcroot,
                     const char *local_relpath,
                     const char *dst_op_root_relpath,
                     svn_wc__db_t *db,
                     const svn_wc_conflict_version_t *old_version,
                     const svn_wc_conflict_version_t *new_version,
                     svn_wc_operation_t operation,
                     svn_node_kind_t old_kind,
                     svn_node_kind_t new_kind,
                     const char *old_repos_relpath,
                     svn_wc_conflict_reason_t reason,
                     svn_wc_conflict_action_t action,
                     const char *move_src_op_root_relpath,
                     apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool)
{
  svn_error_t *err;
  svn_skel_t *conflict;
  svn_wc_conflict_version_t *conflict_old_version, *conflict_new_version;
  const char *move_src_op_root_abspath
    = move_src_op_root_relpath
    ? svn_dirent_join(wcroot->abspath,
                      move_src_op_root_relpath, scratch_pool)
    : NULL;
  const char *old_repos_relpath_part
    = old_repos_relpath
    ? svn_relpath_skip_ancestor(old_version->path_in_repos,
                                old_repos_relpath)
    : NULL;
  const char *new_repos_relpath
    = old_repos_relpath_part
    ? svn_relpath_join(new_version->path_in_repos, old_repos_relpath_part,
                       scratch_pool)
    : NULL;
  if (!new_repos_relpath)
    {
      const char *child_relpath = svn_relpath_skip_ancestor(
                                            dst_op_root_relpath,
                                            local_relpath);
      SVN_ERR_ASSERT(child_relpath != NULL);
      new_repos_relpath = svn_relpath_join(new_version->path_in_repos,
                                           child_relpath, scratch_pool);
    }
  err = svn_wc__db_read_conflict_internal(&conflict, NULL, NULL,
                                          wcroot, local_relpath,
                                          result_pool, scratch_pool);
  if (err && err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
    return svn_error_trace(err);
  else if (err)
    {
      svn_error_clear(err);
      conflict = NULL;
    }
  if (conflict)
    {
      svn_wc_operation_t conflict_operation;
      svn_boolean_t tree_conflicted;
      SVN_ERR(svn_wc__conflict_read_info(&conflict_operation, NULL, NULL, NULL,
                                         &tree_conflicted,
                                         db, wcroot->abspath, conflict,
                                         scratch_pool, scratch_pool));
      if (conflict_operation != svn_wc_operation_update
          && conflict_operation != svn_wc_operation_switch)
        return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
                                 _("'%s' already in conflict"),
                                 path_for_error_message(wcroot, local_relpath,
                                                        scratch_pool));
      if (tree_conflicted)
        {
          svn_wc_conflict_reason_t existing_reason;
          svn_wc_conflict_action_t existing_action;
          const char *existing_abspath;
          SVN_ERR(svn_wc__conflict_read_tree_conflict(&existing_reason,
                                                      &existing_action,
                                                      &existing_abspath,
                                                      db, wcroot->abspath,
                                                      conflict,
                                                      scratch_pool,
                                                      scratch_pool));
          if (reason != existing_reason
              || action != existing_action
              || (reason == svn_wc_conflict_reason_moved_away
                  && strcmp(move_src_op_root_relpath,
                            svn_dirent_skip_ancestor(wcroot->abspath,
                                                     existing_abspath))))
            return svn_error_createf(SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
                                     _("'%s' already in conflict"),
                                     path_for_error_message(wcroot,
                                                            local_relpath,
                                                            scratch_pool));
          *conflict_p = conflict;
          return SVN_NO_ERROR;
        }
    }
  else
    conflict = svn_wc__conflict_skel_create(result_pool);
  SVN_ERR(svn_wc__conflict_skel_add_tree_conflict(
                     conflict, db,
                     svn_dirent_join(wcroot->abspath, local_relpath,
                                     scratch_pool),
                     reason,
                     action,
                     move_src_op_root_abspath,
                     result_pool,
                     scratch_pool));
  conflict_old_version = svn_wc_conflict_version_create2(
                               old_version->repos_url, old_version->repos_uuid,
                               old_repos_relpath, old_version->peg_rev,
                               old_kind, scratch_pool);
  conflict_new_version = svn_wc_conflict_version_create2(
                           new_version->repos_url, new_version->repos_uuid,
                           new_repos_relpath, new_version->peg_rev,
                           new_kind, scratch_pool);
  if (operation == svn_wc_operation_update)
    {
      SVN_ERR(svn_wc__conflict_skel_set_op_update(
                conflict, conflict_old_version, conflict_new_version,
                result_pool, scratch_pool));
    }
  else
    {
      assert(operation == svn_wc_operation_switch);
      SVN_ERR(svn_wc__conflict_skel_set_op_switch(
                  conflict, conflict_old_version, conflict_new_version,
                  result_pool, scratch_pool));
    }
  *conflict_p = conflict;
  return SVN_NO_ERROR;
}
static svn_error_t * create_tree_conflict ( svn_skel_t * * conflict_p , svn_wc__db_wcroot_t * wcroot , const char * local_relpath , const char * dst_op_root_relpath , svn_wc__db_t * db , const svn_wc_conflict_version_t * old_version , const svn_wc_conflict_version_t * new_version , svn_wc_operation_t operation , svn_node_kind_t old_kind , svn_node_kind_t new_kind , const char * old_repos_relpath , svn_wc_conflict_reason_t reason , svn_wc_conflict_action_t action , const char * move_src_op_root_relpath , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { svn_error_t * err ; svn_skel_t * conflict ; svn_wc_conflict_version_t * conflict_old_version , * conflict_new_version ; const char * move_src_op_root_abspath = move_src_op_root_relpath ? svn_dirent_join ( wcroot -> abspath , move_src_op_root_relpath , scratch_pool ) : NULL ; const char * old_repos_relpath_part = old_repos_relpath ? svn_relpath_skip_ancestor ( old_version -> path_in_repos , old_repos_relpath ) : NULL ; const char * new_repos_relpath = old_repos_relpath_part ? svn_relpath_join ( new_version -> path_in_repos , old_repos_relpath_part , scratch_pool ) : NULL ; if ( ! new_repos_relpath ) { const char * child_relpath = svn_relpath_skip_ancestor ( dst_op_root_relpath , local_relpath ) ; SVN_ERR_ASSERT ( child_relpath != NULL ) ; new_repos_relpath = svn_relpath_join ( new_version -> path_in_repos , child_relpath , scratch_pool ) ; } err = svn_wc__db_read_conflict_internal ( & conflict , NULL , NULL , wcroot , local_relpath , result_pool , scratch_pool ) ; if ( err && err -> apr_err != SVN_ERR_WC_PATH_NOT_FOUND ) return svn_error_trace ( err ) ; else if ( err ) { svn_error_clear ( err ) ; conflict = NULL ; } if ( conflict ) { svn_wc_operation_t conflict_operation ; svn_boolean_t tree_conflicted ; SVN_ERR ( svn_wc__conflict_read_info ( & conflict_operation , NULL , NULL , NULL , & tree_conflicted , db , wcroot -> abspath , conflict , scratch_pool , scratch_pool ) ) ; if ( conflict_operation != svn_wc_operation_update && conflict_operation != svn_wc_operation_switch ) return svn_error_createf ( SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE , NULL , _ ( " " ) , path_for_error_message ( wcroot , local_relpath , scratch_pool ) ) ; if ( tree_conflicted ) { svn_wc_conflict_reason_t existing_reason ; svn_wc_conflict_action_t existing_action ; const char * existing_abspath ; SVN_ERR ( svn_wc__conflict_read_tree_conflict ( & existing_reason , & existing_action , & existing_abspath , db , wcroot -> abspath , conflict , scratch_pool , scratch_pool ) ) ; if ( reason != existing_reason || action != existing_action || ( reason == svn_wc_conflict_reason_moved_away && strcmp ( move_src_op_root_relpath , svn_dirent_skip_ancestor ( wcroot -> abspath , existing_abspath ) ) ) ) return svn_error_createf ( SVN_ERR_WC_OBSTRUCTED_UPDATE , NULL , _ ( " " ) , path_for_error_message ( wcroot , local_relpath , scratch_pool ) ) ; * conflict_p = conflict ; return SVN_NO_ERROR ; } } else conflict = svn_wc__conflict_skel_create ( result_pool ) ; SVN_ERR ( svn_wc__conflict_skel_add_tree_conflict ( conflict , db , svn_dirent_join ( wcroot -> abspath , local_relpath , scratch_pool ) , reason , action , move_src_op_root_abspath , result_pool , scratch_pool ) ) ; conflict_old_version = svn_wc_conflict_version_create2 ( old_version -> repos_url , old_version -> repos_uuid , old_repos_relpath , old_version -> peg_rev , old_kind , scratch_pool ) ; conflict_new_version = svn_wc_conflict_version_create2 ( new_version -> repos_url , new_version -> repos_uuid , new_repos_relpath , new_version -> peg_rev , new_kind , scratch_pool ) ; if ( operation == svn_wc_operation_update ) { SVN_ERR ( svn_wc__conflict_skel_set_op_update ( conflict , conflict_old_version , conflict_new_version , result_pool , scratch_pool ) ) ; } else { assert ( operation == svn_wc_operation_switch ) ; SVN_ERR ( svn_wc__conflict_skel_set_op_switch ( conflict , conflict_old_version , conflict_new_version , result_pool , scratch_pool ) ) ; } * conflict_p = conflict ; return SVN_NO_ERROR ; }
Create a tree-conflict for recording on LOCAL_RELPATH if such
a tree-conflict does not already exist.
Create a tree - conflict for recording on LOCAL_RELPATH if such a tree - conflict does not already exist .
/* Already a suitable tree-conflict. */