FreeBSD/contrib/subversion/subversion/libsvn_ra_serf/update.c
/** Helpers to open and close directories */
Helpers to open and close directories
Helpers to open and close directories
static svn_error_t*
ensure_dir_opened(dir_baton_t *dir,
                  apr_pool_t *scratch_pool)
{
  report_context_t *ctx = dir->ctx;
  if (dir->dir_opened)
    return SVN_NO_ERROR;
  if (dir->base_name[0] == '\0')
    {
      if (ctx->destination
          && ctx->sess->wc_callbacks->invalidate_wc_props)
        {
          SVN_ERR(ctx->sess->wc_callbacks->invalidate_wc_props(
                      ctx->sess->wc_callback_baton,
                      ctx->update_target,
                      SVN_RA_SERF__WC_CHECKED_IN_URL, scratch_pool));
        }
      SVN_ERR(ctx->editor->open_root(ctx->editor_baton, dir->base_rev,
                                     dir->pool,
                                     &dir->dir_baton));
    }
  else
    {
      SVN_ERR(ensure_dir_opened(dir->parent_dir, scratch_pool));
      if (SVN_IS_VALID_REVNUM(dir->base_rev))
        {
          SVN_ERR(ctx->editor->open_directory(dir->relpath,
                                              dir->parent_dir->dir_baton,
                                              dir->base_rev,
                                              dir->pool,
                                              &dir->dir_baton));
        }
      else
        {
          SVN_ERR(ctx->editor->add_directory(dir->relpath,
                                             dir->parent_dir->dir_baton,
                                             dir->copyfrom_path,
                                             dir->copyfrom_rev,
                                             dir->pool,
                                             &dir->dir_baton));
        }
    }
  dir->dir_opened = TRUE;
  return SVN_NO_ERROR;
}
static svn_error_t * ensure_dir_opened ( dir_baton_t * dir , apr_pool_t * scratch_pool ) { report_context_t * ctx = dir -> ctx ; if ( dir -> dir_opened ) return SVN_NO_ERROR ; if ( dir -> base_name [ 0 ] == ' \0 ' ) { if ( ctx -> destination && ctx -> sess -> wc_callbacks -> invalidate_wc_props ) { SVN_ERR ( ctx -> sess -> wc_callbacks -> invalidate_wc_props ( ctx -> sess -> wc_callback_baton , ctx -> update_target , SVN_RA_SERF__WC_CHECKED_IN_URL , scratch_pool ) ) ; } SVN_ERR ( ctx -> editor -> open_root ( ctx -> editor_baton , dir -> base_rev , dir -> pool , & dir -> dir_baton ) ) ; } else { SVN_ERR ( ensure_dir_opened ( dir -> parent_dir , scratch_pool ) ) ; if ( SVN_IS_VALID_REVNUM ( dir -> base_rev ) ) { SVN_ERR ( ctx -> editor -> open_directory ( dir -> relpath , dir -> parent_dir -> dir_baton , dir -> base_rev , dir -> pool , & dir -> dir_baton ) ) ; } else { SVN_ERR ( ctx -> editor -> add_directory ( dir -> relpath , dir -> parent_dir -> dir_baton , dir -> copyfrom_path , dir -> copyfrom_rev , dir -> pool , & dir -> dir_baton ) ) ; } } dir -> dir_opened = TRUE ; return SVN_NO_ERROR ; }
Helpers to open and close directories
Helpers to open and close directories