125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
/*
** If the "manifest" setting is true, then automatically generate
** files named "manifest" and "manifest.uuid" containing, respectively,
** the text of the manifest and the artifact ID of the manifest.
** If the manifest setting is set, but is not a boolean value, then treat
** each character as a flag to enable writing "manifest", "manifest.uuid" or
** "manifest.tags".
*/
void manifest_to_disk(int vid){
char *zManFile;
Blob manifest;
Blob hash;
Blob taglist;
int flg;
if( db_get_boolean("manifest",0) ){
blob_zero(&manifest);
content_get(vid, &manifest);
zManFile = mprintf("%smanifest", g.zLocalRoot);
blob_zero(&hash);
sha1sum_blob(&manifest, &hash);
sterilize_manifest(&manifest);
blob_write_to_file(&manifest, zManFile);
free(zManFile);
zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
blob_append(&hash, "\n", 1);
blob_write_to_file(&hash, zManFile);
free(zManFile);
blob_reset(&hash);
flg = db_get_manifest_setting();
if( flg ){
if( flg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
blob_zero(&manifest);
content_get(vid, &manifest);
zManFile = mprintf("%smanifest", g.zLocalRoot);
blob_zero(&hash);
sha1sum_blob(&manifest, &hash);
sterilize_manifest(&manifest);
if( flg & MFESTFLG_RAW ){
blob_write_to_file(&manifest, zManFile);
}
free(zManFile);
}
if( flg & MFESTFLG_UUID ){
zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
blob_append(&hash, "\n", 1);
blob_write_to_file(&hash, zManFile);
free(zManFile);
blob_reset(&hash);
}
if( flg & MFESTFLG_TAGS ){
blob_zero(&taglist);
zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
get_checkin_taglist(vid, &taglist);
blob_write_to_file(&taglist, zManFile);
free(zManFile);
}
}else{
if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){
zManFile = mprintf("%smanifest", g.zLocalRoot);
file_delete(zManFile);
free(zManFile);
}
if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){
zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
file_delete(zManFile);
free(zManFile);
}
if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.tags'") ){
zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
file_delete(zManFile);
free(zManFile);
}
}
}
}
}
void get_checkin_taglist(int rid, Blob *pOut){
char *zTags;
Stmt stmt;
blob_reset(pOut);
db_prepare(&stmt, "SELECT substr(tagname, 5)"
" FROM tagxref, tag"
" WHERE tagxref.rid=%d"
" AND tag.tagid=tagxref.tagid"
" AND tag.tagname GLOB 'sym-*'", rid);
while( db_step(&stmt)==SQLITE_ROW ){
const char *zName;
zName = db_column_text(&stmt, 0);
blob_appendf(pOut, "%s\n", zName);
}
db_reset(&stmt);
}
/*
** COMMAND: checkout*
** COMMAND: co*
**
** Usage: %fossil checkout ?VERSION | --latest? ?OPTIONS?
** or: %fossil co ?VERSION | --latest? ?OPTIONS?
|