FreeBSD/contrib/subversion/subversion/libsvn_wc/wc_db_update_move.c
/* The guts of bump_moved_away: Determines if a move can be bumped to match
 * the move origin and if so performs this bump.
 */
The guts of bump_moved_away: Determines if a move can be bumped to match
the move origin and if so performs this bump.
The guts of bump_moved_away : Determines if a move can be bumped to match the move origin and if so performs this bump .
static svn_error_t *
bump_moved_layer(svn_boolean_t *recurse,
                 svn_wc__db_wcroot_t *wcroot,
                 const char *local_relpath,
                 int op_depth,
                 const char *src_relpath,
                 int src_del_depth,
                 svn_depth_t src_depth,
                 const char *dst_relpath,
                 svn_wc__db_t *db,
                 apr_pool_t *scratch_pool)
{
  svn_sqlite__stmt_t *stmt;
  svn_boolean_t have_row;
  svn_skel_t *conflict;
  svn_boolean_t can_bump;
  const char *src_root_relpath;
  SVN_ERR(verify_write_lock(wcroot, local_relpath, scratch_pool));
  *recurse = FALSE;
  SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                    STMT_HAS_LAYER_BETWEEN));
  SVN_ERR(svn_sqlite__bindf(stmt, "isdd", wcroot->wc_id, local_relpath,
                            op_depth, src_del_depth));
  SVN_ERR(svn_sqlite__step(&have_row, stmt));
  SVN_ERR(svn_sqlite__reset(stmt));
  if (have_row)
    return SVN_NO_ERROR;
  if (op_depth == 0)
    SVN_ERR(depth_sufficient_to_bump(&can_bump, wcroot, src_relpath,
                                     op_depth, src_depth, scratch_pool));
  else
    can_bump = TRUE;
  if (can_bump)
    {
      svn_boolean_t locked;
      SVN_ERR(svn_wc__db_wclock_owns_lock_internal(&locked, wcroot,
                                                   dst_relpath,
                                                   FALSE, scratch_pool));
      if (!locked)
        can_bump = FALSE;
    }
  src_root_relpath = svn_relpath_prefix(src_relpath, src_del_depth,
                                        scratch_pool);
  if (!can_bump)
    {
      SVN_ERR(bump_mark_tree_conflict(wcroot, src_relpath, op_depth,
                                      src_root_relpath, dst_relpath,
                                      db, scratch_pool));
      return SVN_NO_ERROR;
    }
  SVN_ERR(svn_wc__db_read_conflict_internal(&conflict, NULL, NULL,
                                            wcroot, src_root_relpath,
                                            scratch_pool, scratch_pool));
  if (!conflict)
    {
      SVN_ERR(verify_write_lock(wcroot, src_relpath, scratch_pool));
      SVN_ERR(svn_wc__db_op_copy_layer_internal(wcroot,
                                                src_relpath, op_depth,
                                                dst_relpath, NULL, NULL,
                                                scratch_pool));
      *recurse = TRUE;
    }
  return SVN_NO_ERROR;
}
static svn_error_t * bump_moved_layer ( svn_boolean_t * recurse , svn_wc__db_wcroot_t * wcroot , const char * local_relpath , int op_depth , const char * src_relpath , int src_del_depth , svn_depth_t src_depth , const char * dst_relpath , svn_wc__db_t * db , apr_pool_t * scratch_pool ) { svn_sqlite__stmt_t * stmt ; svn_boolean_t have_row ; svn_skel_t * conflict ; svn_boolean_t can_bump ; const char * src_root_relpath ; SVN_ERR ( verify_write_lock ( wcroot , local_relpath , scratch_pool ) ) ; * recurse = FALSE ; SVN_ERR ( svn_sqlite__get_statement ( & stmt , wcroot -> sdb , STMT_HAS_LAYER_BETWEEN ) ) ; SVN_ERR ( svn_sqlite__bindf ( stmt , " " , wcroot -> wc_id , local_relpath , op_depth , src_del_depth ) ) ; SVN_ERR ( svn_sqlite__step ( & have_row , stmt ) ) ; SVN_ERR ( svn_sqlite__reset ( stmt ) ) ; if ( have_row ) return SVN_NO_ERROR ; if ( op_depth == 0 ) SVN_ERR ( depth_sufficient_to_bump ( & can_bump , wcroot , src_relpath , op_depth , src_depth , scratch_pool ) ) ; else can_bump = TRUE ; if ( can_bump ) { svn_boolean_t locked ; SVN_ERR ( svn_wc__db_wclock_owns_lock_internal ( & locked , wcroot , dst_relpath , FALSE , scratch_pool ) ) ; if ( ! locked ) can_bump = FALSE ; } src_root_relpath = svn_relpath_prefix ( src_relpath , src_del_depth , scratch_pool ) ; if ( ! can_bump ) { SVN_ERR ( bump_mark_tree_conflict ( wcroot , src_relpath , op_depth , src_root_relpath , dst_relpath , db , scratch_pool ) ) ; return SVN_NO_ERROR ; } SVN_ERR ( svn_wc__db_read_conflict_internal ( & conflict , NULL , NULL , wcroot , src_root_relpath , scratch_pool , scratch_pool ) ) ; if ( ! conflict ) { SVN_ERR ( verify_write_lock ( wcroot , src_relpath , scratch_pool ) ) ; SVN_ERR ( svn_wc__db_op_copy_layer_internal ( wcroot , src_relpath , op_depth , dst_relpath , NULL , NULL , scratch_pool ) ) ; * recurse = TRUE ; } return SVN_NO_ERROR ; }
The guts of bump_moved_away: Determines if a move can be bumped to match
 the move origin and if so performs this bump.
The guts of bump_moved_away : Determines if a move can be bumped to match the move origin and if so performs this bump .
/* Having chosen to bump an entire BASE tree move we
       always have sufficient depth to bump subtree moves. */ /* Are we allowed to bump */ /* ### TODO: check this is the right sort of tree-conflict? */ /* ### TODO: verify moved_here? */