FreeBSD/contrib/subversion/subversion/libsvn_client/info.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 invoke
   RECEIVER on all children of DIR, but none of their children; if
   svn_depth_files, then invoke RECEIVER 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 invoke
RECEIVER on all children of DIR, but none of their children; if
svn_depth_files, then invoke RECEIVER 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 invoke RECEIVER on all children of DIR but none of their children ; if svn_depth_files then invoke RECEIVER 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,
              svn_client_info_receiver2_t receiver,
              void *receiver_baton,
              svn_depth_t depth,
              svn_client_ctx_t *ctx,
              apr_hash_t *locks,
              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, *fs_path;
      svn_lock_t *lock;
      svn_client_info2_t *info;
      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);
      fs_path = svn_client__pathrev_fspath(child_pathrev, subpool);
      lock = svn_hash_gets(locks, fs_path);
      SVN_ERR(build_info_from_dirent(&info, the_ent, lock, child_pathrev,
                                     subpool));
      if (depth >= svn_depth_immediates
          || (depth == svn_depth_files && the_ent->kind == svn_node_file))
        {
          SVN_ERR(receiver(receiver_baton, path, info, subpool));
        }
      if (depth == svn_depth_infinity && the_ent->kind == svn_node_dir)
        {
          SVN_ERR(push_dir_info(ra_session, child_pathrev, path,
                                receiver, receiver_baton,
                                depth, ctx, locks, 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 , svn_client_info_receiver2_t receiver , void * receiver_baton , svn_depth_t depth , svn_client_ctx_t * ctx , apr_hash_t * locks , 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 , * fs_path ; svn_lock_t * lock ; svn_client_info2_t * info ; 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 ) ; fs_path = svn_client__pathrev_fspath ( child_pathrev , subpool ) ; lock = svn_hash_gets ( locks , fs_path ) ; SVN_ERR ( build_info_from_dirent ( & info , the_ent , lock , child_pathrev , subpool ) ) ; if ( depth >= svn_depth_immediates || ( depth == svn_depth_files && the_ent -> kind == svn_node_file ) ) { SVN_ERR ( receiver ( receiver_baton , path , info , subpool ) ) ; } if ( depth == svn_depth_infinity && the_ent -> kind == svn_node_dir ) { SVN_ERR ( push_dir_info ( ra_session , child_pathrev , path , receiver , receiver_baton , depth , ctx , locks , 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 .