Fossil SCM

Trunkify support for generating manifest.tags file.

jan 2016-09-30 22:01 trunk merge
Commit 189bfc28e7a3a166417aabfb77bf898b3b26c4df
+21 -8
--- src/add.c
+++ src/add.c
@@ -71,29 +71,42 @@
7171
".fos-journal",
7272
".fos-wal",
7373
".fos-shm",
7474
};
7575
76
- /* Names of auxiliary files generated by SQLite when the "manifest"
77
- ** property is enabled
76
+ /* Possible names of auxiliary files generated when the "manifest" property
77
+ ** is used
7878
*/
79
- static const char *const azManifest[] = {
80
- "manifest",
81
- "manifest.uuid",
79
+ static const struct {
80
+ const char *fname;
81
+ int flg;
82
+ }aManifestflags[] = {
83
+ { "manifest", MFESTFLG_RAW },
84
+ { "manifest.uuid", MFESTFLG_UUID },
85
+ { "manifest.tags", MFESTFLG_TAGS }
8286
};
87
+ static const char *azManifests[3];
8388
8489
/*
8590
** Names of repository files, if they exist in the checkout.
8691
*/
8792
static const char *azRepo[4] = { 0, 0, 0, 0 };
8893
8994
/* Cached setting "manifest" */
9095
static int cachedManifest = -1;
96
+ static int numManifests;
9197
9298
if( cachedManifest == -1 ){
99
+ int i;
93100
Blob repo;
94
- cachedManifest = db_get_boolean("manifest",0);
101
+ cachedManifest = db_get_manifest_setting();
102
+ numManifests = 0;
103
+ for(i=0; i<count(aManifestflags); i++){
104
+ if( cachedManifest&aManifestflags[i].flg ) {
105
+ azManifests[numManifests++] = aManifestflags[i].fname;
106
+ }
107
+ }
95108
blob_zero(&repo);
96109
if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){
97110
const char *zRepo = blob_str(&repo);
98111
azRepo[0] = zRepo;
99112
azRepo[1] = mprintf("%s-journal", zRepo);
@@ -104,12 +117,12 @@
104117
105118
if( N<0 ) return 0;
106119
if( N<count(azName) ) return azName[N];
107120
N -= count(azName);
108121
if( cachedManifest ){
109
- if( N<count(azManifest) ) return azManifest[N];
110
- N -= count(azManifest);
122
+ if( N<numManifests ) return azManifests[N];
123
+ N -= numManifests;
111124
}
112125
if( !omitRepo && N<count(azRepo) ) return azRepo[N];
113126
return 0;
114127
}
115128
116129
--- src/add.c
+++ src/add.c
@@ -71,29 +71,42 @@
71 ".fos-journal",
72 ".fos-wal",
73 ".fos-shm",
74 };
75
76 /* Names of auxiliary files generated by SQLite when the "manifest"
77 ** property is enabled
78 */
79 static const char *const azManifest[] = {
80 "manifest",
81 "manifest.uuid",
 
 
 
 
82 };
 
83
84 /*
85 ** Names of repository files, if they exist in the checkout.
86 */
87 static const char *azRepo[4] = { 0, 0, 0, 0 };
88
89 /* Cached setting "manifest" */
90 static int cachedManifest = -1;
 
91
92 if( cachedManifest == -1 ){
 
93 Blob repo;
94 cachedManifest = db_get_boolean("manifest",0);
 
 
 
 
 
 
95 blob_zero(&repo);
96 if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){
97 const char *zRepo = blob_str(&repo);
98 azRepo[0] = zRepo;
99 azRepo[1] = mprintf("%s-journal", zRepo);
@@ -104,12 +117,12 @@
104
105 if( N<0 ) return 0;
106 if( N<count(azName) ) return azName[N];
107 N -= count(azName);
108 if( cachedManifest ){
109 if( N<count(azManifest) ) return azManifest[N];
110 N -= count(azManifest);
111 }
112 if( !omitRepo && N<count(azRepo) ) return azRepo[N];
113 return 0;
114 }
115
116
--- src/add.c
+++ src/add.c
@@ -71,29 +71,42 @@
71 ".fos-journal",
72 ".fos-wal",
73 ".fos-shm",
74 };
75
76 /* Possible names of auxiliary files generated when the "manifest" property
77 ** is used
78 */
79 static const struct {
80 const char *fname;
81 int flg;
82 }aManifestflags[] = {
83 { "manifest", MFESTFLG_RAW },
84 { "manifest.uuid", MFESTFLG_UUID },
85 { "manifest.tags", MFESTFLG_TAGS }
86 };
87 static const char *azManifests[3];
88
89 /*
90 ** Names of repository files, if they exist in the checkout.
91 */
92 static const char *azRepo[4] = { 0, 0, 0, 0 };
93
94 /* Cached setting "manifest" */
95 static int cachedManifest = -1;
96 static int numManifests;
97
98 if( cachedManifest == -1 ){
99 int i;
100 Blob repo;
101 cachedManifest = db_get_manifest_setting();
102 numManifests = 0;
103 for(i=0; i<count(aManifestflags); i++){
104 if( cachedManifest&aManifestflags[i].flg ) {
105 azManifests[numManifests++] = aManifestflags[i].fname;
106 }
107 }
108 blob_zero(&repo);
109 if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){
110 const char *zRepo = blob_str(&repo);
111 azRepo[0] = zRepo;
112 azRepo[1] = mprintf("%s-journal", zRepo);
@@ -104,12 +117,12 @@
117
118 if( N<0 ) return 0;
119 if( N<count(azName) ) return azName[N];
120 N -= count(azName);
121 if( cachedManifest ){
122 if( N<numManifests ) return azManifests[N];
123 N -= numManifests;
124 }
125 if( !omitRepo && N<count(azRepo) ) return azRepo[N];
126 return 0;
127 }
128
129
+13 -3
--- src/checkin.c
+++ src/checkin.c
@@ -1869,11 +1869,11 @@
18691869
sCiInfo.zUserOvrd = find_option("user-override",0,1);
18701870
db_must_be_within_tree();
18711871
noSign = db_get_boolean("omitsign", 0)|noSign;
18721872
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
18731873
useCksum = db_get_boolean("repo-cksum", 1);
1874
- outputManifest = db_get_boolean("manifest", 0);
1874
+ outputManifest = db_get_manifest_setting();
18751875
verify_all_options();
18761876
18771877
/* Escape special characters in tags and put all tags in sorted order */
18781878
if( nTag ){
18791879
int i;
@@ -2230,11 +2230,11 @@
22302230
** and rollback the transaction.
22312231
*/
22322232
if( dryRunFlag ){
22332233
blob_write_to_file(&manifest, "");
22342234
}
2235
- if( outputManifest ){
2235
+ if( outputManifest & MFESTFLG_RAW ){
22362236
zManifestFile = mprintf("%smanifest", g.zLocalRoot);
22372237
blob_write_to_file(&manifest, zManifestFile);
22382238
blob_reset(&manifest);
22392239
blob_read_from_file(&manifest, zManifestFile);
22402240
free(zManifestFile);
@@ -2264,11 +2264,11 @@
22642264
}
22652265
}
22662266
db_finalize(&q);
22672267
22682268
fossil_print("New_Version: %s\n", zUuid);
2269
- if( outputManifest ){
2269
+ if( outputManifest & MFESTFLG_UUID ){
22702270
zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot);
22712271
blob_zero(&muuid);
22722272
blob_appendf(&muuid, "%s\n", zUuid);
22732273
blob_write_to_file(&muuid, zManifestFile);
22742274
free(zManifestFile);
@@ -2346,13 +2346,23 @@
23462346
if( dryRunFlag ){
23472347
db_end_transaction(1);
23482348
exit(1);
23492349
}
23502350
db_end_transaction(0);
2351
+
2352
+ if( outputManifest & MFESTFLG_TAGS ){
2353
+ Blob tagslist;
2354
+ zManifestFile = mprintf("%smanifest.tags", g.zLocalRoot);
2355
+ blob_zero(&tagslist);
2356
+ get_checkin_taglist(nvid, &tagslist);
2357
+ blob_write_to_file(&tagslist, zManifestFile);
2358
+ blob_reset(&tagslist);
2359
+ free(zManifestFile);
2360
+ }
23512361
23522362
if( !g.markPrivate ){
23532363
autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0);
23542364
}
23552365
if( count_nonbranch_children(vid)>1 ){
23562366
fossil_print("**** warning: a fork has occurred *****\n");
23572367
}
23582368
}
23592369
--- src/checkin.c
+++ src/checkin.c
@@ -1869,11 +1869,11 @@
1869 sCiInfo.zUserOvrd = find_option("user-override",0,1);
1870 db_must_be_within_tree();
1871 noSign = db_get_boolean("omitsign", 0)|noSign;
1872 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
1873 useCksum = db_get_boolean("repo-cksum", 1);
1874 outputManifest = db_get_boolean("manifest", 0);
1875 verify_all_options();
1876
1877 /* Escape special characters in tags and put all tags in sorted order */
1878 if( nTag ){
1879 int i;
@@ -2230,11 +2230,11 @@
2230 ** and rollback the transaction.
2231 */
2232 if( dryRunFlag ){
2233 blob_write_to_file(&manifest, "");
2234 }
2235 if( outputManifest ){
2236 zManifestFile = mprintf("%smanifest", g.zLocalRoot);
2237 blob_write_to_file(&manifest, zManifestFile);
2238 blob_reset(&manifest);
2239 blob_read_from_file(&manifest, zManifestFile);
2240 free(zManifestFile);
@@ -2264,11 +2264,11 @@
2264 }
2265 }
2266 db_finalize(&q);
2267
2268 fossil_print("New_Version: %s\n", zUuid);
2269 if( outputManifest ){
2270 zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot);
2271 blob_zero(&muuid);
2272 blob_appendf(&muuid, "%s\n", zUuid);
2273 blob_write_to_file(&muuid, zManifestFile);
2274 free(zManifestFile);
@@ -2346,13 +2346,23 @@
2346 if( dryRunFlag ){
2347 db_end_transaction(1);
2348 exit(1);
2349 }
2350 db_end_transaction(0);
 
 
 
 
 
 
 
 
 
 
2351
2352 if( !g.markPrivate ){
2353 autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0);
2354 }
2355 if( count_nonbranch_children(vid)>1 ){
2356 fossil_print("**** warning: a fork has occurred *****\n");
2357 }
2358 }
2359
--- src/checkin.c
+++ src/checkin.c
@@ -1869,11 +1869,11 @@
1869 sCiInfo.zUserOvrd = find_option("user-override",0,1);
1870 db_must_be_within_tree();
1871 noSign = db_get_boolean("omitsign", 0)|noSign;
1872 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
1873 useCksum = db_get_boolean("repo-cksum", 1);
1874 outputManifest = db_get_manifest_setting();
1875 verify_all_options();
1876
1877 /* Escape special characters in tags and put all tags in sorted order */
1878 if( nTag ){
1879 int i;
@@ -2230,11 +2230,11 @@
2230 ** and rollback the transaction.
2231 */
2232 if( dryRunFlag ){
2233 blob_write_to_file(&manifest, "");
2234 }
2235 if( outputManifest & MFESTFLG_RAW ){
2236 zManifestFile = mprintf("%smanifest", g.zLocalRoot);
2237 blob_write_to_file(&manifest, zManifestFile);
2238 blob_reset(&manifest);
2239 blob_read_from_file(&manifest, zManifestFile);
2240 free(zManifestFile);
@@ -2264,11 +2264,11 @@
2264 }
2265 }
2266 db_finalize(&q);
2267
2268 fossil_print("New_Version: %s\n", zUuid);
2269 if( outputManifest & MFESTFLG_UUID ){
2270 zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot);
2271 blob_zero(&muuid);
2272 blob_appendf(&muuid, "%s\n", zUuid);
2273 blob_write_to_file(&muuid, zManifestFile);
2274 free(zManifestFile);
@@ -2346,13 +2346,23 @@
2346 if( dryRunFlag ){
2347 db_end_transaction(1);
2348 exit(1);
2349 }
2350 db_end_transaction(0);
2351
2352 if( outputManifest & MFESTFLG_TAGS ){
2353 Blob tagslist;
2354 zManifestFile = mprintf("%smanifest.tags", g.zLocalRoot);
2355 blob_zero(&tagslist);
2356 get_checkin_taglist(nvid, &tagslist);
2357 blob_write_to_file(&tagslist, zManifestFile);
2358 blob_reset(&tagslist);
2359 free(zManifestFile);
2360 }
2361
2362 if( !g.markPrivate ){
2363 autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0);
2364 }
2365 if( count_nonbranch_children(vid)>1 ){
2366 fossil_print("**** warning: a fork has occurred *****\n");
2367 }
2368 }
2369
+65 -7
--- src/checkout.c
+++ src/checkout.c
@@ -127,44 +127,102 @@
127127
128128
/*
129129
** If the "manifest" setting is true, then automatically generate
130130
** files named "manifest" and "manifest.uuid" containing, respectively,
131131
** the text of the manifest and the artifact ID of the manifest.
132
+** If the manifest setting is set, but is not a boolean value, then treat
133
+** each character as a flag to enable writing "manifest", "manifest.uuid" or
134
+** "manifest.tags".
132135
*/
133136
void manifest_to_disk(int vid){
134137
char *zManFile;
135138
Blob manifest;
136139
Blob hash;
140
+ Blob taglist;
141
+ int flg;
142
+
143
+ flg = db_get_manifest_setting();
137144
138
- if( db_get_boolean("manifest",0) ){
145
+ if( flg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
139146
blob_zero(&manifest);
140147
content_get(vid, &manifest);
141
- zManFile = mprintf("%smanifest", g.zLocalRoot);
142148
blob_zero(&hash);
143149
sha1sum_blob(&manifest, &hash);
144150
sterilize_manifest(&manifest);
151
+ }
152
+ if( flg & MFESTFLG_RAW ){
153
+ zManFile = mprintf("%smanifest", g.zLocalRoot);
145154
blob_write_to_file(&manifest, zManFile);
146155
free(zManFile);
147
- zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
148
- blob_append(&hash, "\n", 1);
149
- blob_write_to_file(&hash, zManFile);
150
- free(zManFile);
151
- blob_reset(&hash);
152156
}else{
153157
if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){
154158
zManFile = mprintf("%smanifest", g.zLocalRoot);
155159
file_delete(zManFile);
156160
free(zManFile);
157161
}
162
+ }
163
+ if( flg & MFESTFLG_UUID ){
164
+ zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
165
+ blob_append(&hash, "\n", 1);
166
+ blob_write_to_file(&hash, zManFile);
167
+ free(zManFile);
168
+ blob_reset(&hash);
169
+ }else{
158170
if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){
159171
zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
160172
file_delete(zManFile);
161173
free(zManFile);
162174
}
163175
}
176
+ if( flg & MFESTFLG_TAGS ){
177
+ blob_zero(&taglist);
178
+ zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
179
+ get_checkin_taglist(vid, &taglist);
180
+ blob_write_to_file(&taglist, zManFile);
181
+ free(zManFile);
182
+ blob_reset(&taglist);
183
+ }else{
184
+ if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.tags'") ){
185
+ zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
186
+ file_delete(zManFile);
187
+ free(zManFile);
188
+ }
189
+ }
190
+}
164191
192
+/*
193
+** Find the branch name and all symbolic tags for a particular check-in
194
+** identified by "rid".
195
+**
196
+** The branch name is actually only extracted if this procedure is run
197
+** from within a local check-out. And the branch name is not the branch
198
+** name for "rid" but rather the branch name for the current check-out.
199
+** It is unclear if the rid parameter is always the same as the current
200
+** check-out.
201
+*/
202
+void get_checkin_taglist(int rid, Blob *pOut){
203
+ Stmt stmt;
204
+ char *zCurrent;
205
+ blob_reset(pOut);
206
+ zCurrent = db_text(0, "SELECT value FROM tagxref"
207
+ " WHERE rid=%d AND tagid=%d", rid, TAG_BRANCH);
208
+ blob_appendf(pOut, "branch %s\n", zCurrent);
209
+ db_prepare(&stmt, "SELECT substr(tagname, 5)"
210
+ " FROM tagxref, tag"
211
+ " WHERE tagxref.rid=%d"
212
+ " AND tagxref.tagtype>0"
213
+ " AND tag.tagid=tagxref.tagid"
214
+ " AND tag.tagname GLOB 'sym-*'", rid);
215
+ while( db_step(&stmt)==SQLITE_ROW ){
216
+ const char *zName;
217
+ zName = db_column_text(&stmt, 0);
218
+ blob_appendf(pOut, "tag %s\n", zName);
219
+ }
220
+ db_reset(&stmt);
221
+ db_finalize(&stmt);
165222
}
223
+
166224
167225
/*
168226
** COMMAND: checkout*
169227
** COMMAND: co*
170228
**
171229
--- src/checkout.c
+++ src/checkout.c
@@ -127,44 +127,102 @@
127
128 /*
129 ** If the "manifest" setting is true, then automatically generate
130 ** files named "manifest" and "manifest.uuid" containing, respectively,
131 ** the text of the manifest and the artifact ID of the manifest.
 
 
 
132 */
133 void manifest_to_disk(int vid){
134 char *zManFile;
135 Blob manifest;
136 Blob hash;
 
 
 
 
137
138 if( db_get_boolean("manifest",0) ){
139 blob_zero(&manifest);
140 content_get(vid, &manifest);
141 zManFile = mprintf("%smanifest", g.zLocalRoot);
142 blob_zero(&hash);
143 sha1sum_blob(&manifest, &hash);
144 sterilize_manifest(&manifest);
 
 
 
145 blob_write_to_file(&manifest, zManFile);
146 free(zManFile);
147 zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
148 blob_append(&hash, "\n", 1);
149 blob_write_to_file(&hash, zManFile);
150 free(zManFile);
151 blob_reset(&hash);
152 }else{
153 if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){
154 zManFile = mprintf("%smanifest", g.zLocalRoot);
155 file_delete(zManFile);
156 free(zManFile);
157 }
 
 
 
 
 
 
 
 
158 if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){
159 zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
160 file_delete(zManFile);
161 free(zManFile);
162 }
163 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165 }
 
166
167 /*
168 ** COMMAND: checkout*
169 ** COMMAND: co*
170 **
171
--- src/checkout.c
+++ src/checkout.c
@@ -127,44 +127,102 @@
127
128 /*
129 ** If the "manifest" setting is true, then automatically generate
130 ** files named "manifest" and "manifest.uuid" containing, respectively,
131 ** the text of the manifest and the artifact ID of the manifest.
132 ** If the manifest setting is set, but is not a boolean value, then treat
133 ** each character as a flag to enable writing "manifest", "manifest.uuid" or
134 ** "manifest.tags".
135 */
136 void manifest_to_disk(int vid){
137 char *zManFile;
138 Blob manifest;
139 Blob hash;
140 Blob taglist;
141 int flg;
142
143 flg = db_get_manifest_setting();
144
145 if( flg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
146 blob_zero(&manifest);
147 content_get(vid, &manifest);
 
148 blob_zero(&hash);
149 sha1sum_blob(&manifest, &hash);
150 sterilize_manifest(&manifest);
151 }
152 if( flg & MFESTFLG_RAW ){
153 zManFile = mprintf("%smanifest", g.zLocalRoot);
154 blob_write_to_file(&manifest, zManFile);
155 free(zManFile);
 
 
 
 
 
156 }else{
157 if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){
158 zManFile = mprintf("%smanifest", g.zLocalRoot);
159 file_delete(zManFile);
160 free(zManFile);
161 }
162 }
163 if( flg & MFESTFLG_UUID ){
164 zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
165 blob_append(&hash, "\n", 1);
166 blob_write_to_file(&hash, zManFile);
167 free(zManFile);
168 blob_reset(&hash);
169 }else{
170 if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){
171 zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
172 file_delete(zManFile);
173 free(zManFile);
174 }
175 }
176 if( flg & MFESTFLG_TAGS ){
177 blob_zero(&taglist);
178 zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
179 get_checkin_taglist(vid, &taglist);
180 blob_write_to_file(&taglist, zManFile);
181 free(zManFile);
182 blob_reset(&taglist);
183 }else{
184 if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.tags'") ){
185 zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
186 file_delete(zManFile);
187 free(zManFile);
188 }
189 }
190 }
191
192 /*
193 ** Find the branch name and all symbolic tags for a particular check-in
194 ** identified by "rid".
195 **
196 ** The branch name is actually only extracted if this procedure is run
197 ** from within a local check-out. And the branch name is not the branch
198 ** name for "rid" but rather the branch name for the current check-out.
199 ** It is unclear if the rid parameter is always the same as the current
200 ** check-out.
201 */
202 void get_checkin_taglist(int rid, Blob *pOut){
203 Stmt stmt;
204 char *zCurrent;
205 blob_reset(pOut);
206 zCurrent = db_text(0, "SELECT value FROM tagxref"
207 " WHERE rid=%d AND tagid=%d", rid, TAG_BRANCH);
208 blob_appendf(pOut, "branch %s\n", zCurrent);
209 db_prepare(&stmt, "SELECT substr(tagname, 5)"
210 " FROM tagxref, tag"
211 " WHERE tagxref.rid=%d"
212 " AND tagxref.tagtype>0"
213 " AND tag.tagid=tagxref.tagid"
214 " AND tag.tagname GLOB 'sym-*'", rid);
215 while( db_step(&stmt)==SQLITE_ROW ){
216 const char *zName;
217 zName = db_column_text(&stmt, 0);
218 blob_appendf(pOut, "tag %s\n", zName);
219 }
220 db_reset(&stmt);
221 db_finalize(&stmt);
222 }
223
224
225 /*
226 ** COMMAND: checkout*
227 ** COMMAND: co*
228 **
229
+43 -4
--- src/db.c
+++ src/db.c
@@ -2270,10 +2270,46 @@
22702270
return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
22712271
}
22722272
void db_lset_int(const char *zName, int value){
22732273
db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
22742274
}
2275
+
2276
+#if INTERFACE
2277
+/* Manifest generation flags */
2278
+#define MFESTFLG_RAW 0x01
2279
+#define MFESTFLG_UUID 0x02
2280
+#define MFESTFLG_TAGS 0x04
2281
+#endif /* INTERFACE */
2282
+
2283
+/*
2284
+** Get the manifest setting. For backwards compatibility first check if the
2285
+** value is a boolean. If it's not a boolean, treat each character as a flag
2286
+** to enable a manifest type. This system puts certain boundary conditions on
2287
+** which letters can be used to represent flags (any permutation of flags must
2288
+** not be able to fully form one of the boolean values).
2289
+*/
2290
+int db_get_manifest_setting(void){
2291
+ int flg;
2292
+ char *zNVVal = db_get("manifest", "off");
2293
+ char *zVal = db_get_versioned("manifest", zNVVal);
2294
+ if( is_false(zVal) ){
2295
+ return 0;
2296
+ }else if( is_truth(zVal) ) {
2297
+ return MFESTFLG_RAW|MFESTFLG_UUID;
2298
+ }
2299
+ flg = 0;
2300
+ while( *zVal ){
2301
+ switch( *zVal ){
2302
+ case 'r': flg |= MFESTFLG_RAW; break;
2303
+ case 'u': flg |= MFESTFLG_UUID; break;
2304
+ case 't': flg |= MFESTFLG_TAGS; break;
2305
+ }
2306
+ zVal++;
2307
+ }
2308
+ return flg;
2309
+}
2310
+
22752311
22762312
/*
22772313
** Record the name of a local repository in the global_config() database.
22782314
** The repository filename %s is recorded as an entry with a "name" field
22792315
** of the following form:
@@ -2570,11 +2606,11 @@
25702606
{ "https-login", 0, 0, 0, 0, "off" },
25712607
{ "ignore-glob", 0, 40, 1, 0, "" },
25722608
{ "keep-glob", 0, 40, 1, 0, "" },
25732609
{ "localauth", 0, 0, 0, 0, "off" },
25742610
{ "main-branch", 0, 40, 0, 0, "trunk" },
2575
- { "manifest", 0, 0, 1, 0, "off" },
2611
+ { "manifest", 0, 5, 0, 0, "off" },
25762612
{ "max-loadavg", 0, 25, 0, 0, "0.0" },
25772613
{ "max-upload", 0, 25, 0, 0, "250000" },
25782614
{ "mtime-changes", 0, 0, 0, 0, "on" },
25792615
#if FOSSIL_ENABLE_LEGACY_MV_RM
25802616
{ "mv-rm-files", 0, 0, 0, 0, "off" },
@@ -2775,13 +2811,16 @@
27752811
** false, all HTTP requests from localhost have
27762812
** unrestricted access to the repository.
27772813
**
27782814
** main-branch The primary branch for the project. Default: trunk
27792815
**
2780
-** manifest If enabled, automatically create files "manifest" and
2781
-** (versionable) "manifest.uuid" in every checkout. The SQLite and
2782
-** Fossil repositories both require this. Default: off.
2816
+** manifest If set to a true boolean value, automatically create
2817
+** (versionable) files "manifest" and "manifest.uuid" in every checkout.
2818
+** Optionally use combinations of characters 'r'
2819
+** for "manifest", 'u' for "manifest.uuid" and 't' for
2820
+** "manifest.tags". The SQLite and Fossil repositories
2821
+** both require manifests. Default: off.
27832822
**
27842823
** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
27852824
** are disallowed if the system load average goes above this
27862825
** value. "0.0" means no limit. This only works on unix.
27872826
** Only local settings of this value make a difference since
27882827
--- src/db.c
+++ src/db.c
@@ -2270,10 +2270,46 @@
2270 return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
2271 }
2272 void db_lset_int(const char *zName, int value){
2273 db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
2274 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2275
2276 /*
2277 ** Record the name of a local repository in the global_config() database.
2278 ** The repository filename %s is recorded as an entry with a "name" field
2279 ** of the following form:
@@ -2570,11 +2606,11 @@
2570 { "https-login", 0, 0, 0, 0, "off" },
2571 { "ignore-glob", 0, 40, 1, 0, "" },
2572 { "keep-glob", 0, 40, 1, 0, "" },
2573 { "localauth", 0, 0, 0, 0, "off" },
2574 { "main-branch", 0, 40, 0, 0, "trunk" },
2575 { "manifest", 0, 0, 1, 0, "off" },
2576 { "max-loadavg", 0, 25, 0, 0, "0.0" },
2577 { "max-upload", 0, 25, 0, 0, "250000" },
2578 { "mtime-changes", 0, 0, 0, 0, "on" },
2579 #if FOSSIL_ENABLE_LEGACY_MV_RM
2580 { "mv-rm-files", 0, 0, 0, 0, "off" },
@@ -2775,13 +2811,16 @@
2775 ** false, all HTTP requests from localhost have
2776 ** unrestricted access to the repository.
2777 **
2778 ** main-branch The primary branch for the project. Default: trunk
2779 **
2780 ** manifest If enabled, automatically create files "manifest" and
2781 ** (versionable) "manifest.uuid" in every checkout. The SQLite and
2782 ** Fossil repositories both require this. Default: off.
 
 
 
2783 **
2784 ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
2785 ** are disallowed if the system load average goes above this
2786 ** value. "0.0" means no limit. This only works on unix.
2787 ** Only local settings of this value make a difference since
2788
--- src/db.c
+++ src/db.c
@@ -2270,10 +2270,46 @@
2270 return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
2271 }
2272 void db_lset_int(const char *zName, int value){
2273 db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
2274 }
2275
2276 #if INTERFACE
2277 /* Manifest generation flags */
2278 #define MFESTFLG_RAW 0x01
2279 #define MFESTFLG_UUID 0x02
2280 #define MFESTFLG_TAGS 0x04
2281 #endif /* INTERFACE */
2282
2283 /*
2284 ** Get the manifest setting. For backwards compatibility first check if the
2285 ** value is a boolean. If it's not a boolean, treat each character as a flag
2286 ** to enable a manifest type. This system puts certain boundary conditions on
2287 ** which letters can be used to represent flags (any permutation of flags must
2288 ** not be able to fully form one of the boolean values).
2289 */
2290 int db_get_manifest_setting(void){
2291 int flg;
2292 char *zNVVal = db_get("manifest", "off");
2293 char *zVal = db_get_versioned("manifest", zNVVal);
2294 if( is_false(zVal) ){
2295 return 0;
2296 }else if( is_truth(zVal) ) {
2297 return MFESTFLG_RAW|MFESTFLG_UUID;
2298 }
2299 flg = 0;
2300 while( *zVal ){
2301 switch( *zVal ){
2302 case 'r': flg |= MFESTFLG_RAW; break;
2303 case 'u': flg |= MFESTFLG_UUID; break;
2304 case 't': flg |= MFESTFLG_TAGS; break;
2305 }
2306 zVal++;
2307 }
2308 return flg;
2309 }
2310
2311
2312 /*
2313 ** Record the name of a local repository in the global_config() database.
2314 ** The repository filename %s is recorded as an entry with a "name" field
2315 ** of the following form:
@@ -2570,11 +2606,11 @@
2606 { "https-login", 0, 0, 0, 0, "off" },
2607 { "ignore-glob", 0, 40, 1, 0, "" },
2608 { "keep-glob", 0, 40, 1, 0, "" },
2609 { "localauth", 0, 0, 0, 0, "off" },
2610 { "main-branch", 0, 40, 0, 0, "trunk" },
2611 { "manifest", 0, 5, 0, 0, "off" },
2612 { "max-loadavg", 0, 25, 0, 0, "0.0" },
2613 { "max-upload", 0, 25, 0, 0, "250000" },
2614 { "mtime-changes", 0, 0, 0, 0, "on" },
2615 #if FOSSIL_ENABLE_LEGACY_MV_RM
2616 { "mv-rm-files", 0, 0, 0, 0, "off" },
@@ -2775,13 +2811,16 @@
2811 ** false, all HTTP requests from localhost have
2812 ** unrestricted access to the repository.
2813 **
2814 ** main-branch The primary branch for the project. Default: trunk
2815 **
2816 ** manifest If set to a true boolean value, automatically create
2817 ** (versionable) files "manifest" and "manifest.uuid" in every checkout.
2818 ** Optionally use combinations of characters 'r'
2819 ** for "manifest", 'u' for "manifest.uuid" and 't' for
2820 ** "manifest.tags". The SQLite and Fossil repositories
2821 ** both require manifests. Default: off.
2822 **
2823 ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame)
2824 ** are disallowed if the system load average goes above this
2825 ** value. "0.0" means no limit. This only works on unix.
2826 ** Only local settings of this value make a difference since
2827
+1
--- src/tag.c
+++ src/tag.c
@@ -359,10 +359,11 @@
359359
}else{
360360
nrid = content_put(&ctrl);
361361
manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS);
362362
}
363363
assert( blob_is_reset(&ctrl) );
364
+ manifest_to_disk(rid);
364365
}
365366
366367
/*
367368
** COMMAND: tag
368369
**
369370
--- src/tag.c
+++ src/tag.c
@@ -359,10 +359,11 @@
359 }else{
360 nrid = content_put(&ctrl);
361 manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS);
362 }
363 assert( blob_is_reset(&ctrl) );
 
364 }
365
366 /*
367 ** COMMAND: tag
368 **
369
--- src/tag.c
+++ src/tag.c
@@ -359,10 +359,11 @@
359 }else{
360 nrid = content_put(&ctrl);
361 manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS);
362 }
363 assert( blob_is_reset(&ctrl) );
364 manifest_to_disk(rid);
365 }
366
367 /*
368 ** COMMAND: tag
369 **
370
+51 -15
--- src/tar.c
+++ src/tar.c
@@ -493,28 +493,64 @@
493493
}
494494
nPrefix = blob_size(&filename);
495495
496496
pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
497497
if( pManifest ){
498
+ int flg, eflg = 0;
498499
mTime = (pManifest->rDate - 2440587.5)*86400.0;
499500
tar_begin(mTime);
500
- if( (pInclude==0 || glob_match(pInclude, "manifest"))
501
- && !glob_match(pExclude, "manifest")
502
- && db_get_boolean("manifest", 0)
503
- ){
504
- blob_append(&filename, "manifest", -1);
505
- zName = blob_str(&filename);
506
- sha1sum_blob(&mfile, &hash);
507
- sterilize_manifest(&mfile);
508
- tar_add_file(zName, &mfile, 0, mTime);
501
+ flg = db_get_manifest_setting();
502
+ if( flg ){
503
+ /* eflg is the effective flags, taking include/exclude into account */
504
+ if( (pInclude==0 || glob_match(pInclude, "manifest"))
505
+ && !glob_match(pExclude, "manifest")
506
+ && (flg & MFESTFLG_RAW) ){
507
+ eflg |= MFESTFLG_RAW;
508
+ }
509
+ if( (pInclude==0 || glob_match(pInclude, "manifest.uuid"))
510
+ && !glob_match(pExclude, "manifest.uuid")
511
+ && (flg & MFESTFLG_UUID) ){
512
+ eflg |= MFESTFLG_UUID;
513
+ }
514
+ if( (pInclude==0 || glob_match(pInclude, "manifest.tags"))
515
+ && !glob_match(pExclude, "manifest.tags")
516
+ && (flg & MFESTFLG_TAGS) ){
517
+ eflg |= MFESTFLG_TAGS;
518
+ }
519
+
520
+ if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
521
+ if( eflg & MFESTFLG_RAW ){
522
+ blob_append(&filename, "manifest", -1);
523
+ zName = blob_str(&filename);
524
+ }
525
+ if( eflg & MFESTFLG_UUID ){
526
+ sha1sum_blob(&mfile, &hash);
527
+ }
528
+ if( eflg & MFESTFLG_RAW ) {
529
+ sterilize_manifest(&mfile);
530
+ tar_add_file(zName, &mfile, 0, mTime);
531
+ }
532
+ }
509533
blob_reset(&mfile);
510
- blob_append(&hash, "\n", 1);
511
- blob_resize(&filename, nPrefix);
512
- blob_append(&filename, "manifest.uuid", -1);
513
- zName = blob_str(&filename);
514
- tar_add_file(zName, &hash, 0, mTime);
515
- blob_reset(&hash);
534
+ if( eflg & MFESTFLG_UUID ){
535
+ blob_append(&hash, "\n", 1);
536
+ blob_resize(&filename, nPrefix);
537
+ blob_append(&filename, "manifest.uuid", -1);
538
+ zName = blob_str(&filename);
539
+ tar_add_file(zName, &hash, 0, mTime);
540
+ blob_reset(&hash);
541
+ }
542
+ if( eflg & MFESTFLG_TAGS ){
543
+ Blob tagslist;
544
+ blob_zero(&tagslist);
545
+ get_checkin_taglist(rid, &tagslist);
546
+ blob_resize(&filename, nPrefix);
547
+ blob_append(&filename, "manifest.tags", -1);
548
+ zName = blob_str(&filename);
549
+ tar_add_file(zName, &tagslist, 0, mTime);
550
+ blob_reset(&tagslist);
551
+ }
516552
}
517553
manifest_file_rewind(pManifest);
518554
while( (pFile = manifest_file_next(pManifest,0))!=0 ){
519555
int fid;
520556
if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue;
521557
--- src/tar.c
+++ src/tar.c
@@ -493,28 +493,64 @@
493 }
494 nPrefix = blob_size(&filename);
495
496 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
497 if( pManifest ){
 
498 mTime = (pManifest->rDate - 2440587.5)*86400.0;
499 tar_begin(mTime);
500 if( (pInclude==0 || glob_match(pInclude, "manifest"))
501 && !glob_match(pExclude, "manifest")
502 && db_get_boolean("manifest", 0)
503 ){
504 blob_append(&filename, "manifest", -1);
505 zName = blob_str(&filename);
506 sha1sum_blob(&mfile, &hash);
507 sterilize_manifest(&mfile);
508 tar_add_file(zName, &mfile, 0, mTime);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509 blob_reset(&mfile);
510 blob_append(&hash, "\n", 1);
511 blob_resize(&filename, nPrefix);
512 blob_append(&filename, "manifest.uuid", -1);
513 zName = blob_str(&filename);
514 tar_add_file(zName, &hash, 0, mTime);
515 blob_reset(&hash);
 
 
 
 
 
 
 
 
 
 
 
 
516 }
517 manifest_file_rewind(pManifest);
518 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
519 int fid;
520 if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue;
521
--- src/tar.c
+++ src/tar.c
@@ -493,28 +493,64 @@
493 }
494 nPrefix = blob_size(&filename);
495
496 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
497 if( pManifest ){
498 int flg, eflg = 0;
499 mTime = (pManifest->rDate - 2440587.5)*86400.0;
500 tar_begin(mTime);
501 flg = db_get_manifest_setting();
502 if( flg ){
503 /* eflg is the effective flags, taking include/exclude into account */
504 if( (pInclude==0 || glob_match(pInclude, "manifest"))
505 && !glob_match(pExclude, "manifest")
506 && (flg & MFESTFLG_RAW) ){
507 eflg |= MFESTFLG_RAW;
508 }
509 if( (pInclude==0 || glob_match(pInclude, "manifest.uuid"))
510 && !glob_match(pExclude, "manifest.uuid")
511 && (flg & MFESTFLG_UUID) ){
512 eflg |= MFESTFLG_UUID;
513 }
514 if( (pInclude==0 || glob_match(pInclude, "manifest.tags"))
515 && !glob_match(pExclude, "manifest.tags")
516 && (flg & MFESTFLG_TAGS) ){
517 eflg |= MFESTFLG_TAGS;
518 }
519
520 if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
521 if( eflg & MFESTFLG_RAW ){
522 blob_append(&filename, "manifest", -1);
523 zName = blob_str(&filename);
524 }
525 if( eflg & MFESTFLG_UUID ){
526 sha1sum_blob(&mfile, &hash);
527 }
528 if( eflg & MFESTFLG_RAW ) {
529 sterilize_manifest(&mfile);
530 tar_add_file(zName, &mfile, 0, mTime);
531 }
532 }
533 blob_reset(&mfile);
534 if( eflg & MFESTFLG_UUID ){
535 blob_append(&hash, "\n", 1);
536 blob_resize(&filename, nPrefix);
537 blob_append(&filename, "manifest.uuid", -1);
538 zName = blob_str(&filename);
539 tar_add_file(zName, &hash, 0, mTime);
540 blob_reset(&hash);
541 }
542 if( eflg & MFESTFLG_TAGS ){
543 Blob tagslist;
544 blob_zero(&tagslist);
545 get_checkin_taglist(rid, &tagslist);
546 blob_resize(&filename, nPrefix);
547 blob_append(&filename, "manifest.tags", -1);
548 zName = blob_str(&filename);
549 tar_add_file(zName, &tagslist, 0, mTime);
550 blob_reset(&tagslist);
551 }
552 }
553 manifest_file_rewind(pManifest);
554 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
555 int fid;
556 if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue;
557
+54 -16
--- src/zip.c
+++ src/zip.c
@@ -350,29 +350,67 @@
350350
}
351351
nPrefix = blob_size(&filename);
352352
353353
pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
354354
if( pManifest ){
355
+ int flg, eflg = 0;
355356
char *zName;
356357
zip_set_timedate(pManifest->rDate);
357
- if( (pInclude==0 || glob_match(pInclude, "manifest"))
358
- && !glob_match(pExclude, "manifest")
359
- && db_get_boolean("manifest", 0)
360
- ){
361
- blob_append(&filename, "manifest", -1);
362
- zName = blob_str(&filename);
363
- zip_add_folders(zName);
364
- sha1sum_blob(&mfile, &hash);
365
- sterilize_manifest(&mfile);
366
- zip_add_file(zName, &mfile, 0);
358
+ flg = db_get_manifest_setting();
359
+ if( flg ){
360
+ /* eflg is the effective flags, taking include/exclude into account */
361
+ if( (pInclude==0 || glob_match(pInclude, "manifest"))
362
+ && !glob_match(pExclude, "manifest")
363
+ && (flg & MFESTFLG_RAW) ){
364
+ eflg |= MFESTFLG_RAW;
365
+ }
366
+ if( (pInclude==0 || glob_match(pInclude, "manifest.uuid"))
367
+ && !glob_match(pExclude, "manifest.uuid")
368
+ && (flg & MFESTFLG_UUID) ){
369
+ eflg |= MFESTFLG_UUID;
370
+ }
371
+ if( (pInclude==0 || glob_match(pInclude, "manifest.tags"))
372
+ && !glob_match(pExclude, "manifest.tags")
373
+ && (flg & MFESTFLG_TAGS) ){
374
+ eflg |= MFESTFLG_TAGS;
375
+ }
376
+
377
+ if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
378
+ if( eflg & MFESTFLG_RAW ){
379
+ blob_append(&filename, "manifest", -1);
380
+ zName = blob_str(&filename);
381
+ zip_add_folders(zName);
382
+ }
383
+ if( eflg & MFESTFLG_UUID ){
384
+ sha1sum_blob(&mfile, &hash);
385
+ }
386
+ if( eflg & MFESTFLG_RAW ){
387
+ sterilize_manifest(&mfile);
388
+ zip_add_file(zName, &mfile, 0);
389
+ }
390
+ }
367391
blob_reset(&mfile);
368
- blob_append(&hash, "\n", 1);
369
- blob_resize(&filename, nPrefix);
370
- blob_append(&filename, "manifest.uuid", -1);
371
- zName = blob_str(&filename);
372
- zip_add_file(zName, &hash, 0);
373
- blob_reset(&hash);
392
+ if( eflg & MFESTFLG_UUID ){
393
+ blob_append(&hash, "\n", 1);
394
+ blob_resize(&filename, nPrefix);
395
+ blob_append(&filename, "manifest.uuid", -1);
396
+ zName = blob_str(&filename);
397
+ zip_add_folders(zName);
398
+ zip_add_file(zName, &hash, 0);
399
+ blob_reset(&hash);
400
+ }
401
+ if( eflg & MFESTFLG_TAGS ){
402
+ Blob tagslist;
403
+ blob_zero(&tagslist);
404
+ get_checkin_taglist(rid, &tagslist);
405
+ blob_resize(&filename, nPrefix);
406
+ blob_append(&filename, "manifest.tags", -1);
407
+ zName = blob_str(&filename);
408
+ zip_add_folders(zName);
409
+ zip_add_file(zName, &tagslist, 0);
410
+ blob_reset(&tagslist);
411
+ }
374412
}
375413
manifest_file_rewind(pManifest);
376414
while( (pFile = manifest_file_next(pManifest,0))!=0 ){
377415
int fid;
378416
if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue;
379417
380418
ADDED test/set-manifest.test
--- src/zip.c
+++ src/zip.c
@@ -350,29 +350,67 @@
350 }
351 nPrefix = blob_size(&filename);
352
353 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
354 if( pManifest ){
 
355 char *zName;
356 zip_set_timedate(pManifest->rDate);
357 if( (pInclude==0 || glob_match(pInclude, "manifest"))
358 && !glob_match(pExclude, "manifest")
359 && db_get_boolean("manifest", 0)
360 ){
361 blob_append(&filename, "manifest", -1);
362 zName = blob_str(&filename);
363 zip_add_folders(zName);
364 sha1sum_blob(&mfile, &hash);
365 sterilize_manifest(&mfile);
366 zip_add_file(zName, &mfile, 0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367 blob_reset(&mfile);
368 blob_append(&hash, "\n", 1);
369 blob_resize(&filename, nPrefix);
370 blob_append(&filename, "manifest.uuid", -1);
371 zName = blob_str(&filename);
372 zip_add_file(zName, &hash, 0);
373 blob_reset(&hash);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374 }
375 manifest_file_rewind(pManifest);
376 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
377 int fid;
378 if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue;
379
380 DDED test/set-manifest.test
--- src/zip.c
+++ src/zip.c
@@ -350,29 +350,67 @@
350 }
351 nPrefix = blob_size(&filename);
352
353 pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0);
354 if( pManifest ){
355 int flg, eflg = 0;
356 char *zName;
357 zip_set_timedate(pManifest->rDate);
358 flg = db_get_manifest_setting();
359 if( flg ){
360 /* eflg is the effective flags, taking include/exclude into account */
361 if( (pInclude==0 || glob_match(pInclude, "manifest"))
362 && !glob_match(pExclude, "manifest")
363 && (flg & MFESTFLG_RAW) ){
364 eflg |= MFESTFLG_RAW;
365 }
366 if( (pInclude==0 || glob_match(pInclude, "manifest.uuid"))
367 && !glob_match(pExclude, "manifest.uuid")
368 && (flg & MFESTFLG_UUID) ){
369 eflg |= MFESTFLG_UUID;
370 }
371 if( (pInclude==0 || glob_match(pInclude, "manifest.tags"))
372 && !glob_match(pExclude, "manifest.tags")
373 && (flg & MFESTFLG_TAGS) ){
374 eflg |= MFESTFLG_TAGS;
375 }
376
377 if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
378 if( eflg & MFESTFLG_RAW ){
379 blob_append(&filename, "manifest", -1);
380 zName = blob_str(&filename);
381 zip_add_folders(zName);
382 }
383 if( eflg & MFESTFLG_UUID ){
384 sha1sum_blob(&mfile, &hash);
385 }
386 if( eflg & MFESTFLG_RAW ){
387 sterilize_manifest(&mfile);
388 zip_add_file(zName, &mfile, 0);
389 }
390 }
391 blob_reset(&mfile);
392 if( eflg & MFESTFLG_UUID ){
393 blob_append(&hash, "\n", 1);
394 blob_resize(&filename, nPrefix);
395 blob_append(&filename, "manifest.uuid", -1);
396 zName = blob_str(&filename);
397 zip_add_folders(zName);
398 zip_add_file(zName, &hash, 0);
399 blob_reset(&hash);
400 }
401 if( eflg & MFESTFLG_TAGS ){
402 Blob tagslist;
403 blob_zero(&tagslist);
404 get_checkin_taglist(rid, &tagslist);
405 blob_resize(&filename, nPrefix);
406 blob_append(&filename, "manifest.tags", -1);
407 zName = blob_str(&filename);
408 zip_add_folders(zName);
409 zip_add_file(zName, &tagslist, 0);
410 blob_reset(&tagslist);
411 }
412 }
413 manifest_file_rewind(pManifest);
414 while( (pFile = manifest_file_next(pManifest,0))!=0 ){
415 int fid;
416 if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue;
417
418 DDED test/set-manifest.test
--- a/test/set-manifest.test
+++ b/test/set-manifest.test
@@ -0,0 +1,113 @@
1
+#
2
+# Copyright (c) 2016 D. Richard Hipp
3
+#
4
+# This program is free software; you can redistribute it and/or
5
+# modify it under the terms of the Simplified BSD License (also
6
+# known as the "2-Clause License" or "FreeBSD License".)
7
+#
8
+# This program is distributed in the hope that it will be useful,
9
+# but without any warranty; without even the implied warranty of
10
+# merchantability or fitness for a particular purpose.
11
+#
12
+# Author contact information:
13
+# [email protected]
14
+# http://www.hwaci.com/drh/
15
+#
16
+############################################################################
17
+#
18
+# Test manifest setting
19
+#
20
+
21
+t (c) 2016 D. Richard Hipp
22
+#
23
+# This program is free software; you can redistribute it and/or
24
+# modify it under the terms of the Simplified BSD License (also
25
+# known as the "2-Clause License" or "FreeBSD License".)
26
+#
27
+# T#
28
+# Copyright (c) 20
29
+
30
+proc file_contains {fname match} {
31
+ set fp [open $fname r]
32
+ set contents [read $fp]
33
+ close $fp
34
+ set lines [split $contents "\n"]
35
+ foreach line $lines {
36
+ if {[regexp $match $line]} {
37
+ return 1
38
+ }
39
+ }
40
+ return 0
41
+}
42
+
43
+# We need SHA1 to effectively test the manifest files produced by
44
+# fossil. It looks like the one from tcllib is exactly what we need.
45
+# On ActiveTcl, add it with teacup. On other platforms, YMMV.
46
+# teacup install sha1
47
+if {[catch {package require sha1}] != 0} then {
48
+ puts "The \"sha1\" package is not available."
49
+ test_cleanup_then_return
50
+}
51
+
52
+# We need a respository, so let it have one.
53
+test_setup
54
+
55
+#### Verify classic behavior of the manifest setting
56
+
57
+# Setting is off by default, and there are no extra files.
58
+fossil settings manifest
59
+test "set-manifest-1" {[regexp {^manifest *$} $RESULT]}
60
+set filelist [$v" {$RESULT eq ""}
61
+ fossi D. Richard Hipp
62
+#
63
+# This program is free software; you can redistribute it and/or
64
+# modify it under the terms of the Simplified BSD License (also
65
+# known as the "2-Clause License" or "FreeBSD License".)
66
+#
67
+# This program is distributed in the hope that it will be useful,
68
+# buithout any warranty; without even the implied warranty of
69
+# mer#
70
+# Copyright manifes$ckid eq $uuid} foreach f $filelist {
71
+ test "set-manifest-2-$v-f-$f" {[file isfile $f]}
72
+ }
73
+}
74
+
75
+# ... and manifest.uuid is the checkout's hash
76
+fossil info
77
+regexp {(?m)^checkout:\s+([0-9a-f]{40,64})\s.*$} $RESULT ckoutline ckid
78
+set uuid [string trim [read_file "manifest.uuid"]]
79
+test "set-manifest-2-uuid" {[same_uuid $ckid $uuid]}
80
+
81
+
82
+# ... which is also the SHA1 of the file "manifest" before it was
83
+#License" or "FreeBSD License0
84
+
85
+proc file_contains {fname match}e "manifest"] "" ma2-manifest" {$muuid eq $uuidequire sha1}] != 0} then close $fp
86
+ set lines [split $contents "\n"]
87
+ foreach line $lines {
88
+ if {[regexp $match $line]} {
89
+ return 1
90
+ }
91
+ }
92
+ return 0
93
+}
94
+
95
+# We need SHA1 to effectively test the manifest files produced by
96
+# fossil. It looks like the one from tcllib is exactly what we need.
97
+# On ActiveTcl, add it with teacup. On other platforms, YMMV.
98
+# teacup install sha1
99
+if {[catch {package require sha1}] != 0} then {
100
+ puts "The \"sha1\" package is not available."
101
+ test_cleanup_then_return
102
+}
103
+
104
+# We need a respository, so let it have one.
105
+test_setup
106
+
107
+#### Verify classic behavior of the manifest setting
108
+
109
+# Setting is off by default, and there are no extra files.
110
+fossil settings manifest
111
+test "set-manifest-1" {[regexp {^manifest *$} $RESULT]}
112
+set filelist [$v" {$RESULT eq ""}
113
+ fossi D. R
--- a/test/set-manifest.test
+++ b/test/set-manifest.test
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/test/set-manifest.test
+++ b/test/set-manifest.test
@@ -0,0 +1,113 @@
1 #
2 # Copyright (c) 2016 D. Richard Hipp
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the Simplified BSD License (also
6 # known as the "2-Clause License" or "FreeBSD License".)
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but without any warranty; without even the implied warranty of
10 # merchantability or fitness for a particular purpose.
11 #
12 # Author contact information:
13 # [email protected]
14 # http://www.hwaci.com/drh/
15 #
16 ############################################################################
17 #
18 # Test manifest setting
19 #
20
21 t (c) 2016 D. Richard Hipp
22 #
23 # This program is free software; you can redistribute it and/or
24 # modify it under the terms of the Simplified BSD License (also
25 # known as the "2-Clause License" or "FreeBSD License".)
26 #
27 # T#
28 # Copyright (c) 20
29
30 proc file_contains {fname match} {
31 set fp [open $fname r]
32 set contents [read $fp]
33 close $fp
34 set lines [split $contents "\n"]
35 foreach line $lines {
36 if {[regexp $match $line]} {
37 return 1
38 }
39 }
40 return 0
41 }
42
43 # We need SHA1 to effectively test the manifest files produced by
44 # fossil. It looks like the one from tcllib is exactly what we need.
45 # On ActiveTcl, add it with teacup. On other platforms, YMMV.
46 # teacup install sha1
47 if {[catch {package require sha1}] != 0} then {
48 puts "The \"sha1\" package is not available."
49 test_cleanup_then_return
50 }
51
52 # We need a respository, so let it have one.
53 test_setup
54
55 #### Verify classic behavior of the manifest setting
56
57 # Setting is off by default, and there are no extra files.
58 fossil settings manifest
59 test "set-manifest-1" {[regexp {^manifest *$} $RESULT]}
60 set filelist [$v" {$RESULT eq ""}
61 fossi D. Richard Hipp
62 #
63 # This program is free software; you can redistribute it and/or
64 # modify it under the terms of the Simplified BSD License (also
65 # known as the "2-Clause License" or "FreeBSD License".)
66 #
67 # This program is distributed in the hope that it will be useful,
68 # buithout any warranty; without even the implied warranty of
69 # mer#
70 # Copyright manifes$ckid eq $uuid} foreach f $filelist {
71 test "set-manifest-2-$v-f-$f" {[file isfile $f]}
72 }
73 }
74
75 # ... and manifest.uuid is the checkout's hash
76 fossil info
77 regexp {(?m)^checkout:\s+([0-9a-f]{40,64})\s.*$} $RESULT ckoutline ckid
78 set uuid [string trim [read_file "manifest.uuid"]]
79 test "set-manifest-2-uuid" {[same_uuid $ckid $uuid]}
80
81
82 # ... which is also the SHA1 of the file "manifest" before it was
83 #License" or "FreeBSD License0
84
85 proc file_contains {fname match}e "manifest"] "" ma2-manifest" {$muuid eq $uuidequire sha1}] != 0} then close $fp
86 set lines [split $contents "\n"]
87 foreach line $lines {
88 if {[regexp $match $line]} {
89 return 1
90 }
91 }
92 return 0
93 }
94
95 # We need SHA1 to effectively test the manifest files produced by
96 # fossil. It looks like the one from tcllib is exactly what we need.
97 # On ActiveTcl, add it with teacup. On other platforms, YMMV.
98 # teacup install sha1
99 if {[catch {package require sha1}] != 0} then {
100 puts "The \"sha1\" package is not available."
101 test_cleanup_then_return
102 }
103
104 # We need a respository, so let it have one.
105 test_setup
106
107 #### Verify classic behavior of the manifest setting
108
109 # Setting is off by default, and there are no extra files.
110 fossil settings manifest
111 test "set-manifest-1" {[regexp {^manifest *$} $RESULT]}
112 set filelist [$v" {$RESULT eq ""}
113 fossi D. R

Keyboard Shortcuts

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