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/04/26 17:15:24 UTC

svn commit: r1096777 - /subversion/trunk/subversion/libsvn_wc/props.c

Author: hwright
Date: Tue Apr 26 15:15:24 2011
New Revision: 1096777

URL: http://svn.apache.org/viewvc?rev=1096777&view=rev
Log:
Use the work queue to set file flags when doing a propset.

* subversion/libsvn_wc/props.c
  (do_propset): Remove the custom flag-setting code in favor or using the
    work queue.

Modified:
    subversion/trunk/subversion/libsvn_wc/props.c

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1096777&r1=1096776&r2=1096777&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Tue Apr 26 15:15:24 2011
@@ -2018,6 +2018,7 @@ do_propset(svn_wc__db_t *db,
   svn_wc_notify_action_t notify_action;
   svn_wc__db_kind_t kind;
   svn_wc__db_status_t status;
+  svn_skel_t *work_item = NULL;
 
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
@@ -2073,29 +2074,8 @@ do_propset(svn_wc__db_t *db,
       value = new_value;
     }
 
-  if (kind == svn_wc__db_kind_file && strcmp(name, SVN_PROP_EXECUTABLE) == 0)
-    {
-      /* If the svn:executable property was set, then chmod +x.
-         If the svn:executable property was deleted (NULL value passed
-         in), then chmod -x. */
-      if (value == NULL)
-        SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE, TRUE,
-                                           scratch_pool));
-      else
-        SVN_ERR(svn_io_set_file_executable(local_abspath, TRUE, TRUE,
-                                           scratch_pool));
-    }
-
-  if (kind == svn_wc__db_kind_file && strcmp(name, SVN_PROP_NEEDS_LOCK) == 0)
-    {
-      /* If the svn:needs-lock property was set to NULL, set the file
-         to read-write */
-      if (value == NULL)
-        SVN_ERR(svn_io_set_file_read_write(local_abspath, FALSE,
-                                           scratch_pool));
-
-      /* If not, we'll set the file to read-only at commit time. */
-    }
+  SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item, db, local_abspath,
+                                           scratch_pool, scratch_pool));
 
   SVN_ERR_W(svn_wc__db_read_props(&prophash, db, local_abspath,
                                   scratch_pool, scratch_pool),
@@ -2179,9 +2159,12 @@ do_propset(svn_wc__db_t *db,
   apr_hash_set(prophash, name, APR_HASH_KEY_STRING, value);
 
   /* Drop it right into the db..  */
-  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, prophash, NULL, NULL,
+  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, prophash, NULL, work_item,
                                   scratch_pool));
 
+  /* Run our workqueue item for sync'ing flags with props. */
+  SVN_ERR(svn_wc__wq_run(db, local_abspath, NULL, NULL, scratch_pool));
+
   if (notify_func)
     {
       svn_wc_notify_t *notify = svn_wc_create_notify(local_abspath,



RE: svn commit: r1096777 - /subversion/trunk/subversion/libsvn_wc/props.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: hwright@apache.org [mailto:hwright@apache.org]
> Sent: dinsdag 26 april 2011 17:15
> To: commits@subversion.apache.org
> Subject: svn commit: r1096777 -
> /subversion/trunk/subversion/libsvn_wc/props.c
> 
> Author: hwright
> Date: Tue Apr 26 15:15:24 2011
> New Revision: 1096777
> 
> URL: http://svn.apache.org/viewvc?rev=1096777&view=rev
> Log:
> Use the work queue to set file flags when doing a propset.
> 
> * subversion/libsvn_wc/props.c
>   (do_propset): Remove the custom flag-setting code in favor or using the
>     work queue.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_wc/props.c
> 
> Modified: subversion/trunk/subversion/libsvn_wc/props.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/prop
> s.c?rev=1096777&r1=1096776&r2=1096777&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/props.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/props.c Tue Apr 26 15:15:24
> 2011
> @@ -2018,6 +2018,7 @@ do_propset(svn_wc__db_t *db,
>    svn_wc_notify_action_t notify_action;
>    svn_wc__db_kind_t kind;
>    svn_wc__db_status_t status;
> +  svn_skel_t *work_item = NULL;
> 
>    SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> 
> @@ -2073,29 +2074,8 @@ do_propset(svn_wc__db_t *db,
>        value = new_value;
>      }
> 
> -  if (kind == svn_wc__db_kind_file && strcmp(name,
> SVN_PROP_EXECUTABLE) == 0)
> -    {
> -      /* If the svn:executable property was set, then chmod +x.
> -         If the svn:executable property was deleted (NULL value passed
> -         in), then chmod -x. */
> -      if (value == NULL)
> -        SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE, TRUE,
> -                                           scratch_pool));
> -      else
> -        SVN_ERR(svn_io_set_file_executable(local_abspath, TRUE, TRUE,
> -                                           scratch_pool));
> -    }
> -
> -  if (kind == svn_wc__db_kind_file && strcmp(name,
> SVN_PROP_NEEDS_LOCK) == 0)
> -    {
> -      /* If the svn:needs-lock property was set to NULL, set the file
> -         to read-write */
> -      if (value == NULL)
> -        SVN_ERR(svn_io_set_file_read_write(local_abspath, FALSE,
> -                                           scratch_pool));
> -
> -      /* If not, we'll set the file to read-only at commit time. */
> -    }
> +  SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item, db,
> local_abspath,
> +                                           scratch_pool, scratch_pool));

It would be nice if you only insert this wq operation (and run the wq) when we actually change one of these two special property values.

This makes setting properties via this api several times slower than it needs to be, while it is only necessary for setting these properties... and when the property actually changes.

	Bert


Re: svn commit: r1096777 - /subversion/trunk/subversion/libsvn_wc/props.c

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Tue, Apr 26, 2011 at 10:35 AM, Greg Stein <gs...@gmail.com> wrote:
> On Tue, Apr 26, 2011 at 11:15,  <hw...@apache.org> wrote:
>>...
>> +++ subversion/trunk/subversion/libsvn_wc/props.c Tue Apr 26 15:15:24 2011
>> @@ -2018,6 +2018,7 @@ do_propset(svn_wc__db_t *db,
>>   svn_wc_notify_action_t notify_action;
>>   svn_wc__db_kind_t kind;
>>   svn_wc__db_status_t status;
>> +  svn_skel_t *work_item = NULL;
>
> Why is this initialized? It is set unconditionally below.
>
>>...
>> @@ -2179,9 +2159,12 @@ do_propset(svn_wc__db_t *db,
>>   apr_hash_set(prophash, name, APR_HASH_KEY_STRING, value);
>>
>>   /* Drop it right into the db..  */
>> -  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, prophash, NULL, NULL,
>> +  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, prophash, NULL, work_item,
>>                                   scratch_pool));
>>
>> +  /* Run our workqueue item for sync'ing flags with props. */
>> +  SVN_ERR(svn_wc__wq_run(db, local_abspath, NULL, NULL, scratch_pool));
>
> This raises an interesting question: is it okay to run the workqueue
> at any point in time? I believe the answer is "yes", but are there
> situations where a caller may expect that the queue-run is under their
> control, and the caller wants to wait a bit longer?

Good point: that is an interesting question.

For this specific application, I don't think we need to worry about
accidentally running a caller's existing queue prematurely, but I can
certainly see places where that would be an issue.  Unfortunately, we
don't have a very good handle on where those might be.

-Hyrum

Re: svn commit: r1096777 - /subversion/trunk/subversion/libsvn_wc/props.c

Posted by Greg Stein <gs...@gmail.com>.
On Tue, Apr 26, 2011 at 11:15,  <hw...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_wc/props.c Tue Apr 26 15:15:24 2011
> @@ -2018,6 +2018,7 @@ do_propset(svn_wc__db_t *db,
>   svn_wc_notify_action_t notify_action;
>   svn_wc__db_kind_t kind;
>   svn_wc__db_status_t status;
> +  svn_skel_t *work_item = NULL;

Why is this initialized? It is set unconditionally below.

>...
> @@ -2179,9 +2159,12 @@ do_propset(svn_wc__db_t *db,
>   apr_hash_set(prophash, name, APR_HASH_KEY_STRING, value);
>
>   /* Drop it right into the db..  */
> -  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, prophash, NULL, NULL,
> +  SVN_ERR(svn_wc__db_op_set_props(db, local_abspath, prophash, NULL, work_item,
>                                   scratch_pool));
>
> +  /* Run our workqueue item for sync'ing flags with props. */
> +  SVN_ERR(svn_wc__wq_run(db, local_abspath, NULL, NULL, scratch_pool));

This raises an interesting question: is it okay to run the workqueue
at any point in time? I believe the answer is "yes", but are there
situations where a caller may expect that the queue-run is under their
control, and the caller wants to wait a bit longer?

Cheers,
-g

RE: svn commit: r1096777 - /subversion/trunk/subversion/libsvn_wc/props.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: hwright@apache.org [mailto:hwright@apache.org]
> Sent: dinsdag 26 april 2011 17:15
> To: commits@subversion.apache.org
> Subject: svn commit: r1096777 -
> /subversion/trunk/subversion/libsvn_wc/props.c
> 
> Author: hwright
> Date: Tue Apr 26 15:15:24 2011
> New Revision: 1096777
> 
> URL: http://svn.apache.org/viewvc?rev=1096777&view=rev
> Log:
> Use the work queue to set file flags when doing a propset.
> 
> * subversion/libsvn_wc/props.c
>   (do_propset): Remove the custom flag-setting code in favor or using the
>     work queue.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_wc/props.c
> 
> Modified: subversion/trunk/subversion/libsvn_wc/props.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/prop
> s.c?rev=1096777&r1=1096776&r2=1096777&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/props.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/props.c Tue Apr 26 15:15:24
> 2011
> @@ -2018,6 +2018,7 @@ do_propset(svn_wc__db_t *db,
>    svn_wc_notify_action_t notify_action;
>    svn_wc__db_kind_t kind;
>    svn_wc__db_status_t status;
> +  svn_skel_t *work_item = NULL;
> 
>    SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> 
> @@ -2073,29 +2074,8 @@ do_propset(svn_wc__db_t *db,
>        value = new_value;
>      }
> 
> -  if (kind == svn_wc__db_kind_file && strcmp(name,
> SVN_PROP_EXECUTABLE) == 0)
> -    {
> -      /* If the svn:executable property was set, then chmod +x.
> -         If the svn:executable property was deleted (NULL value passed
> -         in), then chmod -x. */
> -      if (value == NULL)
> -        SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE, TRUE,
> -                                           scratch_pool));
> -      else
> -        SVN_ERR(svn_io_set_file_executable(local_abspath, TRUE, TRUE,
> -                                           scratch_pool));
> -    }
> -
> -  if (kind == svn_wc__db_kind_file && strcmp(name,
> SVN_PROP_NEEDS_LOCK) == 0)
> -    {
> -      /* If the svn:needs-lock property was set to NULL, set the file
> -         to read-write */
> -      if (value == NULL)
> -        SVN_ERR(svn_io_set_file_read_write(local_abspath, FALSE,
> -                                           scratch_pool));
> -
> -      /* If not, we'll set the file to read-only at commit time. */
> -    }
> +  SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item, db,
> local_abspath,
> +                                           scratch_pool, scratch_pool));

It would be nice if you only insert this wq operation (and run the wq) when we actually change one of these two special property values.

This makes setting properties via this api several times slower than it needs to be, while it is only necessary for setting these properties... and when the property actually changes.

	Bert