Fossil SCM

Schema changes that an mtime field to all configuration tables and make "title" a unique field on the reportfmt table. Only lightly tested.

drh 2011-04-26 01:33 UTC config-sync
Commit 2b4b3303b68e101ad9cc9e4caaa1ffcb61a298dd
4 files changed +88 -17 +40 -20 +15 -1 +1 -1
+88 -17
--- src/rebuild.c
+++ src/rebuild.c
@@ -22,13 +22,15 @@
2222
#include <assert.h>
2323
#include <dirent.h>
2424
#include <errno.h>
2525
2626
/*
27
-** Schema changes
27
+** Make changes to the stable part of the schema (the part that is not
28
+** simply deleted and reconstructed on a rebuild) to bring the schema
29
+** up to the latest.
2830
*/
29
-static const char zSchemaUpdates[] =
31
+static const char zSchemaUpdates1[] =
3032
@ -- Index on the delta table
3133
@ --
3234
@ CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);
3335
@
3436
@ -- Artifacts that should not be processed are identified in the
@@ -39,41 +41,110 @@
3941
@ --
4042
@ -- Shunned artifacts do not exist in the blob table. Hence they
4143
@ -- have not artifact ID (rid) and we thus must store their full
4244
@ -- UUID.
4345
@ --
44
-@ CREATE TABLE IF NOT EXISTS shun(uuid UNIQUE);
46
+@ CREATE TABLE IF NOT EXISTS shun(
47
+@ uuid UNIQUE, -- UUID of artifact to be shunned. Canonical form
48
+@ mtime INTEGER, -- When added. Seconds since 1970
49
+@ scom TEXT -- Optional text explaining why the shun occurred
50
+@ );
4551
@
4652
@ -- Artifacts that should not be pushed are stored in the "private"
4753
@ -- table.
4854
@ --
4955
@ CREATE TABLE IF NOT EXISTS private(rid INTEGER PRIMARY KEY);
5056
@
51
-@ -- An entry in this table describes a database query that generates a
52
-@ -- table of tickets.
53
-@ --
54
-@ CREATE TABLE IF NOT EXISTS reportfmt(
55
-@ rn integer primary key, -- Report number
56
-@ owner text, -- Owner of this report format (not used)
57
-@ title text, -- Title of this report
58
-@ cols text, -- A color-key specification
59
-@ sqlcode text -- An SQL SELECT statement for this report
60
-@ );
61
-@
6257
@ -- Some ticket content (such as the originators email address or contact
6358
@ -- information) needs to be obscured to protect privacy. This is achieved
6459
@ -- by storing an SHA1 hash of the content. For display, the hash is
6560
@ -- mapped back into the original text using this table.
6661
@ --
6762
@ -- This table contains sensitive information and should not be shared
6863
@ -- with unauthorized users.
6964
@ --
7065
@ CREATE TABLE IF NOT EXISTS concealed(
71
-@ hash TEXT PRIMARY KEY,
72
-@ content TEXT
66
+@ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
67
+@ mtime INTEGER, -- Time created. Seconds since 1970
68
+@ content TEXT -- Content intended to be concealed
69
+@ );
70
+;
71
+static const char zSchemaUpdates2[] =
72
+@ -- An entry in this table describes a database query that generates a
73
+@ -- table of tickets.
74
+@ --
75
+@ CREATE TABLE IF NOT EXISTS reportfmt(
76
+@ rn INTEGER PRIMARY KEY, -- Report number
77
+@ owner TEXT, -- Owner of this report format (not used)
78
+@ title TEXT UNIQUE, -- Title of this report
79
+@ mtime INTEGER, -- Time last modified. Seconds since 1970
80
+@ cols TEXT, -- A color-key specification
81
+@ sqlcode TEXT -- An SQL SELECT statement for this report
7382
@ );
7483
;
84
+
85
+static void rebuild_update_schema(void){
86
+ int rc;
87
+ sqlite3_stmt *pStmt;
88
+ db_multi_exec(zSchemaUpdates1);
89
+ db_multi_exec(zSchemaUpdates2);
90
+
91
+ rc = sqlite3_prepare(g.db, "SELECT mtime FROM user", -1, &pStmt, 0);
92
+ sqlite3_finalize(pStmt);
93
+ if( rc==SQLITE_ERROR ){
94
+ db_multi_exec(
95
+ "ALTER TABLE user ADD COLUMN mtime INTEGER;"
96
+ "UPDATE user SET mtime=(SELECT strftime('%%s','now'));"
97
+ );
98
+ }
99
+
100
+ rc = sqlite3_prepare(g.db, "SELECT mtime FROM config", -1, &pStmt, 0);
101
+ sqlite3_finalize(pStmt);
102
+ if( rc==SQLITE_ERROR ){
103
+ db_multi_exec(
104
+ "ALTER TABLE config ADD COLUMN mtime INTEGER;"
105
+ "UPDATE config SET mtime=(SELECT strftime('%%s','now'));"
106
+ );
107
+ }
108
+
109
+ rc = sqlite3_prepare(g.db, "SELECT mtime FROM shun", -1, &pStmt, 0);
110
+ sqlite3_finalize(pStmt);
111
+ if( rc==SQLITE_ERROR ){
112
+ db_multi_exec(
113
+ "ALTER TABLE shun ADD COLUMN mtime INTEGER;"
114
+ "ALTER TABLE shun ADD COLUMN scom TEXT;"
115
+ "UPDATE shun SET mtime=(SELECT strftime('%%s','now'));"
116
+ );
117
+ }
118
+
119
+ rc = sqlite3_prepare(g.db, "SELECT mtime FROM reportfmt", -1, &pStmt, 0);
120
+ sqlite3_finalize(pStmt);
121
+ if( rc==SQLITE_ERROR ){
122
+ db_multi_exec(
123
+ "CREATE TEMP TABLE old_fmt AS SELECT * FROM reportfmt;"
124
+ "DROP TABLE reportfmt;"
125
+ );
126
+ db_multi_exec(zSchemaUpdates2);
127
+ db_multi_exec(
128
+ "INSERT OR IGNORE INTO reportfmt(rn,owner,title,cols,sqlcode,mtime)"
129
+ " SELECT rn, owner, title, cols, sqlcode,"
130
+ " (SELECT strftime('%%s','now')+0) FROM old_fmt;"
131
+ "INSERT OR IGNORE INTO reportfmt(rn,owner,title,cols,sqlcode,mtime)"
132
+ " SELECT rn, owner, title || ' (' || rn || ')', cols, sqlcode,"
133
+ " (SELECT strftime('%%s','now')+0) FROM old_fmt;"
134
+ );
135
+ }
136
+
137
+ rc = sqlite3_prepare(g.db, "SELECT mtime FROM concealed", -1, &pStmt, 0);
138
+ sqlite3_finalize(pStmt);
139
+ if( rc==SQLITE_ERROR ){
140
+ db_multi_exec(
141
+ "ALTER TABLE concealed ADD COLUMN mtime INTEGER;"
142
+ "UPDATE concealed SET mtime=(SELECT strftime('%%s','now'));"
143
+ );
144
+ }
145
+}
75146
76147
/*
77148
** Variables used to store state information about an on-going "rebuild"
78149
** or "deconstruct".
79150
*/
@@ -256,11 +327,11 @@
256327
ttyOutput = doOut;
257328
processCnt = 0;
258329
if (!g.fQuiet) {
259330
percent_complete(0);
260331
}
261
- db_multi_exec(zSchemaUpdates);
332
+ rebuild_update_schema();
262333
for(;;){
263334
zTable = db_text(0,
264335
"SELECT name FROM sqlite_master /*scan*/"
265336
" WHERE type='table'"
266337
" AND name NOT IN ('blob','delta','rcvfrom','user',"
267338
--- src/rebuild.c
+++ src/rebuild.c
@@ -22,13 +22,15 @@
22 #include <assert.h>
23 #include <dirent.h>
24 #include <errno.h>
25
26 /*
27 ** Schema changes
 
 
28 */
29 static const char zSchemaUpdates[] =
30 @ -- Index on the delta table
31 @ --
32 @ CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);
33 @
34 @ -- Artifacts that should not be processed are identified in the
@@ -39,41 +41,110 @@
39 @ --
40 @ -- Shunned artifacts do not exist in the blob table. Hence they
41 @ -- have not artifact ID (rid) and we thus must store their full
42 @ -- UUID.
43 @ --
44 @ CREATE TABLE IF NOT EXISTS shun(uuid UNIQUE);
 
 
 
 
45 @
46 @ -- Artifacts that should not be pushed are stored in the "private"
47 @ -- table.
48 @ --
49 @ CREATE TABLE IF NOT EXISTS private(rid INTEGER PRIMARY KEY);
50 @
51 @ -- An entry in this table describes a database query that generates a
52 @ -- table of tickets.
53 @ --
54 @ CREATE TABLE IF NOT EXISTS reportfmt(
55 @ rn integer primary key, -- Report number
56 @ owner text, -- Owner of this report format (not used)
57 @ title text, -- Title of this report
58 @ cols text, -- A color-key specification
59 @ sqlcode text -- An SQL SELECT statement for this report
60 @ );
61 @
62 @ -- Some ticket content (such as the originators email address or contact
63 @ -- information) needs to be obscured to protect privacy. This is achieved
64 @ -- by storing an SHA1 hash of the content. For display, the hash is
65 @ -- mapped back into the original text using this table.
66 @ --
67 @ -- This table contains sensitive information and should not be shared
68 @ -- with unauthorized users.
69 @ --
70 @ CREATE TABLE IF NOT EXISTS concealed(
71 @ hash TEXT PRIMARY KEY,
72 @ content TEXT
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73 @ );
74 ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
76 /*
77 ** Variables used to store state information about an on-going "rebuild"
78 ** or "deconstruct".
79 */
@@ -256,11 +327,11 @@
256 ttyOutput = doOut;
257 processCnt = 0;
258 if (!g.fQuiet) {
259 percent_complete(0);
260 }
261 db_multi_exec(zSchemaUpdates);
262 for(;;){
263 zTable = db_text(0,
264 "SELECT name FROM sqlite_master /*scan*/"
265 " WHERE type='table'"
266 " AND name NOT IN ('blob','delta','rcvfrom','user',"
267
--- src/rebuild.c
+++ src/rebuild.c
@@ -22,13 +22,15 @@
22 #include <assert.h>
23 #include <dirent.h>
24 #include <errno.h>
25
26 /*
27 ** Make changes to the stable part of the schema (the part that is not
28 ** simply deleted and reconstructed on a rebuild) to bring the schema
29 ** up to the latest.
30 */
31 static const char zSchemaUpdates1[] =
32 @ -- Index on the delta table
33 @ --
34 @ CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);
35 @
36 @ -- Artifacts that should not be processed are identified in the
@@ -39,41 +41,110 @@
41 @ --
42 @ -- Shunned artifacts do not exist in the blob table. Hence they
43 @ -- have not artifact ID (rid) and we thus must store their full
44 @ -- UUID.
45 @ --
46 @ CREATE TABLE IF NOT EXISTS shun(
47 @ uuid UNIQUE, -- UUID of artifact to be shunned. Canonical form
48 @ mtime INTEGER, -- When added. Seconds since 1970
49 @ scom TEXT -- Optional text explaining why the shun occurred
50 @ );
51 @
52 @ -- Artifacts that should not be pushed are stored in the "private"
53 @ -- table.
54 @ --
55 @ CREATE TABLE IF NOT EXISTS private(rid INTEGER PRIMARY KEY);
56 @
 
 
 
 
 
 
 
 
 
 
 
57 @ -- Some ticket content (such as the originators email address or contact
58 @ -- information) needs to be obscured to protect privacy. This is achieved
59 @ -- by storing an SHA1 hash of the content. For display, the hash is
60 @ -- mapped back into the original text using this table.
61 @ --
62 @ -- This table contains sensitive information and should not be shared
63 @ -- with unauthorized users.
64 @ --
65 @ CREATE TABLE IF NOT EXISTS concealed(
66 @ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
67 @ mtime INTEGER, -- Time created. Seconds since 1970
68 @ content TEXT -- Content intended to be concealed
69 @ );
70 ;
71 static const char zSchemaUpdates2[] =
72 @ -- An entry in this table describes a database query that generates a
73 @ -- table of tickets.
74 @ --
75 @ CREATE TABLE IF NOT EXISTS reportfmt(
76 @ rn INTEGER PRIMARY KEY, -- Report number
77 @ owner TEXT, -- Owner of this report format (not used)
78 @ title TEXT UNIQUE, -- Title of this report
79 @ mtime INTEGER, -- Time last modified. Seconds since 1970
80 @ cols TEXT, -- A color-key specification
81 @ sqlcode TEXT -- An SQL SELECT statement for this report
82 @ );
83 ;
84
85 static void rebuild_update_schema(void){
86 int rc;
87 sqlite3_stmt *pStmt;
88 db_multi_exec(zSchemaUpdates1);
89 db_multi_exec(zSchemaUpdates2);
90
91 rc = sqlite3_prepare(g.db, "SELECT mtime FROM user", -1, &pStmt, 0);
92 sqlite3_finalize(pStmt);
93 if( rc==SQLITE_ERROR ){
94 db_multi_exec(
95 "ALTER TABLE user ADD COLUMN mtime INTEGER;"
96 "UPDATE user SET mtime=(SELECT strftime('%%s','now'));"
97 );
98 }
99
100 rc = sqlite3_prepare(g.db, "SELECT mtime FROM config", -1, &pStmt, 0);
101 sqlite3_finalize(pStmt);
102 if( rc==SQLITE_ERROR ){
103 db_multi_exec(
104 "ALTER TABLE config ADD COLUMN mtime INTEGER;"
105 "UPDATE config SET mtime=(SELECT strftime('%%s','now'));"
106 );
107 }
108
109 rc = sqlite3_prepare(g.db, "SELECT mtime FROM shun", -1, &pStmt, 0);
110 sqlite3_finalize(pStmt);
111 if( rc==SQLITE_ERROR ){
112 db_multi_exec(
113 "ALTER TABLE shun ADD COLUMN mtime INTEGER;"
114 "ALTER TABLE shun ADD COLUMN scom TEXT;"
115 "UPDATE shun SET mtime=(SELECT strftime('%%s','now'));"
116 );
117 }
118
119 rc = sqlite3_prepare(g.db, "SELECT mtime FROM reportfmt", -1, &pStmt, 0);
120 sqlite3_finalize(pStmt);
121 if( rc==SQLITE_ERROR ){
122 db_multi_exec(
123 "CREATE TEMP TABLE old_fmt AS SELECT * FROM reportfmt;"
124 "DROP TABLE reportfmt;"
125 );
126 db_multi_exec(zSchemaUpdates2);
127 db_multi_exec(
128 "INSERT OR IGNORE INTO reportfmt(rn,owner,title,cols,sqlcode,mtime)"
129 " SELECT rn, owner, title, cols, sqlcode,"
130 " (SELECT strftime('%%s','now')+0) FROM old_fmt;"
131 "INSERT OR IGNORE INTO reportfmt(rn,owner,title,cols,sqlcode,mtime)"
132 " SELECT rn, owner, title || ' (' || rn || ')', cols, sqlcode,"
133 " (SELECT strftime('%%s','now')+0) FROM old_fmt;"
134 );
135 }
136
137 rc = sqlite3_prepare(g.db, "SELECT mtime FROM concealed", -1, &pStmt, 0);
138 sqlite3_finalize(pStmt);
139 if( rc==SQLITE_ERROR ){
140 db_multi_exec(
141 "ALTER TABLE concealed ADD COLUMN mtime INTEGER;"
142 "UPDATE concealed SET mtime=(SELECT strftime('%%s','now'));"
143 );
144 }
145 }
146
147 /*
148 ** Variables used to store state information about an on-going "rebuild"
149 ** or "deconstruct".
150 */
@@ -256,11 +327,11 @@
327 ttyOutput = doOut;
328 processCnt = 0;
329 if (!g.fQuiet) {
330 percent_complete(0);
331 }
332 rebuild_update_schema();
333 for(;;){
334 zTable = db_text(0,
335 "SELECT name FROM sqlite_master /*scan*/"
336 " WHERE type='table'"
337 " AND name NOT IN ('blob','delta','rcvfrom','user',"
338
+40 -20
--- src/schema.c
+++ src/schema.c
@@ -39,12 +39,12 @@
3939
** changes. The aux tables have an arbitrary version number (typically
4040
** a date) which can change frequently. When the content schema changes,
4141
** we have to execute special procedures to update the schema. When
4242
** the aux schema changes, all we need to do is rebuild the database.
4343
*/
44
-#define CONTENT_SCHEMA "1"
45
-#define AUX_SCHEMA "2011-02-25 14:52"
44
+#define CONTENT_SCHEMA "2"
45
+#define AUX_SCHEMA "2011-04-25 19:50"
4646
4747
#endif /* INTERFACE */
4848
4949
5050
/*
@@ -51,21 +51,25 @@
5151
** The schema for a repository database.
5252
**
5353
** Schema1[] contains parts of the schema that are fixed and unchanging
5454
** across versions. Schema2[] contains parts of the schema that can
5555
** change from one version to the next. The information in Schema2[]
56
-** can be reconstructed from the information in Schema1[].
56
+** is reconstructed from the information in Schema1[] by the "rebuild"
57
+** operation.
5758
*/
5859
const char zRepositorySchema1[] =
5960
@ -- The BLOB and DELTA tables contain all records held in the repository.
6061
@ --
61
-@ -- The BLOB.CONTENT column is always compressed using libz. This
62
+@ -- The BLOB.CONTENT column is always compressed using zlib. This
6263
@ -- column might hold the full text of the record or it might hold
6364
@ -- a delta that is able to reconstruct the record from some other
6465
@ -- record. If BLOB.CONTENT holds a delta, then a DELTA table entry
6566
@ -- will exist for the record and that entry will point to another
6667
@ -- entry that holds the source of the delta. Deltas can be chained.
68
+@ --
69
+@ -- The blob and delta tables collectively hold the "global state" of
70
+@ -- a Fossil repository.
6771
@ --
6872
@ CREATE TABLE blob(
6973
@ rid INTEGER PRIMARY KEY, -- Record ID
7074
@ rcvid INTEGER, -- Origin of this record
7175
@ size INTEGER, -- Size of content. -1 for a phantom.
@@ -77,17 +81,24 @@
7781
@ rid INTEGER PRIMARY KEY, -- Record ID
7882
@ srcid INTEGER NOT NULL REFERENCES blob -- Record holding source document
7983
@ );
8084
@ CREATE INDEX delta_i1 ON delta(srcid);
8185
@
86
+@ -------------------------------------------------------------------------
87
+@ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
88
+@ -- project; the stuff that is normally exchanged during "sync". The
89
+@ -- "local state" of a repository is contained in the remaining tables of
90
+@ -- the zRepositorySchema1 string.
91
+@ -------------------------------------------------------------------------
92
+@
8293
@ -- Whenever new blobs are received into the repository, an entry
8394
@ -- in this table records the source of the blob.
8495
@ --
8596
@ CREATE TABLE rcvfrom(
8697
@ rcvid INTEGER PRIMARY KEY, -- Received-From ID
8798
@ uid INTEGER REFERENCES user, -- User login
88
-@ mtime DATETIME, -- Time or receipt
99
+@ mtime DATETIME, -- Time of receipt. Julian day.
89100
@ nonce TEXT UNIQUE, -- Nonce used for login
90101
@ ipaddr TEXT -- Remote IP address. NULL for direct.
91102
@ );
92103
@
93104
@ -- Information about users
@@ -106,19 +117,21 @@
106117
@ cap TEXT, -- Capabilities of this user
107118
@ cookie TEXT, -- WWW login cookie
108119
@ ipaddr TEXT, -- IP address for which cookie is valid
109120
@ cexpire DATETIME, -- Time when cookie expires
110121
@ info TEXT, -- contact information
122
+@ mtime DATE, -- last change. seconds since 1970
111123
@ photo BLOB -- JPEG image of this user
112124
@ );
113125
@
114126
@ -- The VAR table holds miscellanous information about the repository.
115127
@ -- in the form of name-value pairs.
116128
@ --
117129
@ CREATE TABLE config(
118130
@ name TEXT PRIMARY KEY NOT NULL, -- Primary name of the entry
119131
@ value CLOB, -- Content of the named parameter
132
+@ mtime DATE, -- last modified. seconds since 1970
120133
@ CHECK( typeof(name)='text' AND length(name)>=1 )
121134
@ );
122135
@
123136
@ -- Artifacts that should not be processed are identified in the
124137
@ -- "shun" table. Artifacts that are control-file forgeries or
@@ -128,11 +141,15 @@
128141
@ --
129142
@ -- Shunned artifacts do not exist in the blob table. Hence they
130143
@ -- have not artifact ID (rid) and we thus must store their full
131144
@ -- UUID.
132145
@ --
133
-@ CREATE TABLE shun(uuid UNIQUE);
146
+@ CREATE TABLE shun(
147
+@ uuid UNIQUE, -- UUID of artifact to be shunned. Canonical form
148
+@ mtime DATE, -- When added. seconds since 1970
149
+@ scom TEXT -- Optional text explaining why the shun occurred
150
+@ );
134151
@
135152
@ -- Artifacts that should not be pushed are stored in the "private"
136153
@ -- table. Private artifacts are omitted from the "unclustered" and
137154
@ -- "unsent" tables.
138155
@ --
@@ -140,17 +157,19 @@
140157
@
141158
@ -- An entry in this table describes a database query that generates a
142159
@ -- table of tickets.
143160
@ --
144161
@ CREATE TABLE reportfmt(
145
-@ rn integer primary key, -- Report number
146
-@ owner text, -- Owner of this report format (not used)
147
-@ title text, -- Title of this report
148
-@ cols text, -- A color-key specification
149
-@ sqlcode text -- An SQL SELECT statement for this report
162
+@ rn INTEGER PRIMARY KEY, -- Report number
163
+@ owner TEXT, -- Owner of this report format (not used)
164
+@ title TEXT UNIQUE, -- Title of this report
165
+@ mtime DATE, -- Last modified. seconds since 1970
166
+@ cols TEXT, -- A color-key specification
167
+@ sqlcode TEXT -- An SQL SELECT statement for this report
150168
@ );
151
-@ INSERT INTO reportfmt(title,cols,sqlcode) VALUES('All Tickets','#ffffff Key:
169
+@ INSERT INTO reportfmt(title,mtime,cols,sqlcode)
170
+@ VALUES('All Tickets',julianday('1970-01-01'),'#ffffff Key:
152171
@ #f2dcdc Active
153172
@ #e8e8e8 Review
154173
@ #cfe8bd Fixed
155174
@ #bde5d6 Tested
156175
@ #cacae5 Deferred
@@ -176,12 +195,13 @@
176195
@ --
177196
@ -- This table contains sensitive information and should not be shared
178197
@ -- with unauthorized users.
179198
@ --
180199
@ CREATE TABLE concealed(
181
-@ hash TEXT PRIMARY KEY,
182
-@ content TEXT
200
+@ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
201
+@ mtime DATE, -- Time created. Seconds since 1970
202
+@ content TEXT -- Content intended to be concealed
183203
@ );
184204
;
185205
186206
const char zRepositorySchema2[] =
187207
@ -- Filenames
@@ -214,11 +234,11 @@
214234
@ --
215235
@ CREATE TABLE plink(
216236
@ pid INTEGER REFERENCES blob, -- Parent manifest
217237
@ cid INTEGER REFERENCES blob, -- Child manifest
218238
@ isprim BOOLEAN, -- pid is the primary parent of cid
219
-@ mtime DATETIME, -- the date/time stamp on cid
239
+@ mtime DATETIME, -- the date/time stamp on cid. Julian day.
220240
@ UNIQUE(pid, cid)
221241
@ );
222242
@ CREATE INDEX plink_i2 ON plink(cid,pid);
223243
@
224244
@ -- A "leaf" checkin is a checkin that has no children in the same
@@ -232,11 +252,11 @@
232252
@
233253
@ -- Events used to generate a timeline
234254
@ --
235255
@ CREATE TABLE event(
236256
@ type TEXT, -- Type of event: 'ci', 'w', 'e', 't'
237
-@ mtime DATETIME, -- Date and time when the event occurs
257
+@ mtime DATETIME, -- Time of occurrence. Julian day.
238258
@ objid INTEGER PRIMARY KEY, -- Associated record ID
239259
@ tagid INTEGER, -- Associated ticket or wiki name tag
240260
@ uid INTEGER REFERENCES user, -- User who caused the event
241261
@ bgcolor TEXT, -- Color set by 'bgcolor' property
242262
@ euser TEXT, -- User set by 'user' property
@@ -319,11 +339,11 @@
319339
@ tagid INTEGER REFERENCES tag, -- The tag that added or removed
320340
@ tagtype INTEGER, -- 0:-,cancel 1:+,single 2:*,propagate
321341
@ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
322342
@ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
323343
@ value TEXT, -- Value of the tag. Might be NULL.
324
-@ mtime TIMESTAMP, -- Time of addition or removal
344
+@ mtime TIMESTAMP, -- Time of addition or removal. Julian day
325345
@ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
326346
@ UNIQUE(rid, tagid)
327347
@ );
328348
@ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
329349
@
@@ -334,11 +354,11 @@
334354
@ --
335355
@ CREATE TABLE backlink(
336356
@ target TEXT, -- Where the hyperlink points to
337357
@ srctype INT, -- 0: check-in 1: ticket 2: wiki
338358
@ srcid INT, -- rid for checkin or wiki. tkt_id for ticket.
339
-@ mtime TIMESTAMP, -- time that the hyperlink was added
359
+@ mtime TIMESTAMP, -- time that the hyperlink was added. Julian day.
340360
@ UNIQUE(target, srctype, srcid)
341361
@ );
342362
@ CREATE INDEX backlink_src ON backlink(srcid, srctype);
343363
@
344364
@ -- Each attachment is an entry in the following table. Only
@@ -345,11 +365,11 @@
345365
@ -- the most recent attachment (identified by the D card) is saved.
346366
@ --
347367
@ CREATE TABLE attachment(
348368
@ attachid INTEGER PRIMARY KEY, -- Local id for this attachment
349369
@ isLatest BOOLEAN DEFAULT 0, -- True if this is the one to use
350
-@ mtime TIMESTAMP, -- Time when attachment last changed
370
+@ mtime TIMESTAMP, -- Last changed. Julian day.
351371
@ src TEXT, -- UUID of the attachment. NULL to delete
352372
@ target TEXT, -- Object attached to. Wikiname or Tkt UUID
353373
@ filename TEXT, -- Filename for the attachment
354374
@ comment TEXT, -- Comment associated with this attachment
355375
@ user TEXT -- Name of user adding attachment
@@ -443,11 +463,11 @@
443463
@ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add
444464
@ deleted BOOLEAN DEFAULT 0, -- True if deleted
445465
@ isexe BOOLEAN, -- True if file should be executable
446466
@ rid INTEGER, -- Originally from this repository record
447467
@ mrid INTEGER, -- Based on this record due to a merge
448
-@ mtime INTEGER, -- Modification time of file on disk
468
+@ mtime INTEGER, -- Mtime of file on disk. sec since 1970
449469
@ pathname TEXT, -- Full pathname relative to root
450470
@ origname TEXT, -- Original pathname. NULL if unchanged
451471
@ UNIQUE(pathname,vid)
452472
@ );
453473
@
454474
--- src/schema.c
+++ src/schema.c
@@ -39,12 +39,12 @@
39 ** changes. The aux tables have an arbitrary version number (typically
40 ** a date) which can change frequently. When the content schema changes,
41 ** we have to execute special procedures to update the schema. When
42 ** the aux schema changes, all we need to do is rebuild the database.
43 */
44 #define CONTENT_SCHEMA "1"
45 #define AUX_SCHEMA "2011-02-25 14:52"
46
47 #endif /* INTERFACE */
48
49
50 /*
@@ -51,21 +51,25 @@
51 ** The schema for a repository database.
52 **
53 ** Schema1[] contains parts of the schema that are fixed and unchanging
54 ** across versions. Schema2[] contains parts of the schema that can
55 ** change from one version to the next. The information in Schema2[]
56 ** can be reconstructed from the information in Schema1[].
 
57 */
58 const char zRepositorySchema1[] =
59 @ -- The BLOB and DELTA tables contain all records held in the repository.
60 @ --
61 @ -- The BLOB.CONTENT column is always compressed using libz. This
62 @ -- column might hold the full text of the record or it might hold
63 @ -- a delta that is able to reconstruct the record from some other
64 @ -- record. If BLOB.CONTENT holds a delta, then a DELTA table entry
65 @ -- will exist for the record and that entry will point to another
66 @ -- entry that holds the source of the delta. Deltas can be chained.
 
 
 
67 @ --
68 @ CREATE TABLE blob(
69 @ rid INTEGER PRIMARY KEY, -- Record ID
70 @ rcvid INTEGER, -- Origin of this record
71 @ size INTEGER, -- Size of content. -1 for a phantom.
@@ -77,17 +81,24 @@
77 @ rid INTEGER PRIMARY KEY, -- Record ID
78 @ srcid INTEGER NOT NULL REFERENCES blob -- Record holding source document
79 @ );
80 @ CREATE INDEX delta_i1 ON delta(srcid);
81 @
 
 
 
 
 
 
 
82 @ -- Whenever new blobs are received into the repository, an entry
83 @ -- in this table records the source of the blob.
84 @ --
85 @ CREATE TABLE rcvfrom(
86 @ rcvid INTEGER PRIMARY KEY, -- Received-From ID
87 @ uid INTEGER REFERENCES user, -- User login
88 @ mtime DATETIME, -- Time or receipt
89 @ nonce TEXT UNIQUE, -- Nonce used for login
90 @ ipaddr TEXT -- Remote IP address. NULL for direct.
91 @ );
92 @
93 @ -- Information about users
@@ -106,19 +117,21 @@
106 @ cap TEXT, -- Capabilities of this user
107 @ cookie TEXT, -- WWW login cookie
108 @ ipaddr TEXT, -- IP address for which cookie is valid
109 @ cexpire DATETIME, -- Time when cookie expires
110 @ info TEXT, -- contact information
 
111 @ photo BLOB -- JPEG image of this user
112 @ );
113 @
114 @ -- The VAR table holds miscellanous information about the repository.
115 @ -- in the form of name-value pairs.
116 @ --
117 @ CREATE TABLE config(
118 @ name TEXT PRIMARY KEY NOT NULL, -- Primary name of the entry
119 @ value CLOB, -- Content of the named parameter
 
120 @ CHECK( typeof(name)='text' AND length(name)>=1 )
121 @ );
122 @
123 @ -- Artifacts that should not be processed are identified in the
124 @ -- "shun" table. Artifacts that are control-file forgeries or
@@ -128,11 +141,15 @@
128 @ --
129 @ -- Shunned artifacts do not exist in the blob table. Hence they
130 @ -- have not artifact ID (rid) and we thus must store their full
131 @ -- UUID.
132 @ --
133 @ CREATE TABLE shun(uuid UNIQUE);
 
 
 
 
134 @
135 @ -- Artifacts that should not be pushed are stored in the "private"
136 @ -- table. Private artifacts are omitted from the "unclustered" and
137 @ -- "unsent" tables.
138 @ --
@@ -140,17 +157,19 @@
140 @
141 @ -- An entry in this table describes a database query that generates a
142 @ -- table of tickets.
143 @ --
144 @ CREATE TABLE reportfmt(
145 @ rn integer primary key, -- Report number
146 @ owner text, -- Owner of this report format (not used)
147 @ title text, -- Title of this report
148 @ cols text, -- A color-key specification
149 @ sqlcode text -- An SQL SELECT statement for this report
 
150 @ );
151 @ INSERT INTO reportfmt(title,cols,sqlcode) VALUES('All Tickets','#ffffff Key:
 
152 @ #f2dcdc Active
153 @ #e8e8e8 Review
154 @ #cfe8bd Fixed
155 @ #bde5d6 Tested
156 @ #cacae5 Deferred
@@ -176,12 +195,13 @@
176 @ --
177 @ -- This table contains sensitive information and should not be shared
178 @ -- with unauthorized users.
179 @ --
180 @ CREATE TABLE concealed(
181 @ hash TEXT PRIMARY KEY,
182 @ content TEXT
 
183 @ );
184 ;
185
186 const char zRepositorySchema2[] =
187 @ -- Filenames
@@ -214,11 +234,11 @@
214 @ --
215 @ CREATE TABLE plink(
216 @ pid INTEGER REFERENCES blob, -- Parent manifest
217 @ cid INTEGER REFERENCES blob, -- Child manifest
218 @ isprim BOOLEAN, -- pid is the primary parent of cid
219 @ mtime DATETIME, -- the date/time stamp on cid
220 @ UNIQUE(pid, cid)
221 @ );
222 @ CREATE INDEX plink_i2 ON plink(cid,pid);
223 @
224 @ -- A "leaf" checkin is a checkin that has no children in the same
@@ -232,11 +252,11 @@
232 @
233 @ -- Events used to generate a timeline
234 @ --
235 @ CREATE TABLE event(
236 @ type TEXT, -- Type of event: 'ci', 'w', 'e', 't'
237 @ mtime DATETIME, -- Date and time when the event occurs
238 @ objid INTEGER PRIMARY KEY, -- Associated record ID
239 @ tagid INTEGER, -- Associated ticket or wiki name tag
240 @ uid INTEGER REFERENCES user, -- User who caused the event
241 @ bgcolor TEXT, -- Color set by 'bgcolor' property
242 @ euser TEXT, -- User set by 'user' property
@@ -319,11 +339,11 @@
319 @ tagid INTEGER REFERENCES tag, -- The tag that added or removed
320 @ tagtype INTEGER, -- 0:-,cancel 1:+,single 2:*,propagate
321 @ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
322 @ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
323 @ value TEXT, -- Value of the tag. Might be NULL.
324 @ mtime TIMESTAMP, -- Time of addition or removal
325 @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
326 @ UNIQUE(rid, tagid)
327 @ );
328 @ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
329 @
@@ -334,11 +354,11 @@
334 @ --
335 @ CREATE TABLE backlink(
336 @ target TEXT, -- Where the hyperlink points to
337 @ srctype INT, -- 0: check-in 1: ticket 2: wiki
338 @ srcid INT, -- rid for checkin or wiki. tkt_id for ticket.
339 @ mtime TIMESTAMP, -- time that the hyperlink was added
340 @ UNIQUE(target, srctype, srcid)
341 @ );
342 @ CREATE INDEX backlink_src ON backlink(srcid, srctype);
343 @
344 @ -- Each attachment is an entry in the following table. Only
@@ -345,11 +365,11 @@
345 @ -- the most recent attachment (identified by the D card) is saved.
346 @ --
347 @ CREATE TABLE attachment(
348 @ attachid INTEGER PRIMARY KEY, -- Local id for this attachment
349 @ isLatest BOOLEAN DEFAULT 0, -- True if this is the one to use
350 @ mtime TIMESTAMP, -- Time when attachment last changed
351 @ src TEXT, -- UUID of the attachment. NULL to delete
352 @ target TEXT, -- Object attached to. Wikiname or Tkt UUID
353 @ filename TEXT, -- Filename for the attachment
354 @ comment TEXT, -- Comment associated with this attachment
355 @ user TEXT -- Name of user adding attachment
@@ -443,11 +463,11 @@
443 @ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add
444 @ deleted BOOLEAN DEFAULT 0, -- True if deleted
445 @ isexe BOOLEAN, -- True if file should be executable
446 @ rid INTEGER, -- Originally from this repository record
447 @ mrid INTEGER, -- Based on this record due to a merge
448 @ mtime INTEGER, -- Modification time of file on disk
449 @ pathname TEXT, -- Full pathname relative to root
450 @ origname TEXT, -- Original pathname. NULL if unchanged
451 @ UNIQUE(pathname,vid)
452 @ );
453 @
454
--- src/schema.c
+++ src/schema.c
@@ -39,12 +39,12 @@
39 ** changes. The aux tables have an arbitrary version number (typically
40 ** a date) which can change frequently. When the content schema changes,
41 ** we have to execute special procedures to update the schema. When
42 ** the aux schema changes, all we need to do is rebuild the database.
43 */
44 #define CONTENT_SCHEMA "2"
45 #define AUX_SCHEMA "2011-04-25 19:50"
46
47 #endif /* INTERFACE */
48
49
50 /*
@@ -51,21 +51,25 @@
51 ** The schema for a repository database.
52 **
53 ** Schema1[] contains parts of the schema that are fixed and unchanging
54 ** across versions. Schema2[] contains parts of the schema that can
55 ** change from one version to the next. The information in Schema2[]
56 ** is reconstructed from the information in Schema1[] by the "rebuild"
57 ** operation.
58 */
59 const char zRepositorySchema1[] =
60 @ -- The BLOB and DELTA tables contain all records held in the repository.
61 @ --
62 @ -- The BLOB.CONTENT column is always compressed using zlib. This
63 @ -- column might hold the full text of the record or it might hold
64 @ -- a delta that is able to reconstruct the record from some other
65 @ -- record. If BLOB.CONTENT holds a delta, then a DELTA table entry
66 @ -- will exist for the record and that entry will point to another
67 @ -- entry that holds the source of the delta. Deltas can be chained.
68 @ --
69 @ -- The blob and delta tables collectively hold the "global state" of
70 @ -- a Fossil repository.
71 @ --
72 @ CREATE TABLE blob(
73 @ rid INTEGER PRIMARY KEY, -- Record ID
74 @ rcvid INTEGER, -- Origin of this record
75 @ size INTEGER, -- Size of content. -1 for a phantom.
@@ -77,17 +81,24 @@
81 @ rid INTEGER PRIMARY KEY, -- Record ID
82 @ srcid INTEGER NOT NULL REFERENCES blob -- Record holding source document
83 @ );
84 @ CREATE INDEX delta_i1 ON delta(srcid);
85 @
86 @ -------------------------------------------------------------------------
87 @ -- The BLOB and DELTA tables above hold the "global state" of a Fossil
88 @ -- project; the stuff that is normally exchanged during "sync". The
89 @ -- "local state" of a repository is contained in the remaining tables of
90 @ -- the zRepositorySchema1 string.
91 @ -------------------------------------------------------------------------
92 @
93 @ -- Whenever new blobs are received into the repository, an entry
94 @ -- in this table records the source of the blob.
95 @ --
96 @ CREATE TABLE rcvfrom(
97 @ rcvid INTEGER PRIMARY KEY, -- Received-From ID
98 @ uid INTEGER REFERENCES user, -- User login
99 @ mtime DATETIME, -- Time of receipt. Julian day.
100 @ nonce TEXT UNIQUE, -- Nonce used for login
101 @ ipaddr TEXT -- Remote IP address. NULL for direct.
102 @ );
103 @
104 @ -- Information about users
@@ -106,19 +117,21 @@
117 @ cap TEXT, -- Capabilities of this user
118 @ cookie TEXT, -- WWW login cookie
119 @ ipaddr TEXT, -- IP address for which cookie is valid
120 @ cexpire DATETIME, -- Time when cookie expires
121 @ info TEXT, -- contact information
122 @ mtime DATE, -- last change. seconds since 1970
123 @ photo BLOB -- JPEG image of this user
124 @ );
125 @
126 @ -- The VAR table holds miscellanous information about the repository.
127 @ -- in the form of name-value pairs.
128 @ --
129 @ CREATE TABLE config(
130 @ name TEXT PRIMARY KEY NOT NULL, -- Primary name of the entry
131 @ value CLOB, -- Content of the named parameter
132 @ mtime DATE, -- last modified. seconds since 1970
133 @ CHECK( typeof(name)='text' AND length(name)>=1 )
134 @ );
135 @
136 @ -- Artifacts that should not be processed are identified in the
137 @ -- "shun" table. Artifacts that are control-file forgeries or
@@ -128,11 +141,15 @@
141 @ --
142 @ -- Shunned artifacts do not exist in the blob table. Hence they
143 @ -- have not artifact ID (rid) and we thus must store their full
144 @ -- UUID.
145 @ --
146 @ CREATE TABLE shun(
147 @ uuid UNIQUE, -- UUID of artifact to be shunned. Canonical form
148 @ mtime DATE, -- When added. seconds since 1970
149 @ scom TEXT -- Optional text explaining why the shun occurred
150 @ );
151 @
152 @ -- Artifacts that should not be pushed are stored in the "private"
153 @ -- table. Private artifacts are omitted from the "unclustered" and
154 @ -- "unsent" tables.
155 @ --
@@ -140,17 +157,19 @@
157 @
158 @ -- An entry in this table describes a database query that generates a
159 @ -- table of tickets.
160 @ --
161 @ CREATE TABLE reportfmt(
162 @ rn INTEGER PRIMARY KEY, -- Report number
163 @ owner TEXT, -- Owner of this report format (not used)
164 @ title TEXT UNIQUE, -- Title of this report
165 @ mtime DATE, -- Last modified. seconds since 1970
166 @ cols TEXT, -- A color-key specification
167 @ sqlcode TEXT -- An SQL SELECT statement for this report
168 @ );
169 @ INSERT INTO reportfmt(title,mtime,cols,sqlcode)
170 @ VALUES('All Tickets',julianday('1970-01-01'),'#ffffff Key:
171 @ #f2dcdc Active
172 @ #e8e8e8 Review
173 @ #cfe8bd Fixed
174 @ #bde5d6 Tested
175 @ #cacae5 Deferred
@@ -176,12 +195,13 @@
195 @ --
196 @ -- This table contains sensitive information and should not be shared
197 @ -- with unauthorized users.
198 @ --
199 @ CREATE TABLE concealed(
200 @ hash TEXT PRIMARY KEY, -- The SHA1 hash of content
201 @ mtime DATE, -- Time created. Seconds since 1970
202 @ content TEXT -- Content intended to be concealed
203 @ );
204 ;
205
206 const char zRepositorySchema2[] =
207 @ -- Filenames
@@ -214,11 +234,11 @@
234 @ --
235 @ CREATE TABLE plink(
236 @ pid INTEGER REFERENCES blob, -- Parent manifest
237 @ cid INTEGER REFERENCES blob, -- Child manifest
238 @ isprim BOOLEAN, -- pid is the primary parent of cid
239 @ mtime DATETIME, -- the date/time stamp on cid. Julian day.
240 @ UNIQUE(pid, cid)
241 @ );
242 @ CREATE INDEX plink_i2 ON plink(cid,pid);
243 @
244 @ -- A "leaf" checkin is a checkin that has no children in the same
@@ -232,11 +252,11 @@
252 @
253 @ -- Events used to generate a timeline
254 @ --
255 @ CREATE TABLE event(
256 @ type TEXT, -- Type of event: 'ci', 'w', 'e', 't'
257 @ mtime DATETIME, -- Time of occurrence. Julian day.
258 @ objid INTEGER PRIMARY KEY, -- Associated record ID
259 @ tagid INTEGER, -- Associated ticket or wiki name tag
260 @ uid INTEGER REFERENCES user, -- User who caused the event
261 @ bgcolor TEXT, -- Color set by 'bgcolor' property
262 @ euser TEXT, -- User set by 'user' property
@@ -319,11 +339,11 @@
339 @ tagid INTEGER REFERENCES tag, -- The tag that added or removed
340 @ tagtype INTEGER, -- 0:-,cancel 1:+,single 2:*,propagate
341 @ srcid INTEGER REFERENCES blob, -- Artifact of tag. 0 for propagated tags
342 @ origid INTEGER REFERENCES blob, -- check-in holding propagated tag
343 @ value TEXT, -- Value of the tag. Might be NULL.
344 @ mtime TIMESTAMP, -- Time of addition or removal. Julian day
345 @ rid INTEGER REFERENCE blob, -- Artifact tag is applied to
346 @ UNIQUE(rid, tagid)
347 @ );
348 @ CREATE INDEX tagxref_i1 ON tagxref(tagid, mtime);
349 @
@@ -334,11 +354,11 @@
354 @ --
355 @ CREATE TABLE backlink(
356 @ target TEXT, -- Where the hyperlink points to
357 @ srctype INT, -- 0: check-in 1: ticket 2: wiki
358 @ srcid INT, -- rid for checkin or wiki. tkt_id for ticket.
359 @ mtime TIMESTAMP, -- time that the hyperlink was added. Julian day.
360 @ UNIQUE(target, srctype, srcid)
361 @ );
362 @ CREATE INDEX backlink_src ON backlink(srcid, srctype);
363 @
364 @ -- Each attachment is an entry in the following table. Only
@@ -345,11 +365,11 @@
365 @ -- the most recent attachment (identified by the D card) is saved.
366 @ --
367 @ CREATE TABLE attachment(
368 @ attachid INTEGER PRIMARY KEY, -- Local id for this attachment
369 @ isLatest BOOLEAN DEFAULT 0, -- True if this is the one to use
370 @ mtime TIMESTAMP, -- Last changed. Julian day.
371 @ src TEXT, -- UUID of the attachment. NULL to delete
372 @ target TEXT, -- Object attached to. Wikiname or Tkt UUID
373 @ filename TEXT, -- Filename for the attachment
374 @ comment TEXT, -- Comment associated with this attachment
375 @ user TEXT -- Name of user adding attachment
@@ -443,11 +463,11 @@
463 @ chnged INT DEFAULT 0, -- 0:unchnged 1:edited 2:m-chng 3:m-add
464 @ deleted BOOLEAN DEFAULT 0, -- True if deleted
465 @ isexe BOOLEAN, -- True if file should be executable
466 @ rid INTEGER, -- Originally from this repository record
467 @ mrid INTEGER, -- Based on this record due to a merge
468 @ mtime INTEGER, -- Mtime of file on disk. sec since 1970
469 @ pathname TEXT, -- Full pathname relative to root
470 @ origname TEXT, -- Original pathname. NULL if unchanged
471 @ UNIQUE(pathname,vid)
472 @ );
473 @
474
+15 -1
--- src/shun.c
+++ src/shun.c
@@ -81,17 +81,31 @@
8181
@ <b>fossil rebuild</b> command-line before the artifact content
8282
@ can pulled in from other respositories.</p>
8383
}
8484
}
8585
if( zUuid && P("add") ){
86
+ int rid, tagid;
8687
login_verify_csrf_secret();
87
- db_multi_exec("INSERT OR IGNORE INTO shun VALUES('%s')", zUuid);
88
+ db_multi_exec(
89
+ "INSERT OR IGNORE INTO shun(uuid,mtime)"
90
+ " VALUES('%s', strftime('%%s','now'))", zUuid);
8891
@ <p class="shunned">Artifact
8992
@ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> has been
9093
@ shunned. It will no longer be pushed.
9194
@ It will be removed from the repository the next time the respository
9295
@ is rebuilt using the <b>fossil rebuild</b> command-line</p>
96
+ db_multi_exec("DELETE FROM attachment WHERE src=%Q", zUuid);
97
+ rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", zUuid);
98
+ if( rid ){
99
+ db_multi_exec("DELETE FROM event WHERE objid=%d", rid);
100
+ }
101
+ tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='tkt-%q'", zUuid);
102
+ if( tagid ){
103
+ db_multi_exec("DELETE FROM ticket WHERE tkt_uuid=%Q", zUuid);
104
+ db_multi_exec("DELETE FROM tag WHERE tagid=%d", tagid);
105
+ db_multi_exec("DELETE FROM tagxref WHERE tagid=%d", tagid);
106
+ }
93107
}
94108
@ <p>A shunned artifact will not be pushed nor accepted in a pull and the
95109
@ artifact content will be purged from the repository the next time the
96110
@ repository is rebuilt. A list of shunned artifacts can be seen at the
97111
@ bottom of this page.</p>
98112
--- src/shun.c
+++ src/shun.c
@@ -81,17 +81,31 @@
81 @ <b>fossil rebuild</b> command-line before the artifact content
82 @ can pulled in from other respositories.</p>
83 }
84 }
85 if( zUuid && P("add") ){
 
86 login_verify_csrf_secret();
87 db_multi_exec("INSERT OR IGNORE INTO shun VALUES('%s')", zUuid);
 
 
88 @ <p class="shunned">Artifact
89 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> has been
90 @ shunned. It will no longer be pushed.
91 @ It will be removed from the repository the next time the respository
92 @ is rebuilt using the <b>fossil rebuild</b> command-line</p>
 
 
 
 
 
 
 
 
 
 
 
93 }
94 @ <p>A shunned artifact will not be pushed nor accepted in a pull and the
95 @ artifact content will be purged from the repository the next time the
96 @ repository is rebuilt. A list of shunned artifacts can be seen at the
97 @ bottom of this page.</p>
98
--- src/shun.c
+++ src/shun.c
@@ -81,17 +81,31 @@
81 @ <b>fossil rebuild</b> command-line before the artifact content
82 @ can pulled in from other respositories.</p>
83 }
84 }
85 if( zUuid && P("add") ){
86 int rid, tagid;
87 login_verify_csrf_secret();
88 db_multi_exec(
89 "INSERT OR IGNORE INTO shun(uuid,mtime)"
90 " VALUES('%s', strftime('%%s','now'))", zUuid);
91 @ <p class="shunned">Artifact
92 @ <a href="%s(g.zTop)/artifact/%s(zUuid)">%s(zUuid)</a> has been
93 @ shunned. It will no longer be pushed.
94 @ It will be removed from the repository the next time the respository
95 @ is rebuilt using the <b>fossil rebuild</b> command-line</p>
96 db_multi_exec("DELETE FROM attachment WHERE src=%Q", zUuid);
97 rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", zUuid);
98 if( rid ){
99 db_multi_exec("DELETE FROM event WHERE objid=%d", rid);
100 }
101 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='tkt-%q'", zUuid);
102 if( tagid ){
103 db_multi_exec("DELETE FROM ticket WHERE tkt_uuid=%Q", zUuid);
104 db_multi_exec("DELETE FROM tag WHERE tagid=%d", tagid);
105 db_multi_exec("DELETE FROM tagxref WHERE tagid=%d", tagid);
106 }
107 }
108 @ <p>A shunned artifact will not be pushed nor accepted in a pull and the
109 @ artifact content will be purged from the repository the next time the
110 @ repository is rebuilt. A list of shunned artifacts can be seen at the
111 @ bottom of this page.</p>
112
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -454,11 +454,11 @@
454454
" (SELECT uuid FROM delta, blob"
455455
" WHERE delta.rid=:rid AND delta.srcid=blob.rid)"
456456
" FROM blob"
457457
" WHERE rid=:rid"
458458
" AND size>=0"
459
- " AND uuid NOT IN shun"
459
+ " AND NOT EXISTS(SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)"
460460
);
461461
db_bind_int(&q1, ":rid", rid);
462462
rc = db_step(&q1);
463463
if( rc==SQLITE_ROW ){
464464
zUuid = db_column_text(&q1, 0);
465465
--- src/xfer.c
+++ src/xfer.c
@@ -454,11 +454,11 @@
454 " (SELECT uuid FROM delta, blob"
455 " WHERE delta.rid=:rid AND delta.srcid=blob.rid)"
456 " FROM blob"
457 " WHERE rid=:rid"
458 " AND size>=0"
459 " AND uuid NOT IN shun"
460 );
461 db_bind_int(&q1, ":rid", rid);
462 rc = db_step(&q1);
463 if( rc==SQLITE_ROW ){
464 zUuid = db_column_text(&q1, 0);
465
--- src/xfer.c
+++ src/xfer.c
@@ -454,11 +454,11 @@
454 " (SELECT uuid FROM delta, blob"
455 " WHERE delta.rid=:rid AND delta.srcid=blob.rid)"
456 " FROM blob"
457 " WHERE rid=:rid"
458 " AND size>=0"
459 " AND NOT EXISTS(SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)"
460 );
461 db_bind_int(&q1, ":rid", rid);
462 rc = db_step(&q1);
463 if( rc==SQLITE_ROW ){
464 zUuid = db_column_text(&q1, 0);
465

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button