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

Re: Are repos_id and repos_path supposed to be filled in for working nodes (op-depth > 0)?

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 31 May 2011 21:34:20 +0100

Ugh, this was a really poor email I tried to dash off in a hurry before
stopping for the day. Some background was Bert suggested a couple of
weeks back that I could add a validation that "where op_depth > 0:
repos_path:repos_id:revision should match that of the op-root, extended
by the right relpath" so I was trying to do such a thing. Will follow
up tomorrow.

- Julian

On Tue, 2011-05-31 at 21:02 +0100, Julian Foad wrote:
> A question which I want to validate. wc-metadata.sql says:
>
> /* Repository location fields */
>
> /* When op_depth == 0, these fields refer to the repository location
> of the BASE node, the location of the initial checkout.
>
> When op_depth != 0, they indicate where this node was copied/moved
> from. In this case, the fields are set only on the root of the
> operation, and are NULL for all children. */
> repos_id INTEGER REFERENCES REPOSITORY (id),
> repos_path TEXT,
> revision INTEGER,
>
> But this doesn't seem to be true. What are the rules for these fields?
> I'm trying various things like the snippets of patch shown below, but
> have not come up with a good answer yet.
>
> - Julian
>
>
> [[[
> Bits of experimental change and experimental validation. These don't
> pass all tests.
>
> Index: subversion/libsvn_wc/wc-checks.sql
> ===================================================================
> --- subversion/libsvn_wc/wc-checks.sql (revision 1129848)
> +++ subversion/libsvn_wc/wc-checks.sql (working copy)
> @@ -73,3 +73,29 @@ BEGIN
> SELECT RAISE(FAIL, 'WC DB validity check 04 failed');
> END;
>
> +/* Verify: on every NODES row where op_depth > 0: if it's not an op-root then
> + * repos_path:repos_id:revision should be null. */
> +/*
> +CREATE TEMP TRIGGER validation_05 BEFORE INSERT ON nodes
> +WHEN NOT (new.op_depth = 0
> + OR new.op_depth = relpath_depth(new.local_relpath)
> + OR (new.repos_id IS NULL AND new.repos_path IS NULL))
> +BEGIN
> + SELECT RAISE(FAIL, 'WC DB validity check 05 failed');
> +END;
> +*/
> +
> +/* Verify: on every NODES row where op_depth > 0: repos_path:repos_id:revision
> + * should match that of the op-root, extended by the right relpath. */
> +/* ### TODO: Check repos_path. */
> +CREATE TEMP TRIGGER validation_05 BEFORE INSERT ON nodes
> +WHEN NOT (new.op_depth = 0
> + OR new.op_depth = relpath_depth(new.local_relpath)
> + OR EXISTS (SELECT 1 FROM nodes
> + WHERE wc_id = new.wc_id AND op_depth = new.op_depth
> + AND local_relpath = new.parent_relpath
> + AND repos_id = new.repos_id
> + AND revision = new.revision))
> +BEGIN
> + SELECT RAISE(FAIL, 'WC DB validity check 05 failed');
> +END;
> Index: subversion/libsvn_wc/wc_db.c
> ===================================================================
> --- subversion/libsvn_wc/wc_db.c (revision 1129848)
> +++ subversion/libsvn_wc/wc_db.c (working copy)
> @@ -1039,8 +1039,8 @@ insert_working_node(void *baton,
> if (piwb->kind == svn_wc__db_kind_dir && piwb->children)
> SVN_ERR(insert_incomplete_children(wcroot->sdb, wcroot->wc_id,
> local_relpath,
> - INVALID_REPOS_ID /* inherit repos_id */,
> - NULL /* inherit repos_path */,
> + piwb->original_repos_id,
> + piwb->original_repos_relpath,
> piwb->original_revnum,
> piwb->children,
> piwb->op_depth,
> @@ -3606,9 +3606,7 @@ db_op_copy(svn_wc__db_wcroot_t *src_wcro
> dst_wcroot->sdb,
> dst_wcroot->wc_id,
> dst_relpath,
> - INVALID_REPOS_ID /* inherit repos_id */,
> - NULL /* inherit repos_path */,
> - copyfrom_rev,
> + copyfrom_id, copyfrom_relpath, copyfrom_rev,
> children,
> dst_op_depth,
> scratch_pool));
> Index: subversion/libsvn_wc/wc-metadata.sql
> ===================================================================
> --- subversion/libsvn_wc/wc-metadata.sql (revision 1129848)
> +++ subversion/libsvn_wc/wc-metadata.sql (working copy)
> @@ -313,11 +313,11 @@ CREATE TABLE NODES (
> /* Repository location fields */
>
> /* When op_depth == 0, these fields refer to the repository location of the
> - BASE node, the location of the initial checkout.
> + BASE node, the location of the initial checkout, and are never null.
>
> When op_depth != 0, they indicate where this node was copied/moved from.
> - In this case, the fields are set only on the root of the operation,
> - and are NULL for all children. */
> + revision is not null; repos_id and repos_path are null if not copied or
> + moved. */
> repos_id INTEGER REFERENCES REPOSITORY (id),
> repos_path TEXT,
> revision INTEGER,
> ]]]
>
>
Received on 2011-05-31 22:35:01 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.