Fossil SCM

Remove unused hard-coded tags from the schema. Output a row count as a status indicator when doing a rebuild.

drh 2007-10-11 01:17 trunk
Commit e38fc922a5bff1f8b22c6cb9b80f481bb616877c
+1 -1
--- src/construct.c
+++ src/construct.c
@@ -154,11 +154,11 @@
154154
155155
printf("imported: %d %s\n", fileCnt, fileCnt == 1 ?
156156
"file" : "files");
157157
158158
/* Finalize the repository, rebuild the derived tables */
159
- errCnt = rebuild_db(0);
159
+ errCnt = rebuild_db(0, 0);
160160
161161
if( errCnt ){
162162
printf("%d %s. Rolling back changes.\n", errCnt, errCnt == 1 ?
163163
"error" : "errors");
164164
db_end_transaction(1);
165165
--- src/construct.c
+++ src/construct.c
@@ -154,11 +154,11 @@
154
155 printf("imported: %d %s\n", fileCnt, fileCnt == 1 ?
156 "file" : "files");
157
158 /* Finalize the repository, rebuild the derived tables */
159 errCnt = rebuild_db(0);
160
161 if( errCnt ){
162 printf("%d %s. Rolling back changes.\n", errCnt, errCnt == 1 ?
163 "error" : "errors");
164 db_end_transaction(1);
165
--- src/construct.c
+++ src/construct.c
@@ -154,11 +154,11 @@
154
155 printf("imported: %d %s\n", fileCnt, fileCnt == 1 ?
156 "file" : "files");
157
158 /* Finalize the repository, rebuild the derived tables */
159 errCnt = rebuild_db(0, 0);
160
161 if( errCnt ){
162 printf("%d %s. Rolling back changes.\n", errCnt, errCnt == 1 ?
163 "error" : "errors");
164 db_end_transaction(1);
165
+12 -2
--- src/rebuild.c
+++ src/rebuild.c
@@ -37,14 +37,15 @@
3737
** If the randomize parameter is true, then the BLOBs are deliberately
3838
** extracted in a random order. This feature is used to test the
3939
** ability of fossil to accept records in any order and still
4040
** construct a sane repository.
4141
*/
42
-int rebuild_db(int randomize){
42
+int rebuild_db(int randomize, int ttyOutput){
4343
Stmt s;
4444
int errCnt = 0;
4545
char *zTable;
46
+ int cnt = 0;
4647
4748
db_multi_exec(
4849
"CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);"
4950
"CREATE TABLE IF NOT EXISTS shun(uuid UNIQUE);"
5051
);
@@ -75,16 +76,25 @@
7576
while( db_step(&s)==SQLITE_ROW ){
7677
int rid = db_column_int(&s, 0);
7778
int size = db_column_int(&s, 1);
7879
if( size>=0 ){
7980
Blob content;
81
+ if( ttyOutput ){
82
+ cnt++;
83
+ printf("%d...\r", cnt);
84
+ fflush(stdout);
85
+ }
8086
content_get(rid, &content);
8187
manifest_crosslink(rid, &content);
8288
blob_reset(&content);
8389
}else{
8490
db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
8591
}
92
+ }
93
+ db_finalize(&s);
94
+ if( ttyOutput ){
95
+ printf("\n");
8696
}
8797
return errCnt;
8898
}
8999
90100
/*
@@ -106,14 +116,14 @@
106116
if( g.argc!=3 ){
107117
usage("REPOSITORY-FILENAME");
108118
}
109119
db_open_repository(g.argv[2]);
110120
db_begin_transaction();
111
- errCnt = rebuild_db(randomizeFlag);
121
+ errCnt = rebuild_db(randomizeFlag, 1);
112122
if( errCnt && !forceFlag ){
113123
printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
114124
errCnt);
115125
db_end_transaction(1);
116126
}else{
117127
db_end_transaction(0);
118128
}
119129
}
120130
--- src/rebuild.c
+++ src/rebuild.c
@@ -37,14 +37,15 @@
37 ** If the randomize parameter is true, then the BLOBs are deliberately
38 ** extracted in a random order. This feature is used to test the
39 ** ability of fossil to accept records in any order and still
40 ** construct a sane repository.
41 */
42 int rebuild_db(int randomize){
43 Stmt s;
44 int errCnt = 0;
45 char *zTable;
 
46
47 db_multi_exec(
48 "CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);"
49 "CREATE TABLE IF NOT EXISTS shun(uuid UNIQUE);"
50 );
@@ -75,16 +76,25 @@
75 while( db_step(&s)==SQLITE_ROW ){
76 int rid = db_column_int(&s, 0);
77 int size = db_column_int(&s, 1);
78 if( size>=0 ){
79 Blob content;
 
 
 
 
 
80 content_get(rid, &content);
81 manifest_crosslink(rid, &content);
82 blob_reset(&content);
83 }else{
84 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
85 }
 
 
 
 
86 }
87 return errCnt;
88 }
89
90 /*
@@ -106,14 +116,14 @@
106 if( g.argc!=3 ){
107 usage("REPOSITORY-FILENAME");
108 }
109 db_open_repository(g.argv[2]);
110 db_begin_transaction();
111 errCnt = rebuild_db(randomizeFlag);
112 if( errCnt && !forceFlag ){
113 printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
114 errCnt);
115 db_end_transaction(1);
116 }else{
117 db_end_transaction(0);
118 }
119 }
120
--- src/rebuild.c
+++ src/rebuild.c
@@ -37,14 +37,15 @@
37 ** If the randomize parameter is true, then the BLOBs are deliberately
38 ** extracted in a random order. This feature is used to test the
39 ** ability of fossil to accept records in any order and still
40 ** construct a sane repository.
41 */
42 int rebuild_db(int randomize, int ttyOutput){
43 Stmt s;
44 int errCnt = 0;
45 char *zTable;
46 int cnt = 0;
47
48 db_multi_exec(
49 "CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);"
50 "CREATE TABLE IF NOT EXISTS shun(uuid UNIQUE);"
51 );
@@ -75,16 +76,25 @@
76 while( db_step(&s)==SQLITE_ROW ){
77 int rid = db_column_int(&s, 0);
78 int size = db_column_int(&s, 1);
79 if( size>=0 ){
80 Blob content;
81 if( ttyOutput ){
82 cnt++;
83 printf("%d...\r", cnt);
84 fflush(stdout);
85 }
86 content_get(rid, &content);
87 manifest_crosslink(rid, &content);
88 blob_reset(&content);
89 }else{
90 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
91 }
92 }
93 db_finalize(&s);
94 if( ttyOutput ){
95 printf("\n");
96 }
97 return errCnt;
98 }
99
100 /*
@@ -106,14 +116,14 @@
116 if( g.argc!=3 ){
117 usage("REPOSITORY-FILENAME");
118 }
119 db_open_repository(g.argv[2]);
120 db_begin_transaction();
121 errCnt = rebuild_db(randomizeFlag, 1);
122 if( errCnt && !forceFlag ){
123 printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
124 errCnt);
125 db_end_transaction(1);
126 }else{
127 db_end_transaction(0);
128 }
129 }
130
--- src/schema.c
+++ src/schema.c
@@ -218,12 +218,10 @@
218218
@ );
219219
@ INSERT INTO tag VALUES(1, 'bgcolor'); -- TAG_BGCOLOR
220220
@ INSERT INTO tag VALUES(2, 'comment'); -- TAG_COMMENT
221221
@ INSERT INTO tag VALUES(3, 'user'); -- TAG_USER
222222
@ INSERT INTO tag VALUES(4, 'hidden'); -- TAG_HIDDEN
223
-@ INSERT INTO tag VALUES(5, 'readonly'); -- TAG_READONLY
224
-@ INSERT INTO tag VALUES(6, 'appendonly'); -- TAG_APPENDONLY
225223
@
226224
@ -- Assignments of tags to baselines. Note that we allow tags to
227225
@ -- have values assigned to them. So we are not really dealing with
228226
@ -- tags here. These are really properties. But we are going to
229227
@ -- keep calling them tags because in many cases the value is ignored.
@@ -246,12 +244,10 @@
246244
#if INTERFACE
247245
# define TAG_BGCOLOR 1
248246
# define TAG_COMMENT 2
249247
# define TAG_USER 3
250248
# define TAG_HIDDEN 4
251
-# define TAG_READONLY 5
252
-# define TAG_APPENDONLY 6
253249
#endif
254250
255251
/*
256252
** The schema for the locate FOSSIL database file found at the root
257253
** of very check-out. This database contains the complete state of
258254
--- src/schema.c
+++ src/schema.c
@@ -218,12 +218,10 @@
218 @ );
219 @ INSERT INTO tag VALUES(1, 'bgcolor'); -- TAG_BGCOLOR
220 @ INSERT INTO tag VALUES(2, 'comment'); -- TAG_COMMENT
221 @ INSERT INTO tag VALUES(3, 'user'); -- TAG_USER
222 @ INSERT INTO tag VALUES(4, 'hidden'); -- TAG_HIDDEN
223 @ INSERT INTO tag VALUES(5, 'readonly'); -- TAG_READONLY
224 @ INSERT INTO tag VALUES(6, 'appendonly'); -- TAG_APPENDONLY
225 @
226 @ -- Assignments of tags to baselines. Note that we allow tags to
227 @ -- have values assigned to them. So we are not really dealing with
228 @ -- tags here. These are really properties. But we are going to
229 @ -- keep calling them tags because in many cases the value is ignored.
@@ -246,12 +244,10 @@
246 #if INTERFACE
247 # define TAG_BGCOLOR 1
248 # define TAG_COMMENT 2
249 # define TAG_USER 3
250 # define TAG_HIDDEN 4
251 # define TAG_READONLY 5
252 # define TAG_APPENDONLY 6
253 #endif
254
255 /*
256 ** The schema for the locate FOSSIL database file found at the root
257 ** of very check-out. This database contains the complete state of
258
--- src/schema.c
+++ src/schema.c
@@ -218,12 +218,10 @@
218 @ );
219 @ INSERT INTO tag VALUES(1, 'bgcolor'); -- TAG_BGCOLOR
220 @ INSERT INTO tag VALUES(2, 'comment'); -- TAG_COMMENT
221 @ INSERT INTO tag VALUES(3, 'user'); -- TAG_USER
222 @ INSERT INTO tag VALUES(4, 'hidden'); -- TAG_HIDDEN
 
 
223 @
224 @ -- Assignments of tags to baselines. Note that we allow tags to
225 @ -- have values assigned to them. So we are not really dealing with
226 @ -- tags here. These are really properties. But we are going to
227 @ -- keep calling them tags because in many cases the value is ignored.
@@ -246,12 +244,10 @@
244 #if INTERFACE
245 # define TAG_BGCOLOR 1
246 # define TAG_COMMENT 2
247 # define TAG_USER 3
248 # define TAG_HIDDEN 4
 
 
249 #endif
250
251 /*
252 ** The schema for the locate FOSSIL database file found at the root
253 ** of very check-out. This database contains the complete state of
254

Keyboard Shortcuts

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