FreeBSD/contrib/subversion/subversion/svnbench/null-info-cmd.c
/* Helper func for recursively fetching svn_dirent_t's from a remote
   directory and pushing them at an info-receiver callback.

   DEPTH is the depth starting at DIR, even though RECEIVER is never
   invoked on DIR: if DEPTH is svn_depth_immediates, then increment
   *COUNTER on all children of DIR, but none of their children; if
   svn_depth_files, then increment *COUNTER on file children of DIR but
   not on subdirectories; if svn_depth_infinity, recurse fully.
   DIR is a relpath, relative to the root of RA_SESSION.
*/
Helper func for recursively fetching svn_dirent_t's from a remote
directory and pushing them at an info-receiver callback.

DEPTH is the depth starting at DIR, even though RECEIVER is never
invoked on DIR: if DEPTH is svn_depth_immediates, then increment
COUNTER on all children of DIR, but none of their children; if
svn_depth_files, then increment *COUNTER on file children of DIR but
not on subdirectories; if svn_depth_infinity, recurse fully.
DIR is a relpath, relative to the root of RA_SESSION.
Helper func for recursively fetching svn_dirent_t ' s from a remote directory and pushing them at an info - receiver callback . DEPTH is the depth starting at DIR even though RECEIVER is never invoked on DIR : if DEPTH is svn_depth_immediates then increment COUNTER on all children of DIR but none of their children ; if svn_depth_files then increment * COUNTER on file children of DIR but not on subdirectories ; if svn_depth_infinity recurse fully . DIR is a relpath relative to the root of RA_SESSION .
static svn_error_t *
push_dir_info(svn_ra_session_t *ra_session,
              const svn_client__pathrev_t *pathrev,
              const char *dir,
              int *counter,
              svn_depth_t depth,
              svn_client_ctx_t *ctx,
              apr_pool_t *pool)
{
  apr_hash_t *tmpdirents;
  apr_hash_index_t *hi;
  apr_pool_t *subpool = svn_pool_create(pool);
  SVN_ERR(svn_ra_get_dir2(ra_session, &tmpdirents, NULL, NULL,
                          dir, pathrev->rev, DIRENT_FIELDS, pool));
  for (hi = apr_hash_first(pool, tmpdirents); hi; hi = apr_hash_next(hi))
    {
      const char *path;
      const char *name = apr_hash_this_key(hi);
      svn_dirent_t *the_ent = apr_hash_this_val(hi);
      svn_client__pathrev_t *child_pathrev;
      svn_pool_clear(subpool);
      if (ctx->cancel_func)
        SVN_ERR(ctx->cancel_func(ctx->cancel_baton));
      path = svn_relpath_join(dir, name, subpool);
      child_pathrev = svn_client__pathrev_join_relpath(pathrev, name, subpool);
      if (depth >= svn_depth_immediates
          || (depth == svn_depth_files && the_ent->kind == svn_node_file))
        ++(*counter);
      if (depth == svn_depth_infinity && the_ent->kind == svn_node_dir)
        SVN_ERR(push_dir_info(ra_session, child_pathrev, path,
                              counter, depth, ctx, subpool));
    }
  svn_pool_destroy(subpool);
  return SVN_NO_ERROR;
}
static svn_error_t * push_dir_info ( svn_ra_session_t * ra_session , const svn_client__pathrev_t * pathrev , const char * dir , int * counter , svn_depth_t depth , svn_client_ctx_t * ctx , apr_pool_t * pool ) { apr_hash_t * tmpdirents ; apr_hash_index_t * hi ; apr_pool_t * subpool = svn_pool_create ( pool ) ; SVN_ERR ( svn_ra_get_dir2 ( ra_session , & tmpdirents , NULL , NULL , dir , pathrev -> rev , DIRENT_FIELDS , pool ) ) ; for ( hi = apr_hash_first ( pool , tmpdirents ) ; hi ; hi = apr_hash_next ( hi ) ) { const char * path ; const char * name = apr_hash_this_key ( hi ) ; svn_dirent_t * the_ent = apr_hash_this_val ( hi ) ; svn_client__pathrev_t * child_pathrev ; svn_pool_clear ( subpool ) ; if ( ctx -> cancel_func ) SVN_ERR ( ctx -> cancel_func ( ctx -> cancel_baton ) ) ; path = svn_relpath_join ( dir , name , subpool ) ; child_pathrev = svn_client__pathrev_join_relpath ( pathrev , name , subpool ) ; if ( depth >= svn_depth_immediates || ( depth == svn_depth_files && the_ent -> kind == svn_node_file ) ) ++ ( * counter ) ; if ( depth == svn_depth_infinity && the_ent -> kind == svn_node_dir ) SVN_ERR ( push_dir_info ( ra_session , child_pathrev , path , counter , depth , ctx , subpool ) ) ; } svn_pool_destroy ( subpool ) ; return SVN_NO_ERROR ; }
Helper func for recursively fetching svn_dirent_t's from a remote
directory and pushing them at an info-receiver callback.
Helper func for recursively fetching svn_dirent_t ' s from a remote directory and pushing them at an info - receiver callback .