You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/10/18 23:45:09 UTC

svn commit: r1185886 - in /subversion/trunk/subversion: libsvn_wc/entries.c tests/cmdline/upgrade_tests.py

Author: rhuijben
Date: Tue Oct 18 21:45:09 2011
New Revision: 1185886

URL: http://svn.apache.org/viewvc?rev=1185886&view=rev
Log:
Make it possible to upgrade server-excluded (or 'absent') nodes from their
entries representation. Before this patch server-excluded directories were
accidentally upgraded as incomplete directories.

* subversion/libsvn_wc/entries.c
  (insert_node): Make it possible to write server-excluded presence.
  (write_entry): Handle server-excluded like how we handle not-present. This
    presence can't be combined with incomplete and there is no subdirectory
    with more data which can fill in details later. Absent nodes can't be
    shadowed.

    Assert earlier code already set the right presence instead of setting the
    value again. Copy revision set code from the block that previously handled
    absent nodes.

* subversion/tests/cmdline/upgrade_tests.py
  (upgrade_absent): Remove XFail marking and test that the update doesn't
    perform any changes.

Modified:
    subversion/trunk/subversion/libsvn_wc/entries.c
    subversion/trunk/subversion/tests/cmdline/upgrade_tests.py

Modified: subversion/trunk/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entries.c?rev=1185886&r1=1185885&r2=1185886&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/entries.c (original)
+++ subversion/trunk/subversion/libsvn_wc/entries.c Tue Oct 18 21:45:09 2011
@@ -1466,6 +1466,8 @@ insert_node(svn_sqlite__db_t *sdb,
     SVN_ERR(svn_sqlite__bind_text(stmt, 8, "incomplete"));
   else if (node->presence == svn_wc__db_status_excluded)
     SVN_ERR(svn_sqlite__bind_text(stmt, 8, "excluded"));
+  else if (node->presence == svn_wc__db_status_server_excluded)
+    SVN_ERR(svn_sqlite__bind_text(stmt, 8, "absent"));
 
   if (node->kind == svn_node_none)
     SVN_ERR(svn_sqlite__bind_text(stmt, 10, "unknown"));
@@ -1697,10 +1699,10 @@ write_entry(struct write_baton **entry_n
       SVN_ERR_ASSERT(!entry->incomplete);
       base_node->presence = svn_wc__db_status_not_present;
     }
-
-  if (entry->absent)
+  else if (entry->absent)
     {
-      SVN_ERR_ASSERT(base_node && !working_node);
+      SVN_ERR_ASSERT(base_node && !working_node && !below_working_node);
+      SVN_ERR_ASSERT(!entry->incomplete);
       base_node->presence = svn_wc__db_status_server_excluded;
     }
 
@@ -1873,9 +1875,22 @@ write_entry(struct write_baton **entry_n
 
       if (entry->deleted)
         {
-          base_node->presence = svn_wc__db_status_not_present;
+          SVN_ERR_ASSERT(base_node->presence == svn_wc__db_status_not_present);
+          /* ### should be svn_node_unknown, but let's store what we have. */
+          base_node->kind = entry->kind;
+        }
+      else if (entry->absent)
+        {
+          SVN_ERR_ASSERT(base_node->presence 
+                                == svn_wc__db_status_server_excluded);
           /* ### should be svn_node_unknown, but let's store what we have. */
           base_node->kind = entry->kind;
+
+          /* Store the most likely revision in the node to avoid
+             base nodes without a valid revision. Of course
+             we remember that the data is still incomplete. */
+          if (!SVN_IS_VALID_REVNUM(base_node->revision) && parent_node->base)
+            base_node->revision = parent_node->base->revision;
         }
       else
         {

Modified: subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/upgrade_tests.py?rev=1185886&r1=1185885&r2=1185886&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/upgrade_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/upgrade_tests.py Tue Oct 18 21:45:09 2011
@@ -1199,36 +1199,40 @@ def upgrade_file_externals(sbox):
       })
 
 @Skip(svntest.main.is_ra_type_file)
-@XFail()
 def upgrade_absent(sbox):
-  "upgrade absent nodes"
-  
+  "upgrade absent nodes to server-excluded"
+
   # Install wc and repos
   replace_sbox_with_tarfile(sbox, 'upgrade_absent.tar.bz2')
   replace_sbox_repo_with_tarfile(sbox, 'upgrade_absent_repos.tar.bz2')
-  
+
   # Update config for authz
   svntest.main.write_restrictive_svnserve_conf(sbox.repo_dir)
   svntest.main.write_authz_file(sbox, { "/"      : "*=rw",
                                         "/A/B"   : "*=",
                                         "/A/B/E" : "jrandom = rw"})
-  
+
   # Attempt to use the working copy, this should give an error
   expected_stderr = wc_is_too_old_regex
   svntest.actions.run_and_verify_svn(None, None, expected_stderr,
                                      'info', sbox.wc_dir)
+
   # Now upgrade the working copy
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'upgrade', sbox.wc_dir)
 
-  # 
+  # Relocate to allow finding the repository
   svntest.actions.run_and_verify_svn(None, None, [], 'relocate',
                                      'svn://127.0.0.1/authz_tests-2',
                                      sbox.repo_url, sbox.wc_dir)  
 
-  # This currently fails because the absent node is incorrectly upgraded
-  sbox.simple_update()
-  
+  expected_output = svntest.wc.State(sbox.wc_dir, {
+  })
+
+  # Expect no changes and certainly no errors
+  svntest.actions.run_and_verify_update(sbox.wc_dir, expected_output,
+                                        None, None)
+
 ########################################################################
 # Run the tests
 



Re: svn commit: r1185886 - in /subversion/trunk/subversion: libsvn_wc/entries.c tests/cmdline/upgrade_tests.py

Posted by Greg Stein <gs...@gmail.com>.
On Wed, Oct 19, 2011 at 18:07, Greg Stein <gs...@gmail.com> wrote:
> On Tue, Oct 18, 2011 at 17:45,  <rh...@apache.org> wrote:
>...
>>...
>
> There are some later changes from Philip which may cause a problem.
> I'll note that separately.

Never mind. Looks just fine.

Cheers,
-g

Re: svn commit: r1185886 - in /subversion/trunk/subversion: libsvn_wc/entries.c tests/cmdline/upgrade_tests.py

Posted by Greg Stein <gs...@gmail.com>.
On Tue, Oct 18, 2011 at 17:45,  <rh...@apache.org> wrote:
>...
> +++ subversion/trunk/subversion/libsvn_wc/entries.c Tue Oct 18 21:45:09 2011
>...
> -  if (entry->absent)
> +  else if (entry->absent)
>     {
> -      SVN_ERR_ASSERT(base_node && !working_node);
> +      SVN_ERR_ASSERT(base_node && !working_node && !below_working_node);

We should also assert for parent_node here (needed below). An absent
node always needs a parent, so the assertion should be fine.

>...
> @@ -1873,9 +1875,22 @@ write_entry(struct write_baton **entry_n
>
>       if (entry->deleted)
>         {
> -          base_node->presence = svn_wc__db_status_not_present;
> +          SVN_ERR_ASSERT(base_node->presence == svn_wc__db_status_not_present);

Yup.

> +          /* ### should be svn_node_unknown, but let's store what we have. */
> +          base_node->kind = entry->kind;
> +        }
> +      else if (entry->absent)
> +        {
> +          SVN_ERR_ASSERT(base_node->presence
> +                                == svn_wc__db_status_server_excluded);
>           /* ### should be svn_node_unknown, but let's store what we have. */
>           base_node->kind = entry->kind;
> +
> +          /* Store the most likely revision in the node to avoid
> +             base nodes without a valid revision. Of course
> +             we remember that the data is still incomplete. */
> +          if (!SVN_IS_VALID_REVNUM(base_node->revision) && parent_node->base)
> +            base_node->revision = parent_node->base->revision;

Here: parent_node is dereferenced. As I said, it should be non-NULL
anyways, but for clarity we can assert that.

>...

There are some later changes from Philip which may cause a problem.
I'll note that separately.

This change looks right. Thanks!

Cheers,
-g

Re: FW: svn commit: r1185886 - in /subversion/trunk/subversion: libsvn_wc/entries.c tests/cmdline/upgrade_tests.py

Posted by Greg Stein <gs...@gmail.com>.
Sure. Thanks for the heads up. I'll take a look and respond "good" or
with comments...

On Tue, Oct 18, 2011 at 18:08, Bert Huijben <be...@qqmail.nl> wrote:
>        Greg,
>
> If you have some time to spare, could you please review this patch?
>
> I don't think we have a lot of svn_wc_entry_t experts that can review this patch at short notice. This to allow getting it in 1.7.1.
>
> Thanks,
>        Bert
>
>> -----Original Message-----
>> From: rhuijben@apache.org [mailto:rhuijben@apache.org]
>> Sent: dinsdag 18 oktober 2011 23:45
>> To: commits@subversion.apache.org
>> Subject: svn commit: r1185886 - in /subversion/trunk/subversion:
>> libsvn_wc/entries.c tests/cmdline/upgrade_tests.py
>>
>> Author: rhuijben
>> Date: Tue Oct 18 21:45:09 2011
>> New Revision: 1185886
>>
>> URL: http://svn.apache.org/viewvc?rev=1185886&view=rev
>> Log:
>> Make it possible to upgrade server-excluded (or 'absent') nodes from their
>> entries representation. Before this patch server-excluded directories were
>> accidentally upgraded as incomplete directories.
>>
>> * subversion/libsvn_wc/entries.c
>>   (insert_node): Make it possible to write server-excluded presence.
>>   (write_entry): Handle server-excluded like how we handle not-present.
>> This
>>     presence can't be combined with incomplete and there is no subdirectory
>>     with more data which can fill in details later. Absent nodes can't be
>>     shadowed.
>>
>>     Assert earlier code already set the right presence instead of setting the
>>     value again. Copy revision set code from the block that previously handled
>>     absent nodes.
>>
>> * subversion/tests/cmdline/upgrade_tests.py
>>   (upgrade_absent): Remove XFail marking and test that the update doesn't
>>     perform any changes.
>>
>> Modified:
>>     subversion/trunk/subversion/libsvn_wc/entries.c
>>     subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
>>
>> Modified: subversion/trunk/subversion/libsvn_wc/entries.c
>> URL:
>> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entri
>> es.c?rev=1185886&r1=1185885&r2=1185886&view=diff
>> ==========================================================
>> ====================
>> --- subversion/trunk/subversion/libsvn_wc/entries.c (original)
>> +++ subversion/trunk/subversion/libsvn_wc/entries.c Tue Oct 18 21:45:09
>> 2011
>> @@ -1466,6 +1466,8 @@ insert_node(svn_sqlite__db_t *sdb,
>>      SVN_ERR(svn_sqlite__bind_text(stmt, 8, "incomplete"));
>>    else if (node->presence == svn_wc__db_status_excluded)
>>      SVN_ERR(svn_sqlite__bind_text(stmt, 8, "excluded"));
>> +  else if (node->presence == svn_wc__db_status_server_excluded)
>> +    SVN_ERR(svn_sqlite__bind_text(stmt, 8, "absent"));
>>
>>    if (node->kind == svn_node_none)
>>      SVN_ERR(svn_sqlite__bind_text(stmt, 10, "unknown"));
>> @@ -1697,10 +1699,10 @@ write_entry(struct write_baton **entry_n
>>        SVN_ERR_ASSERT(!entry->incomplete);
>>        base_node->presence = svn_wc__db_status_not_present;
>>      }
>> -
>> -  if (entry->absent)
>> +  else if (entry->absent)
>>      {
>> -      SVN_ERR_ASSERT(base_node && !working_node);
>> +      SVN_ERR_ASSERT(base_node && !working_node &&
>> !below_working_node);
>> +      SVN_ERR_ASSERT(!entry->incomplete);
>>        base_node->presence = svn_wc__db_status_server_excluded;
>>      }
>>
>> @@ -1873,9 +1875,22 @@ write_entry(struct write_baton **entry_n
>>
>>        if (entry->deleted)
>>          {
>> -          base_node->presence = svn_wc__db_status_not_present;
>> +          SVN_ERR_ASSERT(base_node->presence ==
>> svn_wc__db_status_not_present);
>> +          /* ### should be svn_node_unknown, but let's store what we have.
>> */
>> +          base_node->kind = entry->kind;
>> +        }
>> +      else if (entry->absent)
>> +        {
>> +          SVN_ERR_ASSERT(base_node->presence
>> +                                == svn_wc__db_status_server_excluded);
>>            /* ### should be svn_node_unknown, but let's store what we have. */
>>            base_node->kind = entry->kind;
>> +
>> +          /* Store the most likely revision in the node to avoid
>> +             base nodes without a valid revision. Of course
>> +             we remember that the data is still incomplete. */
>> +          if (!SVN_IS_VALID_REVNUM(base_node->revision) && parent_node-
>> >base)
>> +            base_node->revision = parent_node->base->revision;
>>          }
>>        else
>>          {
>>
>> Modified: subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
>> URL:
>> http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/
>> upgrade_tests.py?rev=1185886&r1=1185885&r2=1185886&view=diff
>> ==========================================================
>> ====================
>> --- subversion/trunk/subversion/tests/cmdline/upgrade_tests.py (original)
>> +++ subversion/trunk/subversion/tests/cmdline/upgrade_tests.py Tue Oct
>> 18 21:45:09 2011
>> @@ -1199,36 +1199,40 @@ def upgrade_file_externals(sbox):
>>        })
>>
>>  @Skip(svntest.main.is_ra_type_file)
>> -@XFail()
>>  def upgrade_absent(sbox):
>> -  "upgrade absent nodes"
>> -
>> +  "upgrade absent nodes to server-excluded"
>> +
>>    # Install wc and repos
>>    replace_sbox_with_tarfile(sbox, 'upgrade_absent.tar.bz2')
>>    replace_sbox_repo_with_tarfile(sbox, 'upgrade_absent_repos.tar.bz2')
>> -
>> +
>>    # Update config for authz
>>    svntest.main.write_restrictive_svnserve_conf(sbox.repo_dir)
>>    svntest.main.write_authz_file(sbox, { "/"      : "*=rw",
>>                                          "/A/B"   : "*=",
>>                                          "/A/B/E" : "jrandom = rw"})
>> -
>> +
>>    # Attempt to use the working copy, this should give an error
>>    expected_stderr = wc_is_too_old_regex
>>    svntest.actions.run_and_verify_svn(None, None, expected_stderr,
>>                                       'info', sbox.wc_dir)
>> +
>>    # Now upgrade the working copy
>>    svntest.actions.run_and_verify_svn(None, None, [],
>>                                       'upgrade', sbox.wc_dir)
>>
>> -  #
>> +  # Relocate to allow finding the repository
>>    svntest.actions.run_and_verify_svn(None, None, [], 'relocate',
>>                                       'svn://127.0.0.1/authz_tests-2',
>>                                       sbox.repo_url, sbox.wc_dir)
>>
>> -  # This currently fails because the absent node is incorrectly upgraded
>> -  sbox.simple_update()
>> -
>> +  expected_output = svntest.wc.State(sbox.wc_dir, {
>> +  })
>> +
>> +  # Expect no changes and certainly no errors
>> +  svntest.actions.run_and_verify_update(sbox.wc_dir, expected_output,
>> +                                        None, None)
>> +
>>
>> ##########################################################
>> ##############
>>  # Run the tests
>>
>>
>
>
>

FW: svn commit: r1185886 - in /subversion/trunk/subversion: libsvn_wc/entries.c tests/cmdline/upgrade_tests.py

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

If you have some time to spare, could you please review this patch?

I don't think we have a lot of svn_wc_entry_t experts that can review this patch at short notice. This to allow getting it in 1.7.1.

Thanks,
	Bert

> -----Original Message-----
> From: rhuijben@apache.org [mailto:rhuijben@apache.org]
> Sent: dinsdag 18 oktober 2011 23:45
> To: commits@subversion.apache.org
> Subject: svn commit: r1185886 - in /subversion/trunk/subversion:
> libsvn_wc/entries.c tests/cmdline/upgrade_tests.py
> 
> Author: rhuijben
> Date: Tue Oct 18 21:45:09 2011
> New Revision: 1185886
> 
> URL: http://svn.apache.org/viewvc?rev=1185886&view=rev
> Log:
> Make it possible to upgrade server-excluded (or 'absent') nodes from their
> entries representation. Before this patch server-excluded directories were
> accidentally upgraded as incomplete directories.
> 
> * subversion/libsvn_wc/entries.c
>   (insert_node): Make it possible to write server-excluded presence.
>   (write_entry): Handle server-excluded like how we handle not-present.
> This
>     presence can't be combined with incomplete and there is no subdirectory
>     with more data which can fill in details later. Absent nodes can't be
>     shadowed.
> 
>     Assert earlier code already set the right presence instead of setting the
>     value again. Copy revision set code from the block that previously handled
>     absent nodes.
> 
> * subversion/tests/cmdline/upgrade_tests.py
>   (upgrade_absent): Remove XFail marking and test that the update doesn't
>     perform any changes.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_wc/entries.c
>     subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
> 
> Modified: subversion/trunk/subversion/libsvn_wc/entries.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/entri
> es.c?rev=1185886&r1=1185885&r2=1185886&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/entries.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/entries.c Tue Oct 18 21:45:09
> 2011
> @@ -1466,6 +1466,8 @@ insert_node(svn_sqlite__db_t *sdb,
>      SVN_ERR(svn_sqlite__bind_text(stmt, 8, "incomplete"));
>    else if (node->presence == svn_wc__db_status_excluded)
>      SVN_ERR(svn_sqlite__bind_text(stmt, 8, "excluded"));
> +  else if (node->presence == svn_wc__db_status_server_excluded)
> +    SVN_ERR(svn_sqlite__bind_text(stmt, 8, "absent"));
> 
>    if (node->kind == svn_node_none)
>      SVN_ERR(svn_sqlite__bind_text(stmt, 10, "unknown"));
> @@ -1697,10 +1699,10 @@ write_entry(struct write_baton **entry_n
>        SVN_ERR_ASSERT(!entry->incomplete);
>        base_node->presence = svn_wc__db_status_not_present;
>      }
> -
> -  if (entry->absent)
> +  else if (entry->absent)
>      {
> -      SVN_ERR_ASSERT(base_node && !working_node);
> +      SVN_ERR_ASSERT(base_node && !working_node &&
> !below_working_node);
> +      SVN_ERR_ASSERT(!entry->incomplete);
>        base_node->presence = svn_wc__db_status_server_excluded;
>      }
> 
> @@ -1873,9 +1875,22 @@ write_entry(struct write_baton **entry_n
> 
>        if (entry->deleted)
>          {
> -          base_node->presence = svn_wc__db_status_not_present;
> +          SVN_ERR_ASSERT(base_node->presence ==
> svn_wc__db_status_not_present);
> +          /* ### should be svn_node_unknown, but let's store what we have.
> */
> +          base_node->kind = entry->kind;
> +        }
> +      else if (entry->absent)
> +        {
> +          SVN_ERR_ASSERT(base_node->presence
> +                                == svn_wc__db_status_server_excluded);
>            /* ### should be svn_node_unknown, but let's store what we have. */
>            base_node->kind = entry->kind;
> +
> +          /* Store the most likely revision in the node to avoid
> +             base nodes without a valid revision. Of course
> +             we remember that the data is still incomplete. */
> +          if (!SVN_IS_VALID_REVNUM(base_node->revision) && parent_node-
> >base)
> +            base_node->revision = parent_node->base->revision;
>          }
>        else
>          {
> 
> Modified: subversion/trunk/subversion/tests/cmdline/upgrade_tests.py
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/
> upgrade_tests.py?rev=1185886&r1=1185885&r2=1185886&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/tests/cmdline/upgrade_tests.py (original)
> +++ subversion/trunk/subversion/tests/cmdline/upgrade_tests.py Tue Oct
> 18 21:45:09 2011
> @@ -1199,36 +1199,40 @@ def upgrade_file_externals(sbox):
>        })
> 
>  @Skip(svntest.main.is_ra_type_file)
> -@XFail()
>  def upgrade_absent(sbox):
> -  "upgrade absent nodes"
> -
> +  "upgrade absent nodes to server-excluded"
> +
>    # Install wc and repos
>    replace_sbox_with_tarfile(sbox, 'upgrade_absent.tar.bz2')
>    replace_sbox_repo_with_tarfile(sbox, 'upgrade_absent_repos.tar.bz2')
> -
> +
>    # Update config for authz
>    svntest.main.write_restrictive_svnserve_conf(sbox.repo_dir)
>    svntest.main.write_authz_file(sbox, { "/"      : "*=rw",
>                                          "/A/B"   : "*=",
>                                          "/A/B/E" : "jrandom = rw"})
> -
> +
>    # Attempt to use the working copy, this should give an error
>    expected_stderr = wc_is_too_old_regex
>    svntest.actions.run_and_verify_svn(None, None, expected_stderr,
>                                       'info', sbox.wc_dir)
> +
>    # Now upgrade the working copy
>    svntest.actions.run_and_verify_svn(None, None, [],
>                                       'upgrade', sbox.wc_dir)
> 
> -  #
> +  # Relocate to allow finding the repository
>    svntest.actions.run_and_verify_svn(None, None, [], 'relocate',
>                                       'svn://127.0.0.1/authz_tests-2',
>                                       sbox.repo_url, sbox.wc_dir)
> 
> -  # This currently fails because the absent node is incorrectly upgraded
> -  sbox.simple_update()
> -
> +  expected_output = svntest.wc.State(sbox.wc_dir, {
> +  })
> +
> +  # Expect no changes and certainly no errors
> +  svntest.actions.run_and_verify_update(sbox.wc_dir, expected_output,
> +                                        None, None)
> +
> 
> ##########################################################
> ##############
>  # Run the tests
> 
>