You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Glasser <gl...@davidglasser.net> on 2008/01/03 22:24:01 UTC

Re: svn commit: r28740 - in branches/reintegrate/subversion/libsvn_fs_base: . notes util

On Jan 3, 2008 4:23 PM,  <cm...@tigris.org> wrote:
> Author: cmpilato
> Date: Thu Jan  3 13:23:31 2008
> New Revision: 28740
>
> Log:
> On the 'reintegrate' branch, add has_mergeinfo and mergeinfo_count
> fields to libsvn_fs_base's node_revision_t structure, and BDB-level
> support for storing those values.

Yay!


> Modified: branches/reintegrate/subversion/libsvn_fs_base/notes/structure
> URL: http://svn.collab.net/viewvc/svn/branches/reintegrate/subversion/libsvn_fs_base/notes/structure?pathrev=28740&r1=28739&r2=28740
> ==============================================================================
> --- branches/reintegrate/subversion/libsvn_fs_base/notes/structure      (original)
> +++ branches/reintegrate/subversion/libsvn_fs_base/notes/structure      Thu Jan  3 13:23:31 2008
> @@ -926,15 +926,20 @@
>
>            NODE-REVISION ::= FILE | DIR ;
>                     FILE ::= (HEADER PROP-KEY DATA-KEY [EDIT-DATA-KEY]) ;
> -                    DIR ::= (HEADER PROP-KEY ENTRIES-KEY) ;
> -
> -                 HEADER ::= (KIND CREATED-PATH [PRED-ID [PRED-COUNT]]) ;
> +                    DIR ::= (HEADER PROP-KEY ENTRIES-KEY) ;
> +                 HEADER ::= (KIND CREATED-PATH
> +                             [PRED-ID [PRED-COUNT
> +                              [HAS-MERGEINFO MERGEINFO-COUNT]]]) ;
>                     KIND ::= "file" | "dir" ;
> -                PRED-ID ::= NODE-REV-ID ;
> -             PRED-COUNT ::= number ;
> +                PRED-ID ::= NODE-REV-ID | "";
> +             PRED-COUNT ::= number | "" ;
>             CREATED-PATH ::= atom ;
>                 PROP-KEY ::= atom ;
> -                REP-KEY ::= atom ;
> +               DATA-KEY ::= atom ;
> +          EDIT-DATA-KEY ::= atom ;
> +              MERGEINFO ::= (HAS-MERGEINFO MERGEINFO-COUNT) ;

Do you ever use this MERGEINFO element?

> +          HAS-MERGEINFO ::= "0" | "1" ;
> +        MERGEINFO-COUNT ::= number ;
>
>
>  Representations:


> @@ -603,7 +605,7 @@
>                                        apr_pool_t *pool)
>  {
>    node_revision_t *noderev;
> -  skel_t *header_skel;
> +  skel_t *header_skel, *cur_skel;
>
>    /* Validate the skel. */
>    if (! is_valid_node_revision_skel(skel))
> @@ -627,17 +629,35 @@
>    /* PREDECESSOR-ID */
>    if (header_skel->children->next->next)
>      {
> -      noderev->predecessor_id
> -        = svn_fs_base__id_parse(header_skel->children->next->next->data,
> -                                header_skel->children->next->next->len, pool);
> +      cur_skel = header_skel->children->next->next;
> +      if (cur_skel->len)
> +        noderev->predecessor_id = svn_fs_base__id_parse(cur_skel->data,
> +                                                        cur_skel->len, pool);
>
>        /* PREDECESSOR-COUNT */
>        noderev->predecessor_count = -1;
> -      if (header_skel->children->next->next->next)
> -        noderev->predecessor_count =
> -          atoi(apr_pstrmemdup(pool,
> -                              header_skel->children->next->next->next->data,
> -                              header_skel->children->next->next->next->len));
> +      if (cur_skel->next)
> +        {
> +          cur_skel = cur_skel->next;
> +          if (cur_skel->len)
> +            noderev->predecessor_count = atoi(apr_pstrmemdup(pool,
> +                                                             cur_skel->data,
> +                                                             cur_skel->len));
> +
> +          /* HAS-MERGEINFO and MERGEINFO-COUNT */
> +          if (cur_skel->next)
> +            {
> +              cur_skel = cur_skel->next;
> +              noderev->has_mergeinfo = atoi(apr_pstrmemdup(pool,
> +                                                           cur_skel->data,
> +                                                           cur_skel->len))
> +                                         ? TRUE : FALSE;
> +              noderev->mergeinfo_count =
> +                apr_atoi64(apr_pstrmemdup(pool,
> +                                          cur_skel->next->data,
> +                                          cur_skel->next->len));

While this is admittedly following the pattern set by the other
elements, I don't see why you'd need to duplicate a string that is
immediately converted to a number.

--dave


-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r28740 - in branches/reintegrate/subversion/libsvn_fs_base: . notes util

Posted by "C. Michael Pilato" <cm...@collab.net>.
David Glasser wrote:
> On Jan 3, 2008 4:23 PM,  <cm...@tigris.org> wrote:
>> Author: cmpilato
>> Date: Thu Jan  3 13:23:31 2008
>> New Revision: 28740

[...]

>> +              MERGEINFO ::= (HAS-MERGEINFO MERGEINFO-COUNT) ;
> 
> Do you ever use this MERGEINFO element?

Oops!  That was left over from previous edits.

>> +              noderev->mergeinfo_count =
>> +                apr_atoi64(apr_pstrmemdup(pool,
>> +                                          cur_skel->next->data,
>> +                                          cur_skel->next->len));
> 
> While this is admittedly following the pattern set by the other
> elements, I don't see why you'd need to duplicate a string that is
> immediately converted to a number.

skel data isn't NULL-terminated (or, I should say, the data member points to
address where the data begins, but that includes "the rest of the skel",
too).  Maybe atoi64?() would stop parsing on the first non-numeric
character, but that's not something I wanna bank on, really.

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand