You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/10/21 03:40:04 UTC

svn commit: r1187160 - /subversion/trunk/subversion/libsvn_delta/compat.c

Author: hwright
Date: Fri Oct 21 01:40:03 2011
New Revision: 1187160

URL: http://svn.apache.org/viewvc?rev=1187160&view=rev
Log:
Ev2 shims: Allow callers to pass the kind of a node when building a delta
editor tree.  Most times, this information will be available for free.

* subversion/libsvn_delta/compat.c
  (build): Add a kind argument, and use it.
  (add_directoy_cb, add_file_cb, set_props_cb, set_text_cb): Update callers.

Modified:
    subversion/trunk/subversion/libsvn_delta/compat.c

Modified: subversion/trunk/subversion/libsvn_delta/compat.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1187160&r1=1187159&r2=1187160&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_delta/compat.c (original)
+++ subversion/trunk/subversion/libsvn_delta/compat.c Fri Oct 21 01:40:03 2011
@@ -627,6 +627,7 @@ static svn_error_t *
 build(struct editor_baton *eb,
       action_code_t action,
       const char *relpath,
+      svn_kind_t kind,
       const char *url,
       svn_revnum_t rev,
       apr_hash_t *props,
@@ -683,8 +684,11 @@ build(struct editor_baton *eb,
       operation->operation =
         operation->operation == OP_DELETE ? OP_REPLACE : OP_ADD;
 
-      SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
-                                  relpath, scratch_pool));
+      if (kind == svn_kind_none)
+        SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
+                                    relpath, scratch_pool));
+      else
+        operation->kind = kind;
       operation->copyfrom_url = url;
       operation->copyfrom_revision = rev;
     }
@@ -704,8 +708,7 @@ build(struct editor_baton *eb,
         }
       else
         {
-          SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
-                                      relpath, scratch_pool));
+          operation->kind = kind;
           if (operation->kind == svn_kind_file)
             operation->operation = OP_OPEN;
           else if (operation->kind == svn_kind_none)
@@ -737,7 +740,8 @@ add_directory_cb(void *baton,
 {
   struct editor_baton *eb = baton;
 
-  SVN_ERR(build(eb, ACTION_MKDIR, relpath, NULL, SVN_INVALID_REVNUM,
+  SVN_ERR(build(eb, ACTION_MKDIR, relpath, svn_kind_dir,
+                NULL, SVN_INVALID_REVNUM,
                 NULL, NULL, SVN_INVALID_REVNUM, scratch_pool));
 
   return SVN_NO_ERROR;
@@ -764,7 +768,8 @@ add_file_cb(void *baton,
   SVN_ERR(svn_stream_copy3(svn_stream_disown(contents, scratch_pool),
                            tmp_stream, NULL, NULL, scratch_pool));
 
-  SVN_ERR(build(eb, ACTION_PUT, relpath, NULL, SVN_INVALID_REVNUM,
+  SVN_ERR(build(eb, ACTION_PUT, relpath, svn_kind_file,
+                NULL, SVN_INVALID_REVNUM,
                 NULL, tmp_filename, SVN_INVALID_REVNUM, scratch_pool));
 
   return SVN_NO_ERROR;
@@ -804,7 +809,8 @@ set_props_cb(void *baton,
 {
   struct editor_baton *eb = baton;
 
-  SVN_ERR(build(eb, ACTION_PROPSET, relpath, NULL, SVN_INVALID_REVNUM,
+  SVN_ERR(build(eb, ACTION_PROPSET, relpath, svn_kind_none,
+                NULL, SVN_INVALID_REVNUM,
                 props, NULL, SVN_INVALID_REVNUM, scratch_pool));
 
   return SVN_NO_ERROR;
@@ -830,7 +836,8 @@ set_text_cb(void *baton,
   SVN_ERR(svn_stream_copy3(svn_stream_disown(contents, scratch_pool),
                            tmp_stream, NULL, NULL, scratch_pool));
 
-  SVN_ERR(build(eb, ACTION_PUT, relpath, NULL, SVN_INVALID_REVNUM,
+  SVN_ERR(build(eb, ACTION_PUT, relpath, svn_kind_file,
+                NULL, SVN_INVALID_REVNUM,
                 NULL, tmp_filename, SVN_INVALID_REVNUM, scratch_pool));
 
   return SVN_NO_ERROR;



Re: svn commit: r1187160 - /subversion/trunk/subversion/libsvn_delta/compat.c

Posted by Hyrum K Wright <hy...@wandisco.com>.
On Fri, Oct 21, 2011 at 1:29 AM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> hwright@apache.org wrote on Fri, Oct 21, 2011 at 01:40:04 -0000:
>> Author: hwright
>> Date: Fri Oct 21 01:40:03 2011
>> New Revision: 1187160
>>
>> URL: http://svn.apache.org/viewvc?rev=1187160&view=rev
>> Log:
>> Ev2 shims: Allow callers to pass the kind of a node when building a delta
>> editor tree.  Most times, this information will be available for free.
>>
>> * subversion/libsvn_delta/compat.c
>>   (build): Add a kind argument, and use it.
>>   (add_directoy_cb, add_file_cb, set_props_cb, set_text_cb): Update callers.
>>
>> Modified:
>>     subversion/trunk/subversion/libsvn_delta/compat.c
>>
>> Modified: subversion/trunk/subversion/libsvn_delta/compat.c
>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1187160&r1=1187159&r2=1187160&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/libsvn_delta/compat.c (original)
>> +++ subversion/trunk/subversion/libsvn_delta/compat.c Fri Oct 21 01:40:03 2011
>> @@ -627,6 +627,7 @@ static svn_error_t *
>>  build(struct editor_baton *eb,
>>        action_code_t action,
>>        const char *relpath,
>> +      svn_kind_t kind,
>>        const char *url,
>>        svn_revnum_t rev,
>>        apr_hash_t *props,
>> @@ -683,8 +684,11 @@ build(struct editor_baton *eb,
>>        operation->operation =
>>          operation->operation == OP_DELETE ? OP_REPLACE : OP_ADD;
>>
>> -      SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
>> -                                  relpath, scratch_pool));
>> +      if (kind == svn_kind_none)
>> +        SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
>> +                                    relpath, scratch_pool));
>> +      else
>> +        operation->kind = kind;
>
> s/svn_kind_none/svn_kind_unknown/ ?

That's probably appropriate here.

Most of the build/drive code was lifted from svnmucc, but as I spend
more time around it, I'm getting a better feel for the information the
shims have that svnmucc doesn't, and how the paradigm needs to change
for the shim use case.  This code will probably evolve quite a bit
still, and I'll keep this change in mind as it does.

-Hyrum

>>        operation->copyfrom_url = url;
>>        operation->copyfrom_revision = rev;
>>      }
>> @@ -704,8 +708,7 @@ build(struct editor_baton *eb,
>>          }
>>        else
>>          {
>> -          SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
>> -                                      relpath, scratch_pool));
>> +          operation->kind = kind;
>>            if (operation->kind == svn_kind_file)
>>              operation->operation = OP_OPEN;
>>            else if (operation->kind == svn_kind_none)
>



-- 

uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/

Re: svn commit: r1187160 - /subversion/trunk/subversion/libsvn_delta/compat.c

Posted by Hyrum K Wright <hy...@wandisco.com>.
On Fri, Oct 21, 2011 at 1:29 AM, Daniel Shahaf <d....@daniel.shahaf.name> wrote:
> hwright@apache.org wrote on Fri, Oct 21, 2011 at 01:40:04 -0000:
>> Author: hwright
>> Date: Fri Oct 21 01:40:03 2011
>> New Revision: 1187160
>>
>> URL: http://svn.apache.org/viewvc?rev=1187160&view=rev
>> Log:
>> Ev2 shims: Allow callers to pass the kind of a node when building a delta
>> editor tree.  Most times, this information will be available for free.
>>
>> * subversion/libsvn_delta/compat.c
>>   (build): Add a kind argument, and use it.
>>   (add_directoy_cb, add_file_cb, set_props_cb, set_text_cb): Update callers.
>>
>> Modified:
>>     subversion/trunk/subversion/libsvn_delta/compat.c
>>
>> Modified: subversion/trunk/subversion/libsvn_delta/compat.c
>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1187160&r1=1187159&r2=1187160&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/libsvn_delta/compat.c (original)
>> +++ subversion/trunk/subversion/libsvn_delta/compat.c Fri Oct 21 01:40:03 2011
>> @@ -627,6 +627,7 @@ static svn_error_t *
>>  build(struct editor_baton *eb,
>>        action_code_t action,
>>        const char *relpath,
>> +      svn_kind_t kind,
>>        const char *url,
>>        svn_revnum_t rev,
>>        apr_hash_t *props,
>> @@ -683,8 +684,11 @@ build(struct editor_baton *eb,
>>        operation->operation =
>>          operation->operation == OP_DELETE ? OP_REPLACE : OP_ADD;
>>
>> -      SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
>> -                                  relpath, scratch_pool));
>> +      if (kind == svn_kind_none)
>> +        SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
>> +                                    relpath, scratch_pool));
>> +      else
>> +        operation->kind = kind;
>
> s/svn_kind_none/svn_kind_unknown/ ?

That's probably appropriate here.

Most of the build/drive code was lifted from svnmucc, but as I spend
more time around it, I'm getting a better feel for the information the
shims have that svnmucc doesn't, and how the paradigm needs to change
for the shim use case.  This code will probably evolve quite a bit
still, and I'll keep this change in mind as it does.

-Hyrum

>>        operation->copyfrom_url = url;
>>        operation->copyfrom_revision = rev;
>>      }
>> @@ -704,8 +708,7 @@ build(struct editor_baton *eb,
>>          }
>>        else
>>          {
>> -          SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
>> -                                      relpath, scratch_pool));
>> +          operation->kind = kind;
>>            if (operation->kind == svn_kind_file)
>>              operation->operation = OP_OPEN;
>>            else if (operation->kind == svn_kind_none)
>



-- 

uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/

Re: svn commit: r1187160 - /subversion/trunk/subversion/libsvn_delta/compat.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
hwright@apache.org wrote on Fri, Oct 21, 2011 at 01:40:04 -0000:
> Author: hwright
> Date: Fri Oct 21 01:40:03 2011
> New Revision: 1187160
> 
> URL: http://svn.apache.org/viewvc?rev=1187160&view=rev
> Log:
> Ev2 shims: Allow callers to pass the kind of a node when building a delta
> editor tree.  Most times, this information will be available for free.
> 
> * subversion/libsvn_delta/compat.c
>   (build): Add a kind argument, and use it.
>   (add_directoy_cb, add_file_cb, set_props_cb, set_text_cb): Update callers.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_delta/compat.c
> 
> Modified: subversion/trunk/subversion/libsvn_delta/compat.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1187160&r1=1187159&r2=1187160&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_delta/compat.c (original)
> +++ subversion/trunk/subversion/libsvn_delta/compat.c Fri Oct 21 01:40:03 2011
> @@ -627,6 +627,7 @@ static svn_error_t *
>  build(struct editor_baton *eb,
>        action_code_t action,
>        const char *relpath,
> +      svn_kind_t kind,
>        const char *url,
>        svn_revnum_t rev,
>        apr_hash_t *props,
> @@ -683,8 +684,11 @@ build(struct editor_baton *eb,
>        operation->operation =
>          operation->operation == OP_DELETE ? OP_REPLACE : OP_ADD;
>  
> -      SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
> -                                  relpath, scratch_pool));
> +      if (kind == svn_kind_none)
> +        SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
> +                                    relpath, scratch_pool));
> +      else
> +        operation->kind = kind;

s/svn_kind_none/svn_kind_unknown/ ?

>        operation->copyfrom_url = url;
>        operation->copyfrom_revision = rev;
>      }
> @@ -704,8 +708,7 @@ build(struct editor_baton *eb,
>          }
>        else
>          {
> -          SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
> -                                      relpath, scratch_pool));
> +          operation->kind = kind;
>            if (operation->kind == svn_kind_file)
>              operation->operation = OP_OPEN;
>            else if (operation->kind == svn_kind_none)

Re: svn commit: r1187160 - /subversion/trunk/subversion/libsvn_delta/compat.c

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
hwright@apache.org wrote on Fri, Oct 21, 2011 at 01:40:04 -0000:
> Author: hwright
> Date: Fri Oct 21 01:40:03 2011
> New Revision: 1187160
> 
> URL: http://svn.apache.org/viewvc?rev=1187160&view=rev
> Log:
> Ev2 shims: Allow callers to pass the kind of a node when building a delta
> editor tree.  Most times, this information will be available for free.
> 
> * subversion/libsvn_delta/compat.c
>   (build): Add a kind argument, and use it.
>   (add_directoy_cb, add_file_cb, set_props_cb, set_text_cb): Update callers.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_delta/compat.c
> 
> Modified: subversion/trunk/subversion/libsvn_delta/compat.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_delta/compat.c?rev=1187160&r1=1187159&r2=1187160&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_delta/compat.c (original)
> +++ subversion/trunk/subversion/libsvn_delta/compat.c Fri Oct 21 01:40:03 2011
> @@ -627,6 +627,7 @@ static svn_error_t *
>  build(struct editor_baton *eb,
>        action_code_t action,
>        const char *relpath,
> +      svn_kind_t kind,
>        const char *url,
>        svn_revnum_t rev,
>        apr_hash_t *props,
> @@ -683,8 +684,11 @@ build(struct editor_baton *eb,
>        operation->operation =
>          operation->operation == OP_DELETE ? OP_REPLACE : OP_ADD;
>  
> -      SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
> -                                  relpath, scratch_pool));
> +      if (kind == svn_kind_none)
> +        SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
> +                                    relpath, scratch_pool));
> +      else
> +        operation->kind = kind;

s/svn_kind_none/svn_kind_unknown/ ?

>        operation->copyfrom_url = url;
>        operation->copyfrom_revision = rev;
>      }
> @@ -704,8 +708,7 @@ build(struct editor_baton *eb,
>          }
>        else
>          {
> -          SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
> -                                      relpath, scratch_pool));
> +          operation->kind = kind;
>            if (operation->kind == svn_kind_file)
>              operation->operation = OP_OPEN;
>            else if (operation->kind == svn_kind_none)