On Tue, Apr 23, 2013 at 7:42 AM, <rhuijben_at_apache.org> wrote:
> Author: rhuijben
> Date: Tue Apr 23 11:42:04 2013
> New Revision: 1470904
>
> URL: http://svn.apache.org/r1470904
> Log:
> * subversion/libsvn_wc/wc-metadata.sql
> (STMT_UPGRADE_31_SELECT_WCROOT_NODES): Replace some ugly SQL with some
> slightly less ugly sql that more accurately describes what we do here.
>
> Modified:
> subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
>
> Modified: subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-metadata.sql?rev=1470904&r1=1470903&r2=1470904&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_wc/wc-metadata.sql (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc-metadata.sql Tue Apr 23 11:42:04 2013
> @@ -840,17 +840,15 @@ PRAGMA user_version = 31;
> SELECT l.wc_id, l.local_relpath FROM nodes as l
> LEFT OUTER JOIN nodes as r
> ON l.wc_id = r.wc_id
> - AND l.repos_id = r.repos_id
> AND r.local_relpath = l.parent_relpath
> -WHERE (l.local_relpath = '' AND l.repos_path != '')
> - OR (l.op_depth = 0
> - AND l.local_relpath != ''
> - AND l.repos_path != ltrim(r.repos_path
> - || '/'
> - || ltrim(substr(l.local_relpath,
> - length(l.parent_relpath) + 1),
> - '/'),
> - '/'))
> + AND r.op_depth = 0 AND l.op_depth = 0
> + AND l.repos_path != ''
> +WHERE (l.local_relpath = '')
Hi Bert,
I believe this needs to be:
+WHERE (l.local_relpath = '' AND l.repos_path != '')
Otherwise we select the root of the working copy even when that root
points to the root of the repository (and obviously has no parent to
inherit from). This is not what STMT_UPGRADE_31_SELECT_WCROOT_NODES
promises:
-- STMT_UPGRADE_31_SELECT_WCROOT_NODES
/* Select all base nodes which are the root of a WC, including
switched subtrees, but excluding those which map to the root
of the repos.
Here's a quick example:
Check out a WC with a 1.7 client:
1.7.9-dev>svn co
file:///C:/SVN/src-branch-1.7.x/Debug/subversion/tests/cmdline/svn-test-work/repositories/merge_tests-101
wc-root
A wc-root\iota
A wc-root\branch
A wc-root\branch\J
<snip>
A wc-root\A\D\H\chi
A wc-root\A\D\H\omega
A wc-root\A\D\H\psi
Checked out revision 7.
1.7.9-dev>
1.9.0-dev>cd wc-root
...
Now assume we are going to run upgrade. The current query:
SELECT l.wc_id, l.local_relpath FROM nodes as l
LEFT OUTER JOIN nodes as r
ON l.wc_id = r.wc_id
AND r.local_relpath = l.parent_relpath
AND r.op_depth = 0 AND l.op_depth = 0
AND l.repos_path != ''
WHERE (l.local_relpath = '')
OR (l.local_relpath != '' AND l.repos_id != r.repos_id)
OR (l.local_relpath != ''
AND l.repos_path
!= (CASE WHEN (r.local_relpath) = '' THEN (CASE WHEN
(r.repos_path) = '' THEN (l.local_relpath) WHEN (l.local_relpath) = ''
THEN (r.repos_path) ELSE (r.repos_path) || '/' || (l.local_relpath)
END) WHEN (r.repos_path) = '' THEN (CASE WHEN (r.local_relpath) = ''
THEN (l.local_relpath) WHEN SUBSTR((l.local_relpath), 1,
LENGTH(r.local_relpath)) = (r.local_relpath) THEN CASE WHEN
LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN '' WHEN
SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN
SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+2) END END) WHEN
SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) =
(r.local_relpath) THEN CASE WHEN LENGTH(r.local_relpath) =
LENGTH(l.local_relpath) THEN (r.repos_path) WHEN
SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN
(r.repos_path) || SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1)
END END))
Returns the root:
#|wc_id|local_relpath
-+-----+-------------
1|1 |
1 row(s) affected in 0.00142 second(s).
Which ultimately causes libsvn_wc/upgrade:bump_to_31() to create an
INHERITED_PROPS cache for the WC root, albeit and empty one.
The tweak I suggest above avoids the root from being selected:
SELECT l.wc_id, l.local_relpath FROM nodes as l
LEFT OUTER JOIN nodes as r
ON l.wc_id = r.wc_id
AND r.local_relpath = l.parent_relpath
AND r.op_depth = 0 AND l.op_depth = 0
AND l.repos_path != ''
WHERE (l.local_relpath = '' AND l.repos_path != '')
OR (l.local_relpath != '' AND l.repos_id != r.repos_id)
OR (l.local_relpath != ''
AND l.repos_path
!= (CASE WHEN (r.local_relpath) = '' THEN (CASE WHEN
(r.repos_path) = '' THEN (l.local_relpath) WHEN (l.local_relpath) = ''
THEN (r.repos_path) ELSE (r.repos_path) || '/' || (l.local_relpath)
END) WHEN (r.repos_path) = '' THEN (CASE WHEN (r.local_relpath) = ''
THEN (l.local_relpath) WHEN SUBSTR((l.local_relpath), 1,
LENGTH(r.local_relpath)) = (r.local_relpath) THEN CASE WHEN
LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN '' WHEN
SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN
SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+2) END END) WHEN
SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) =
(r.local_relpath) THEN CASE WHEN LENGTH(r.local_relpath) =
LENGTH(l.local_relpath) THEN (r.repos_path) WHEN
SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN
(r.repos_path) || SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1)
END END))
#
-
0 row(s) affected in 0.001448 second(s).
FWIW, the empty INHERITED_PROPS cache that is currently created
doesn't cause any problems that I can see. It is also removed upon
the first update, but it still shouldn't be there. Does my change
look right to you?
--
Paul T. Burba
CollabNet, Inc. -- www.collab.net -- Enterprise Cloud Development
Skype: ptburba
> + OR (l.local_relpath != '' AND l.repos_id != r.repos_id)
> + OR (l.local_relpath != ''
> + AND l.repos_path
> + != RELPATH_SKIP_JOIN(r.local_relpath, r.repos_path, l.local_relpath))
> +
>
> /* ------------------------------------------------------------------------- */
> /* Format 32 .... */
>
>
Received on 2013-04-24 23:50:48 CEST