You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by James McCoy <ja...@jamessan.com> on 2016/02/22 16:29:24 UTC

Re: svn commit: r1731656 - /subversion/trunk/subversion/svnserve/serve.c

On Feb 22, 2016 10:10 AM, <st...@apache.org> wrote:
>
> Author: stefan2
> Date: Mon Feb 22 15:06:40 2016
> New Revision: 1731656
>
> URL: http://svn.apache.org/viewvc?rev=1731656&view=rev
> Log:
> Switch svnserve to using the streamy log API.

> --- subversion/trunk/subversion/svnserve/serve.c (original)
> +++ subversion/trunk/subversion/svnserve/serve.c Mon Feb 22 15:06:40 2016
> @@ -87,6 +87,9 @@ typedef struct log_baton_t {
>    const char *fs_path;
>    svn_ra_svn_conn_t *conn;
>    int stack_depth;
> +
> +  /* Set to TRUE when at least one changed path has been sent. */
> +  svn_boolean_t started;
>  } log_baton_t;
>
>  typedef struct file_revs_baton_t {
> @@ -2187,14 +2190,58 @@ get_mergeinfo(svn_ra_svn_conn_t *conn,
>    return SVN_NO_ERROR;
>  }
>
> -/* Send a log entry to the client. */
> -static svn_error_t *log_receiver(void *baton,
> -                                 svn_log_entry_t *log_entry,
> -                                 apr_pool_t *pool)
> +/* Send a changed paths list entry to the client.
> +   This implements svn_repos_path_change_receiver_t. */
> +static svn_error_t *
> +path_change_receiver(void *baton,
> +                     svn_repos_path_change_t *change,
> +                     apr_pool_t *scratch_pool)
> +{
> +  const char symbol[] = "MADR";
> +
> +  log_baton_t *b = baton;
> +  svn_ra_svn_conn_t *conn = b->conn;
> +
> +  /* Sanitize and convert change kind to ra-svn level action.
> +
> +     Pushing that conversion down into libsvn_ra_svn would add yet
another
> +     API dependency there. */
> +  char action = (   change->change_kind < svn_fs_path_change_modify
> +                 || change->change_kind > svn_fs_path_change_replace)
> +              ? 0
> +              : symbol[change->change_kind];
> +
> +  /* Open lists once: LOG_ENTRY and LOG_ENTRY->CHANGED_PATHS. */
> +  if (!b->started)
> +    {
> +      SVN_ERR(svn_ra_svn__start_list(conn, scratch_pool));
> +      SVN_ERR(svn_ra_svn__start_list(conn, scratch_pool));

Is this supposed to be duplicated?

> @@ -2221,49 +2268,35 @@ static svn_error_t *log_receiver(void *b
>    else
>      revprop_count = 0;
>
> -  /* send LOG_ENTRY */
> -  SVN_ERR(svn_ra_svn__start_list(conn, pool));
> -
> -  /* send LOG_ENTRY->CHANGED_PATHS2 */
> -  SVN_ERR(svn_ra_svn__start_list(conn, pool));
> -  if (log_entry->changed_paths2)
> +  /* Open lists once: LOG_ENTRY and LOG_ENTRY->CHANGED_PATHS. */
> +  if (!b->started)
>      {
> -      for (h = apr_hash_first(pool, log_entry->changed_paths2); h;
> -                                                        h =
apr_hash_next(h))
> -        {
> -          const char *path = apr_hash_this_key(h);
> -          svn_log_changed_path2_t *change = apr_hash_this_val(h);
> -
> -          SVN_ERR(svn_ra_svn__write_data_log_changed_path(
> -                      conn, pool,
> -                      path,
> -                      change->action,
> -                      change->copyfrom_path,
> -                      change->copyfrom_rev,
> -                      change->node_kind,
> -                      /* text_modified and props_modified are never
unknown */
> -                      change->text_modified  == svn_tristate_true,
> -                      change->props_modified == svn_tristate_true));
> -        }
> +      SVN_ERR(svn_ra_svn__start_list(conn, scratch_pool));
> +      SVN_ERR(svn_ra_svn__start_list(conn, scratch_pool));

Ditto.

Cheers,
James

Re: svn commit: r1731656 - /subversion/trunk/subversion/svnserve/serve.c

Posted by Stefan Fuhrmann <st...@alice-dsl.de>.
On 22.02.2016 16:29, James McCoy wrote:
>
> On Feb 22, 2016 10:10 AM, <stefan2@apache.org 
> <ma...@apache.org>> wrote:
> >
> > Author: stefan2
> > Date: Mon Feb 22 15:06:40 2016
> > New Revision: 1731656
> >
> > URL: http://svn.apache.org/viewvc?rev=1731656&view=rev
> > Log:
> > Switch svnserve to using the streamy log API.
>
> > --- subversion/trunk/subversion/svnserve/serve.c (original)
> > +++ subversion/trunk/subversion/svnserve/serve.c Mon Feb 22 15:06:40 
> 2016
> > @@ -87,6 +87,9 @@ typedef struct log_baton_t {
> >    const char *fs_path;
> >    svn_ra_svn_conn_t *conn;
> >    int stack_depth;
> > +
> > +  /* Set to TRUE when at least one changed path has been sent. */
> > +  svn_boolean_t started;
> >  } log_baton_t;
> >
> >  typedef struct file_revs_baton_t {
> > @@ -2187,14 +2190,58 @@ get_mergeinfo(svn_ra_svn_conn_t *conn,
> >    return SVN_NO_ERROR;
> >  }
> >
> > -/* Send a log entry to the client. */
> > -static svn_error_t *log_receiver(void *baton,
> > -                                 svn_log_entry_t *log_entry,
> > -                                 apr_pool_t *pool)
> > +/* Send a changed paths list entry to the client.
> > +   This implements svn_repos_path_change_receiver_t. */
> > +static svn_error_t *
> > +path_change_receiver(void *baton,
> > +                     svn_repos_path_change_t *change,
> > +                     apr_pool_t *scratch_pool)
> > +{
> > +  const char symbol[] = "MADR";
> > +
> > +  log_baton_t *b = baton;
> > +  svn_ra_svn_conn_t *conn = b->conn;
> > +
> > +  /* Sanitize and convert change kind to ra-svn level action.
> > +
> > +     Pushing that conversion down into libsvn_ra_svn would add yet 
> another
> > +     API dependency there. */
> > +  char action = (   change->change_kind < svn_fs_path_change_modify
> > +                 || change->change_kind > svn_fs_path_change_replace)
> > +              ? 0
> > +              : symbol[change->change_kind];
> > +
> > +  /* Open lists once: LOG_ENTRY and LOG_ENTRY->CHANGED_PATHS. */
> > +  if (!b->started)
> > +    {
> > +      SVN_ERR(svn_ra_svn__start_list(conn, scratch_pool));
> > +      SVN_ERR(svn_ra_svn__start_list(conn, scratch_pool));
>
> Is this supposed to be duplicated?
>
No, those are actually 2 tuples (one for the LOG_ENTRY
struct and one for the CHANGED_PATHS list inside it as
the first sub-element). I tried to hint at that in the comment
just above that block. The svn:// protocol is quite lisp-y
in its use of parentheses ...

But still, thanks for reviewing the changes!

-- Stefan^2.