~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_wc/wc-metadata.sql

  • Committer: Package Import Robot
  • Author(s): James McCoy, Peter Samuelson, James McCoy
  • Date: 2014-01-12 19:48:33 UTC
  • mfrom: (0.2.10)
  • Revision ID: package-import@ubuntu.com-20140112194833-w3axfwksn296jn5x
Tags: 1.8.5-1
[ Peter Samuelson ]
* New upstream release.  (Closes: #725787) Rediff patches:
  - Remove apr-abi1 (applied upstream), rename apr-abi2 to apr-abi
  - Remove loosen-sqlite-version-check (shouldn't be needed)
  - Remove java-osgi-metadata (applied upstream)
  - svnmucc prompts for a changelog if none is provided. (Closes: #507430)
  - Remove fix-bdb-version-detection, upstream uses "apu-config --dbm-libs"
  - Remove ruby-test-wc (applied upstream)
  - Fix “svn diff -r N file” when file has svn:mime-type set.
    (Closes: #734163)
  - Support specifying an encoding for mod_dav_svn's environment in which
    hooks are run.  (Closes: #601544)
  - Fix ordering of “svnadmin dump” paths with certain APR versions.
    (Closes: #687291)
  - Provide a better error message when authentication fails with an
    svn+ssh:// URL.  (Closes: #273874)
  - Updated Polish translations.  (Closes: #690815)

[ James McCoy ]
* Remove all traces of libneon, replaced by libserf.
* patches/sqlite_3.8.x_workaround: Upstream fix for wc-queries-test test
  failurse.
* Run configure with --with-apache-libexecdir, which allows removing part of
  patches/rpath.
* Re-enable auth-test as upstream has fixed the problem of picking up
  libraries from the environment rather than the build tree.
  (Closes: #654172)
* Point LD_LIBRARY_PATH at the built auth libraries when running the svn
  command during the build.  (Closes: #678224)
* Add a NEWS entry describing how to configure mod_dav_svn to understand
  UTF-8.  (Closes: #566148)
* Remove ancient transitional package, libsvn-ruby.
* Enable compatibility with Sqlite3 versions back to Wheezy.
* Enable hardening flags.  (Closes: #734918)
* patches/build-fixes: Enable verbose build logs.
* Build against the default ruby version.  (Closes: #722393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
/*
25
25
 * the KIND column in these tables has one of the following values
26
 
 * (documented in the corresponding C type #svn_wc__db_kind_t):
 
26
 * (documented in the corresponding C type #svn_kind_t):
27
27
 *   "file"
28
28
 *   "dir"
29
29
 *   "symlink"
30
30
 *   "unknown"
31
 
 *   "subdir"
32
31
 *
33
32
 * the PRESENCE column in these tables has one of the following values
34
33
 * (see also the C type #svn_wc__db_status_t):
35
34
 *   "normal"
36
 
 *   "absent" -- server has declared it "absent" (ie. authz failure)
 
35
 *   "server-excluded" -- server has declared it excluded (ie. authz failure)
37
36
 *   "excluded" -- administratively excluded (ie. sparse WC)
38
37
 *   "not-present" -- node not present at this REV
39
38
 *   "incomplete" -- state hasn't been filled in
108
107
  md5_checksum  TEXT NOT NULL
109
108
  );
110
109
 
111
 
 
 
110
CREATE INDEX I_PRISTINE_MD5 ON PRISTINE (md5_checksum);
 
111
  
112
112
/* ------------------------------------------------------------------------- */
113
113
 
114
114
/* The ACTUAL_NODE table describes text changes and property changes
170
170
  /* stsp: This is meant for text conflicts, right? What about property
171
171
           conflicts? Why do we need these in a column to refer to the
172
172
           pristine store? Can't we just parse the checksums from
173
 
           conflict_data as well? */
 
173
           conflict_data as well? 
 
174
     rhuijben: Because that won't allow triggers to handle refcounts.
 
175
               We would have to scan all conflict skels before cleaning up the
 
176
               a single file from the pristine stor */
174
177
  older_checksum  TEXT REFERENCES PRISTINE (checksum),
175
178
  left_checksum  TEXT REFERENCES PRISTINE (checksum),
176
179
  right_checksum  TEXT REFERENCES PRISTINE (checksum),
178
181
  PRIMARY KEY (wc_id, local_relpath)
179
182
  );
180
183
 
181
 
CREATE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath);
182
 
CREATE INDEX I_ACTUAL_CHANGELIST ON ACTUAL_NODE (changelist);
 
184
CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath,
 
185
                                                    local_relpath);
183
186
 
184
187
 
185
188
/* ------------------------------------------------------------------------- */
250
253
   op_depth values are not normally visible to the user but may become
251
254
   visible after reverting local changes.
252
255
 
253
 
   ### The following text needs revision
254
 
 
255
 
   Each row in BASE_NODE has an associated row NODE_DATA. Additionally, each
256
 
   row in WORKING_NODE has one or more associated rows in NODE_DATA.
257
 
 
258
256
   This table contains full node descriptions for nodes in either the BASE
259
257
   or WORKING trees as described in notes/wc-ng/design. Fields relate
260
258
   both to BASE and WORKING trees, unless documented otherwise.
261
259
 
262
 
   ### This table is to be integrated into the SCHEMA statement as soon
263
 
       the experimental status of NODES is lifted.
264
 
   ### This table superseeds NODE_DATA
265
 
 
266
260
   For illustration, with a scenario like this:
267
261
 
268
262
     # (0)
272
266
     touch foo/bar
273
267
     svn add foo/bar    # (2)
274
268
 
275
 
   , these are the NODES for the path foo/bar (before single-db, the
276
 
   numbering of op_depth is still a bit different):
 
269
   , these are the NODES table rows for the path foo/bar:
277
270
 
278
 
   (0)  BASE_NODE ----->  NODES (op_depth == 0)
279
 
   (1)                    NODES (op_depth == 1) ( <----_ )
280
 
   (2)                    NODES (op_depth == 2)   <----- WORKING_NODE
 
271
   (0)  "BASE" --->  NODES (op_depth == 0)
 
272
   (1)               NODES (op_depth == 1)
 
273
   (2)               NODES (op_depth == 2)
281
274
 
282
275
   0 is the original data for foo/bar before 'svn rm foo' (if it existed).
283
276
   1 is the data for foo/bar copied in from ^/moo/bar.
316
309
     BASE node, the location of the initial checkout.
317
310
 
318
311
     When op_depth != 0, they indicate where this node was copied/moved from.
319
 
     In this case, the fields are set only on the root of the operation,
320
 
     and are NULL for all children. */
 
312
     In this case, the fields are set for the root of the operation and for all
 
313
     children. */
321
314
  repos_id  INTEGER REFERENCES REPOSITORY (id),
322
315
  repos_path  TEXT,
323
316
  revision  INTEGER,
364
357
       current 'op_depth'.  This state is badly named, it should be
365
358
       something like 'deleted'.
366
359
 
367
 
     absent: in the 'BASE' tree this is a node that is excluded by
 
360
     server-excluded: in the 'BASE' tree this is a node that is excluded by
368
361
       authz.  The name of the node is known from the parent, but no
369
362
       other information is available.  Not valid in the 'WORKING'
370
363
       tree as there is no way to commit such a node.
384
377
     perhaps add a column called "moved_from". */
385
378
 
386
379
  /* Boolean value, specifying if this node was moved here (rather than just
387
 
     copied). The source of the move is specified in copyfrom_*.  */
 
380
     copied). This is set on all the nodes in the moved tree.  The source of
 
381
     the move is implied by a different node with a moved_to column pointing
 
382
     at the root node of the moved tree. */
388
383
  moved_here  INTEGER,
389
384
 
390
385
  /* If the underlying node was moved away (rather than just deleted), this
391
 
     specifies the local_relpath of where the BASE node was moved to.
 
386
     specifies the local_relpath of where the node was moved to.
392
387
     This is set only on the root of a move, and is NULL for all children.
393
388
 
394
 
     Note that moved_to never refers to *this* node. It always refers
395
 
     to the "underlying" node, whether that is BASE or a child node
396
 
     implied from a parent's move/copy.  */
 
389
     The op-depth of the moved-to node is not recorded. A moved_to path
 
390
     always points at a node within the highest op-depth layer at the
 
391
     destination. This invariant must be maintained by operations which
 
392
     change existing move information. */
397
393
  moved_to  TEXT,
398
394
 
399
395
 
402
398
  /* the kind of the new node. may be "unknown" if the node is not present. */
403
399
  kind  TEXT NOT NULL,
404
400
 
405
 
  /* serialized skel of this node's properties. NULL if we
406
 
     have no information about the properties (a non-present node). */
 
401
  /* serialized skel of this node's properties (when presence is 'normal' or
 
402
     'incomplete'); an empty skel or NULL indicates no properties.  NULL if
 
403
     we have no information about the properties (any other presence).
 
404
     TODO: Choose & require a single representation for 'no properties'.
 
405
  */
407
406
  properties  BLOB,
408
407
 
409
408
  /* NULL depth means "default" (typically svn_depth_infinity) */
460
459
     node does not have any dav-cache. */
461
460
  dav_cache  BLOB,
462
461
 
463
 
  /* The serialized file external information. */
464
 
  /* ### hack.  hack.  hack.
465
 
     ### This information is already stored in properties, but because the
466
 
     ### current working copy implementation is such a pain, we can't
467
 
     ### readily retrieve it, hence this temporary cache column.
468
 
     ### When it is removed, be sure to remove the extra column from
469
 
     ### the db-tests.
470
 
 
471
 
     ### Note: This is only here as a hack, and should *NOT* be added
472
 
     ### to any wc_db APIs.  */
473
 
  file_external  TEXT,
474
 
 
 
462
  /* Is there a file external in this location. NULL if there
 
463
     is no file external, otherwise '1'  */
 
464
  /* ### Originally we had a wc-1.0 like skel in this place, so we
 
465
     ### check for NULL.
 
466
     ### In Subversion 1.7 we defined this column as TEXT, but Sqlite
 
467
     ### only uses this information for deciding how to optimize
 
468
     ### anyway. */
 
469
  file_external  INTEGER,
 
470
 
 
471
  /* serialized skel of this node's inherited properties. NULL if this
 
472
     is not the BASE of a WC root node. */
 
473
  inherited_props  BLOB,
475
474
 
476
475
  PRIMARY KEY (wc_id, local_relpath, op_depth)
477
476
 
478
477
  );
479
478
 
480
 
CREATE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath, op_depth);
 
479
CREATE UNIQUE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath,
 
480
                                             local_relpath, op_depth);
 
481
/* I_NODES_MOVED is introduced in format 30 */
 
482
CREATE UNIQUE INDEX I_NODES_MOVED ON NODES (wc_id, moved_to, op_depth);
481
483
 
482
484
/* Many queries have to filter the nodes table to pick only that version
483
485
   of each node with the highest (most "current") op_depth.  This view
495
497
                        AND n2.local_relpath = n.local_relpath);
496
498
 
497
499
/* Many queries have to filter the nodes table to pick only that version
498
 
   of each node with the base (least "current") op_depth.  This view
 
500
   of each node with the BASE ("as checked out") op_depth.  This view
499
501
   does the heavy lifting for such queries. */
500
502
CREATE VIEW NODES_BASE AS
501
503
  SELECT * FROM nodes
539
541
  local_relpath  TEXT NOT NULL,
540
542
 
541
543
  /* The working copy root can't be recorded as an external in itself
542
 
     so this will never be NULL. */
 
544
     so this will never be NULL. ### ATM only inserted, never queried */
543
545
  parent_relpath  TEXT NOT NULL,
544
546
 
545
547
  /* Repository location fields */
546
548
  repos_id  INTEGER NOT NULL REFERENCES REPOSITORY (id),
547
549
 
548
 
  /* Either 'normal' or 'excluded' */
 
550
  /* Either MAP_NORMAL or MAP_EXCLUDED */
549
551
  presence  TEXT NOT NULL,
550
552
 
551
553
  /* the kind of the external. */
566
568
  PRIMARY KEY (wc_id, local_relpath)
567
569
);
568
570
 
569
 
CREATE INDEX I_EXTERNALS_PARENT ON EXTERNALS (wc_id, parent_relpath);
570
571
CREATE UNIQUE INDEX I_EXTERNALS_DEFINED ON EXTERNALS (wc_id,
571
572
                                                      def_local_relpath,
572
573
                                                      local_relpath);
573
574
 
 
575
/* ------------------------------------------------------------------------- */
 
576
 
574
577
/* Format 20 introduces NODES and removes BASE_NODE and WORKING_NODE */
575
578
 
576
579
-- STMT_UPGRADE_TO_20
577
580
 
578
 
UPDATE BASE_NODE SET checksum=(SELECT checksum FROM pristine
579
 
                           WHERE md5_checksum=BASE_NODE.checksum)
580
 
WHERE EXISTS(SELECT 1 FROM pristine WHERE md5_checksum=BASE_NODE.checksum);
 
581
UPDATE BASE_NODE SET checksum = (SELECT checksum FROM pristine
 
582
                                 WHERE md5_checksum = BASE_NODE.checksum)
 
583
WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = BASE_NODE.checksum);
581
584
 
582
 
UPDATE WORKING_NODE SET checksum=(SELECT checksum FROM pristine
583
 
                           WHERE md5_checksum=WORKING_NODE.checksum)
584
 
WHERE EXISTS(SELECT 1 FROM pristine WHERE md5_checksum=WORKING_NODE.checksum);
 
585
UPDATE WORKING_NODE SET checksum = (SELECT checksum FROM pristine
 
586
                                    WHERE md5_checksum = WORKING_NODE.checksum)
 
587
WHERE EXISTS (SELECT 1 FROM pristine
 
588
              WHERE md5_checksum = WORKING_NODE.checksum);
585
589
 
586
590
INSERT INTO NODES (
587
591
       wc_id, local_relpath, op_depth, parent_relpath,
626
630
-- STMT_UPGRADE_TO_21
627
631
PRAGMA user_version = 21;
628
632
 
 
633
/* For format 21 bump code */
 
634
-- STMT_UPGRADE_21_SELECT_OLD_TREE_CONFLICT
 
635
SELECT wc_id, local_relpath, tree_conflict_data
 
636
FROM actual_node
 
637
WHERE tree_conflict_data IS NOT NULL
 
638
 
 
639
/* For format 21 bump code */
 
640
-- STMT_UPGRADE_21_ERASE_OLD_CONFLICTS
 
641
UPDATE actual_node SET tree_conflict_data = NULL
629
642
 
630
643
/* ------------------------------------------------------------------------- */
631
644
 
647
660
-- STMT_UPGRADE_TO_23
648
661
PRAGMA user_version = 23;
649
662
 
 
663
-- STMT_UPGRADE_23_HAS_WORKING_NODES
 
664
SELECT 1 FROM nodes WHERE op_depth > 0
 
665
LIMIT 1
650
666
 
651
667
/* ------------------------------------------------------------------------- */
652
668
 
696
712
-- STMT_UPGRADE_TO_27
697
713
PRAGMA user_version = 27;
698
714
 
 
715
/* For format 27 bump code */
 
716
-- STMT_UPGRADE_27_HAS_ACTUAL_NODES_CONFLICTS
 
717
SELECT 1 FROM actual_node
 
718
WHERE NOT ((prop_reject IS NULL) AND (conflict_old IS NULL)
 
719
           AND (conflict_new IS NULL) AND (conflict_working IS NULL)
 
720
           AND (tree_conflict_data IS NULL))
 
721
LIMIT 1
 
722
 
 
723
 
699
724
/* ------------------------------------------------------------------------- */
700
725
 
701
726
/* Format 28 involves no schema changes, it only converts MD5 pristine 
703
728
 
704
729
-- STMT_UPGRADE_TO_28
705
730
 
706
 
UPDATE NODES SET checksum=(SELECT checksum FROM pristine
707
 
                           WHERE md5_checksum=nodes.checksum)
708
 
WHERE EXISTS(SELECT 1 FROM pristine WHERE md5_checksum=nodes.checksum);
 
731
UPDATE NODES SET checksum = (SELECT checksum FROM pristine
 
732
                             WHERE md5_checksum = nodes.checksum)
 
733
WHERE EXISTS (SELECT 1 FROM pristine WHERE md5_checksum = nodes.checksum);
709
734
 
710
735
PRAGMA user_version = 28;
711
736
 
751
776
 
752
777
/* ------------------------------------------------------------------------- */
753
778
 
 
779
/* Format 30 creates a new NODES index for move information, and a new
 
780
   PRISTINE index for the md5_checksum column. It also activates use of
 
781
   skel-based conflict storage -- see notes/wc-ng/conflict-storage-2.0.
 
782
   It also renames the "absent" presence to "server-excluded". */
 
783
-- STMT_UPGRADE_TO_30
 
784
CREATE UNIQUE INDEX IF NOT EXISTS I_NODES_MOVED
 
785
ON NODES (wc_id, moved_to, op_depth);
 
786
 
 
787
CREATE INDEX IF NOT EXISTS I_PRISTINE_MD5 ON PRISTINE (md5_checksum);
 
788
 
 
789
UPDATE nodes SET presence = "server-excluded" WHERE presence = "absent";
 
790
 
 
791
/* Just to be sure clear out file external skels from pre 1.7.0 development
 
792
   working copies that were never updated by 1.7.0+ style clients */
 
793
UPDATE nodes SET file_external=1 WHERE file_external IS NOT NULL;
 
794
 
 
795
-- STMT_UPGRADE_30_SELECT_CONFLICT_SEPARATE
 
796
SELECT wc_id, local_relpath,
 
797
  conflict_old, conflict_working, conflict_new, prop_reject, tree_conflict_data
 
798
FROM actual_node
 
799
WHERE conflict_old IS NOT NULL
 
800
   OR conflict_working IS NOT NULL
 
801
   OR conflict_new IS NOT NULL
 
802
   OR prop_reject IS NOT NULL
 
803
   OR tree_conflict_data IS NOT NULL
 
804
ORDER by wc_id, local_relpath
 
805
 
 
806
-- STMT_UPGRADE_30_SET_CONFLICT
 
807
UPDATE actual_node SET conflict_data = ?3, conflict_old = NULL,
 
808
  conflict_working = NULL, conflict_new = NULL, prop_reject = NULL,
 
809
  tree_conflict_data = NULL
 
810
WHERE wc_id = ?1 and local_relpath = ?2
 
811
 
 
812
/* ------------------------------------------------------------------------- */
 
813
 
 
814
/* Format 31 adds the inherited_props column to the NODES table. C code then
 
815
   initializes the update/switch roots to make sure future updates fetch the
 
816
   inherited properties */
 
817
-- STMT_UPGRADE_TO_31_ALTER_TABLE
 
818
ALTER TABLE NODES ADD COLUMN inherited_props BLOB;
 
819
-- STMT_UPGRADE_TO_31_FINALIZE
 
820
DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST;
 
821
DROP INDEX IF EXISTS I_EXTERNALS_PARENT;
 
822
 
 
823
DROP INDEX I_NODES_PARENT;
 
824
CREATE UNIQUE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath,
 
825
                                             local_relpath, op_depth);
 
826
 
 
827
DROP INDEX I_ACTUAL_PARENT;
 
828
CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath,
 
829
                                                    local_relpath);
 
830
 
 
831
PRAGMA user_version = 31;
 
832
 
 
833
-- STMT_UPGRADE_31_SELECT_WCROOT_NODES
 
834
/* Select all base nodes which are the root of a WC, including
 
835
   switched subtrees, but excluding those which map to the root
 
836
   of the repos.
 
837
 
 
838
   ### IPROPS: Is this query horribly inefficient?  Quite likely,
 
839
   ### but it only runs during an upgrade, so do we care? */
 
840
SELECT l.wc_id, l.local_relpath FROM nodes as l
 
841
LEFT OUTER JOIN nodes as r
 
842
ON l.wc_id = r.wc_id
 
843
   AND r.local_relpath = l.parent_relpath
 
844
   AND r.op_depth = 0
 
845
WHERE l.op_depth = 0
 
846
  AND l.repos_path != ''
 
847
  AND ((l.repos_id IS NOT r.repos_id)
 
848
       OR (l.repos_path IS NOT RELPATH_SKIP_JOIN(r.local_relpath, r.repos_path, l.local_relpath)))
 
849
 
 
850
 
 
851
/* ------------------------------------------------------------------------- */
 
852
/* Format 32 ....  */
 
853
-- STMT_UPGRADE_TO_32
 
854
 
 
855
/* Drop old index. ### Remove this part from the upgrade to 31 once bumped */
 
856
DROP INDEX IF EXISTS I_ACTUAL_CHANGELIST;
 
857
DROP INDEX IF EXISTS I_EXTERNALS_PARENT;
 
858
CREATE INDEX I_EXTERNALS_PARENT ON EXTERNALS (wc_id, parent_relpath);
 
859
 
 
860
DROP INDEX I_NODES_PARENT;
 
861
CREATE UNIQUE INDEX I_NODES_PARENT ON NODES (wc_id, parent_relpath,
 
862
                                             local_relpath, op_depth);
 
863
 
 
864
DROP INDEX I_ACTUAL_PARENT;
 
865
CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath,
 
866
                                                    local_relpath);
 
867
 
 
868
/* ------------------------------------------------------------------------- */
 
869
 
754
870
/* Format YYY introduces new handling for conflict information.  */
755
871
-- format: YYY
756
872
 
763
879
   number will be, however, so we're just marking it as 99 for now.  */
764
880
-- format: 99
765
881
 
766
 
/* TODO: Rename the "absent" presence value to "server-excluded" before
767
 
   the 1.7 release. wc_db.c and this file have references to "absent" which
768
 
   still need to be changed to "server-excluded". */
 
882
/* TODO: Un-confuse *_revision column names in the EXTERNALS table to
 
883
   "-r<operative> foo@<peg>", as suggested by the patch attached to
 
884
   http://svn.haxx.se/dev/archive-2011-09/0478.shtml */
 
885
/* TODO: Remove column parent_relpath from EXTERNALS. We're not using it and
 
886
   never will. It's not interesting like in the NODES table: the external's
 
887
   parent path may be *anything*: unversioned, "behind" a another WC... */
769
888
 
770
889
/* Now "drop" the tree_conflict_data column from actual_node. */
771
890
CREATE TABLE ACTUAL_NODE_BACKUP (
803
922
  PRIMARY KEY (wc_id, local_relpath)
804
923
  );
805
924
 
806
 
CREATE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath);
807
 
CREATE INDEX I_ACTUAL_CHANGELIST ON ACTUAL_NODE (changelist);
 
925
CREATE UNIQUE INDEX I_ACTUAL_PARENT ON ACTUAL_NODE (wc_id, parent_relpath,
 
926
                                                    local_relpath);
808
927
 
809
928
INSERT INTO ACTUAL_NODE SELECT
810
929
  wc_id, local_relpath, parent_relpath, properties, conflict_old,