You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2011/10/12 10:01:39 UTC

svn commit: r1182248 - in /subversion/branches/tree-read-api/subversion/libsvn_client: tree.c tree.h

Author: julianfoad
Date: Wed Oct 12 08:01:39 2011
New Revision: 1182248

URL: http://svn.apache.org/viewvc?rev=1182248&view=rev
Log:
On the 'tree-read-api' branch: When reading a dir, just get the entry names
and no further information.

* subversion/libsvn_client/tree.h
  (svn_client_tree_dirent_t): Delete.
  (svn_tree_get_dir): Don't promise that the values in the directory entries
    hash are anything in particular.

* subversion/libsvn_client/tree.c
  (wc_tree_get_dir): Set each directory entry's value the same as its name.
  (ra_tree_get_dir): Return the 'dirents' hash straight from the RA call.

Modified:
    subversion/branches/tree-read-api/subversion/libsvn_client/tree.c
    subversion/branches/tree-read-api/subversion/libsvn_client/tree.h

Modified: subversion/branches/tree-read-api/subversion/libsvn_client/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/tree-read-api/subversion/libsvn_client/tree.c?rev=1182248&r1=1182247&r2=1182248&view=diff
==============================================================================
--- subversion/branches/tree-read-api/subversion/libsvn_client/tree.c (original)
+++ subversion/branches/tree-read-api/subversion/libsvn_client/tree.c Wed Oct 12 08:01:39 2011
@@ -334,7 +334,7 @@ wc_tree_get_dir(svn_client_tree_t *tree,
           const char *child_abspath = APR_ARRAY_IDX(children, i, const char *);
           const char *name = svn_dirent_basename(child_abspath, scratch_pool);
 
-          apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, (void *)1);
+          apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, name);
         }
     }
   if (props)
@@ -494,33 +494,12 @@ ra_tree_get_dir(svn_client_tree_t *tree,
                 apr_pool_t *scratch_pool)
 {
   ra_tree_baton_t *baton = tree->priv;
-  apr_hash_t *ra_dirents = NULL;
 
   SVN_ERR(svn_ra_get_dir2(baton->ra_session,
-                          dirents ? &ra_dirents : NULL, NULL, props,
+                          dirents, NULL, props,
                           relpath, baton->revnum,
-                          SVN_DIRENT_KIND | SVN_DIRENT_SIZE,
+                          0 /* dirent_fields */,
                           result_pool));
-  if (ra_dirents)
-    {
-      apr_hash_index_t *hi;
-
-      *dirents = apr_hash_make(result_pool);
-      for (hi = apr_hash_first(scratch_pool, ra_dirents);
-           hi;
-           hi = apr_hash_next(hi))
-        {
-          const char *entry_name = svn__apr_hash_index_key(hi);
-          svn_dirent_t *ra_dirent = svn__apr_hash_index_val(hi);
-          svn_client_tree_dirent_t *dirent
-            = apr_palloc(result_pool, sizeof(*dirent));
-
-          dirent->kind = ra_dirent->kind;
-          dirent->filesize = ra_dirent->size;
-          /* ### dirent->special = ... */
-          apr_hash_set(*dirents, entry_name, APR_HASH_KEY_STRING, dirent);
-        }
-    }
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/tree-read-api/subversion/libsvn_client/tree.h
URL: http://svn.apache.org/viewvc/subversion/branches/tree-read-api/subversion/libsvn_client/tree.h?rev=1182248&r1=1182247&r2=1182248&view=diff
==============================================================================
--- subversion/branches/tree-read-api/subversion/libsvn_client/tree.h (original)
+++ subversion/branches/tree-read-api/subversion/libsvn_client/tree.h Wed Oct 12 08:01:39 2011
@@ -40,9 +40,6 @@ extern "C" {
  */
 typedef struct svn_client_tree_t svn_client_tree_t;
 
-/* */
-typedef svn_io_dirent2_t svn_client_tree_dirent_t;
-
 /*
  * Paths are relpaths, relative to the tree root.
  *
@@ -102,7 +99,7 @@ svn_tree_get_file(svn_client_tree_t *tre
  *
  * If @a dirents is non-NULL, set @a *dirents to contain all the entries
  * of directory @a relpath.  The keys will be (<tt>const char *</tt>)
- * entry names, and the values (#svn_client_tree_dirent_t *) dirents.
+ * entry names; the values are unspecified.
  * Only the @c kind and @c filesize fields are filled in.
  * ### @c special would be useful too.
  *



Re: svn commit: r1182248 - in /subversion/branches/tree-read-api/subversion/libsvn_client: tree.c tree.h

Posted by Julian Foad <ju...@wandisco.com>.
Greg Stein wrote:
> On Oct 12, 2011 4:02 AM, <ju...@apache.org> wrote:
> >...
> >           const char *name = svn_dirent_basename(child_abspath,
> scratch_pool);
> >
> > -          apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, (void
> *)1);
> > +          apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, name);
> 
> Looks like 'name' is in the wrong pool.

Thanks.  r1182566.

- Julian



Re: svn commit: r1182248 - in /subversion/branches/tree-read-api/subversion/libsvn_client: tree.c tree.h

Posted by Greg Stein <gs...@gmail.com>.
On Oct 12, 2011 4:02 AM, <ju...@apache.org> wrote:
>...
> +++ subversion/branches/tree-read-api/subversion/libsvn_client/tree.c Wed
Oct 12 08:01:39 2011
> @@ -334,7 +334,7 @@ wc_tree_get_dir(svn_client_tree_t *tree,
>           const char *child_abspath = APR_ARRAY_IDX(children, i, const
char *);
>           const char *name = svn_dirent_basename(child_abspath,
scratch_pool);
>
> -          apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, (void *)1);
> +          apr_hash_set(*dirents, name, APR_HASH_KEY_STRING, name);

Looks like 'name' is in the wrong pool.