[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1470904 - /subversion/trunk/subversion/libsvn_wc/wc-metadata.sql

From: Paul Burba <ptburba_at_gmail.com>
Date: Thu, 25 Apr 2013 15:38:21 -0400

On Thu, Apr 25, 2013 at 1:05 PM, Philip Martin
<philip.martin_at_wandisco.com> wrote:
> Paul Burba <ptburba_at_gmail.com> writes:
>
>>> # We expect the repos root property to show up here!
>>>
>>> 1.9.0-dev_at_1475809>svn pg svn:auto-props . --show-inherited-props
>>>
>>> 1.9.0-dev_at_1475809>
>
> Is that expected? The inherited property is not in the 1.7 working
> copy. Do you expect upgrade to contact the repository and add the
> inherited properties to the upgraded working copy? Nobody has written
> code to do that as far as I can see. Or do you expect propget to
> contact the repository? As far as I can see inherited properties are
> not available from the working copy until an update has be carried out.

My mistake Philip, you are quite right about the cache not being
updated until an update takes place. I was looking at the db and saw
that no empty cache was created, so I didn't bother with the update
that (I thought) wouldn't make a difference. My earlier example
expanded a bit:

1.9.0-dev_at_1475809>cd wc-non-root

1.9.0-dev_at_1475809>svn st
..\..\..\subversion\svn\svn.c:2899: (apr_err=SVN_ERR_WC_UPGRADE_REQUIRED)
svn: E155036: Please see the 'svn upgrade' command
..\..\..\subversion\svn\status-cmd.c:352,
..\..\..\subversion\svn\util.c:621,
..\..\..\subversion\libsvn_client\status.c:590,
..\..\..\subversion\libsvn_wc\status.c:2817,
..\..\..\subversion\libsvn_wc\status.c:2723,
..\..\..\subversion\libsvn_wc\status.c:270,
..\..\..\subversion\libsvn_wc\wc_db.c:8446,
..\..\..\subversion\libsvn_wc\wc_db_wcroot.c:687,
..\..\..\subversion\libsvn_wc\wc_db_wcroot.c:317:
(apr_err=SVN_ERR_WC_UPGRADE_REQUIRED)
svn: E155036: The working copy at
'C:\SVN\src-branch-1.7.x\Debug\subversion\tests\cmdline\svn-test-work\working_copies\wc-non-root'
is too old (format 29) to work with client version '1.9.0-dev (under
development)' (expects format 31). You need to upgrade the working
copy first.

1.9.0-dev_at_1475809>svn upgrade

# Note that all the INHERITED_PROPS fields are null:

1.9.0-dev_at_1475809>sqlite3 .svn\wc.db
SQLite version 3.7.16.2 2013-04-12 11:52:43
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select LOCAL_RELPATH, INHERITED_PROPS from NODES;
E/alpha|
E/beta|
E|
F|
lambda|
|
sqlite>

# Turns out, that once we update, the missing cache is created and populated:

1.9.0-dev_at_1475809>svn up
Updating '.':
At revision 9.

1.9.0-dev_at_1475809>sqlite3 .svn\wc.db
SQLite version 3.7.16.2 2013-04-12 11:52:43
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select LOCAL_RELPATH, INHERITED_PROPS from NODES;
E/alpha|
E/beta|
E|
F|
lambda|
|(0 (rootprop propval svn:auto-props 26 *.c = svn:eol-style=native))
sqlite>
^C
1.9.0-dev_at_1475809>

However the fact that the missing empty cache is created and populated
is just a fortuitous side effect of how we handle externals[1].
Assuming we don't want to rely on that bit of good luck indefinitely,
how about this?

Index: subversion/libsvn_wc/wc-metadata.sql
===================================================================
--- subversion/libsvn_wc/wc-metadata.sql (revision 1475906)
+++ subversion/libsvn_wc/wc-metadata.sql (working copy)
@@ -841,10 +841,11 @@
 LEFT OUTER JOIN nodes as r
 ON l.wc_id = r.wc_id
    AND r.local_relpath = l.parent_relpath
-WHERE l.op_depth = 0 AND r.op_depth = 0
- AND l.repos_path != ''
- AND ((l.repos_id IS NOT r.repos_id)
- OR (l.repos_path IS NOT RELPATH_SKIP_JOIN(r.local_relpath,
r.repos_path, l.local_relpath)))
+WHERE (l.op_depth = 0 AND l.local_relpath = '' AND l.repos_path != '')
+ OR (l.op_depth = 0 AND r.op_depth = 0
+ AND l.repos_path != ''
+ AND ((l.repos_id IS NOT r.repos_id)
+ OR (l.repos_path IS NOT RELPATH_SKIP_JOIN(r.local_relpath,
r.repos_path, l.local_relpath))))

 /* ------------------------------------------------------------------------- */

--
Paul T. Burba
CollabNet, Inc. -- www.collab.net -- Enterprise Cloud Development
Skype: ptburba
[1] See libsvn_client/iprops.c:get_inheritable_props():
/* The real implementation of svn_client__get_inheritable_props */
static svn_error_t *
get_inheritable_props(apr_hash_t **wcroot_iprops,
                      const char *local_abspath,
                      svn_revnum_t revision,
                      svn_depth_t depth,
                      svn_ra_session_t *ra_session,
                      svn_client_ctx_t *ctx,
                      apr_pool_t *result_pool,
                      apr_pool_t *scratch_pool)
{
  apr_hash_t *iprop_paths;
  apr_hash_index_t *hi;
  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
  apr_pool_t *session_pool = NULL;
  *wcroot_iprops = apr_hash_make(result_pool);
  SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(revision));
  /* If we don't have a base revision for LOCAL_ABSPATH then it can't
     possibly be a working copy root, nor can it contain any WC roots
     in the form of switched subtrees.  So there is nothing to cache. */
  SVN_ERR(svn_wc__get_cached_iprop_children(&iprop_paths, depth,
                                            ctx->wc_ctx, local_abspath,
                                            scratch_pool, iterpool));
  /* If we are in the midst of a checkout or an update that is bringing in
     an external, then svn_wc__get_cached_iprop_children won't return
     LOCAL_ABSPATH in IPROPS_PATHS because the former has no cached iprops
     yet.  So make sure LOCAL_ABSPATH is present if it's a WC root. */
We enter this block when we update the WC root
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
  if (!svn_hash_gets(iprop_paths, local_abspath))
    {
      svn_boolean_t needs_cached_iprops;
      SVN_ERR(need_to_cache_iprops(&needs_cached_iprops, local_abspath,
                                   ra_session, ctx, iterpool));
      if (needs_cached_iprops)
        {
          const char *target_abspath = apr_pstrdup(scratch_pool,
                                                   local_abspath);
          /* As value we set TARGET_ABSPATH, but any string besides ""
             would do */
          svn_hash_sets(iprop_paths, target_abspath, target_abspath);
        }
    }
Received on 2013-04-25 21:38:52 CEST

This is an archived mail posted to the Subversion Dev mailing list.