Fossil SCM

Add the "fossil test-show-vfile" command, and the (undocumented) --show-vfile option on "fossil merge". Both additions are for debugging use only and are unsupported.

drh 2021-04-15 15:48 trunk
Commit f35eb8e2c9f8a8f82e2ea5c5d6ca575fa142b2610b7d4f4bc5c5f6c29c614c36
1 file changed +63 -1
+63 -1
--- src/merge.c
+++ src/merge.c
@@ -214,10 +214,67 @@
214214
fossil_print(" fnn = [%s]\n", db_column_text(&q, 11));
215215
}
216216
db_finalize(&q);
217217
}
218218
219
+/*
220
+** Print the content of the VFILE table on standard output, for
221
+** debugging purposes.
222
+*/
223
+static void debug_show_vfile(void){
224
+ Stmt q;
225
+ int pvid = -1;
226
+ db_prepare(&q,
227
+ "SELECT vid, id, chnged, deleted, isexe, islink, rid, mrid, mtime,"
228
+ " pathname, origname, mhash FROM vfile"
229
+ " ORDER BY vid, pathname"
230
+ );
231
+ while( db_step(&q)==SQLITE_ROW ){
232
+ int vid = db_column_int(&q, 0);
233
+ int chnged = db_column_int(&q, 2);
234
+ int dltd = db_column_int(&q, 3);
235
+ int isexe = db_column_int(&q, 4);
236
+ int islnk = db_column_int(&q, 5);
237
+ int rid = db_column_int(&q, 6);
238
+ int mrid = db_column_int(&q, 7);
239
+ const char *zPath = db_column_text(&q, 9);
240
+ const char *zOrig = db_column_text(&q, 10);
241
+ if( vid!=pvid ){
242
+ fossil_print("VFILE vid=%d (%z):\n", vid,
243
+ db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid));
244
+ pvid = vid;
245
+ }
246
+ fossil_print(" rid %-6d mrid %-6d %4s %3s %3s %3s %s",
247
+ rid, mrid,
248
+ chnged ? "chng" : "",
249
+ dltd ? "del" : "",
250
+ isexe ? "exe" : "",
251
+ islnk ? "lnk" : "", zPath);
252
+ if( zOrig && zOrig[0] ){
253
+ fossil_print(" <- %s\n", zOrig);
254
+ }else{
255
+ fossil_print("\n");
256
+ }
257
+ }
258
+ db_finalize(&q);
259
+}
260
+
261
+/*
262
+** COMMAND: test-show-vfile
263
+** Usage: %fossil test-show-vfile
264
+**
265
+** Show the content of the VFILE table in a local check-out.
266
+*/
267
+void test_show_vfile_cmd(void){
268
+ if( g.argc!=2 ){
269
+ fossil_fatal("unknown arguments to the %s command\n", g.argv[1]);
270
+ }
271
+ verify_all_options();
272
+ db_must_be_within_tree();
273
+ debug_show_vfile();
274
+}
275
+
219276
220277
/*
221278
** COMMAND: merge
222279
**
223280
** Usage: %fossil merge ?OPTIONS? ?VERSION?
@@ -288,10 +345,11 @@
288345
int forceFlag; /* True if the --force or -f option is present */
289346
int forceMissingFlag; /* True if the --force-missing option is present */
290347
const char *zBinGlob; /* The value of --binary */
291348
const char *zPivot; /* The value of --baseline */
292349
int debugFlag; /* True if --debug is present */
350
+ int showVfileFlag; /* True if the --show-vfile flag is present */
293351
int keepMergeFlag; /* True if --keep-merge-files is present */
294352
int nConflict = 0; /* Number of conflicts seen */
295353
int nOverwrite = 0; /* Number of unmanaged files overwritten */
296354
char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
297355
Stmt q;
@@ -321,22 +379,25 @@
321379
}
322380
forceFlag = find_option("force","f",0)!=0;
323381
zPivot = find_option("baseline",0,1);
324382
keepMergeFlag = find_option("keep-merge-files", "K",0)!=0;
325383
326
- /* Undocumented --debug option:
384
+ /* Undocumented --debug and --show-vfile options:
327385
**
328386
** When included on the command-line, --debug causes lots of state
329387
** information to be displayed. This option is undocumented as it
330388
** might change or be eliminated in future releases.
389
+ **
390
+ ** The --show-vfile flag does a dump of the VFILE table for reference.
331391
**
332392
** Hints:
333393
** * Combine --debug and --verbose for still more output.
334394
** * The --dry-run option is also useful in combination with --debug.
335395
*/
336396
debugFlag = find_option("debug",0,0)!=0;
337397
if( debugFlag && verboseFlag ) debugFlag = 2;
398
+ showVfileFlag = find_option("show-vfile",0,0)!=0;
338399
339400
verify_all_options();
340401
db_must_be_within_tree();
341402
if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
342403
vid = db_lget_int("checkout", 0);
@@ -502,10 +563,11 @@
502563
fossil_print("M=%-4d %z (merged-in version)\n", mid, z);
503564
z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
504565
fossil_print("V=%-4d %z (current version)\n", vid, z);
505566
fossil_print("vAncestor = '%c'\n", vAncestor);
506567
}
568
+ if( showVfileFlag ) debug_show_vfile();
507569
508570
/*
509571
** The vfile.pathname field is used to match files against each other. The
510572
** FV table contains one row for each each unique filename in
511573
** in the current checkout, the pivot, and the version being merged.
512574
--- src/merge.c
+++ src/merge.c
@@ -214,10 +214,67 @@
214 fossil_print(" fnn = [%s]\n", db_column_text(&q, 11));
215 }
216 db_finalize(&q);
217 }
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
220 /*
221 ** COMMAND: merge
222 **
223 ** Usage: %fossil merge ?OPTIONS? ?VERSION?
@@ -288,10 +345,11 @@
288 int forceFlag; /* True if the --force or -f option is present */
289 int forceMissingFlag; /* True if the --force-missing option is present */
290 const char *zBinGlob; /* The value of --binary */
291 const char *zPivot; /* The value of --baseline */
292 int debugFlag; /* True if --debug is present */
 
293 int keepMergeFlag; /* True if --keep-merge-files is present */
294 int nConflict = 0; /* Number of conflicts seen */
295 int nOverwrite = 0; /* Number of unmanaged files overwritten */
296 char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
297 Stmt q;
@@ -321,22 +379,25 @@
321 }
322 forceFlag = find_option("force","f",0)!=0;
323 zPivot = find_option("baseline",0,1);
324 keepMergeFlag = find_option("keep-merge-files", "K",0)!=0;
325
326 /* Undocumented --debug option:
327 **
328 ** When included on the command-line, --debug causes lots of state
329 ** information to be displayed. This option is undocumented as it
330 ** might change or be eliminated in future releases.
 
 
331 **
332 ** Hints:
333 ** * Combine --debug and --verbose for still more output.
334 ** * The --dry-run option is also useful in combination with --debug.
335 */
336 debugFlag = find_option("debug",0,0)!=0;
337 if( debugFlag && verboseFlag ) debugFlag = 2;
 
338
339 verify_all_options();
340 db_must_be_within_tree();
341 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
342 vid = db_lget_int("checkout", 0);
@@ -502,10 +563,11 @@
502 fossil_print("M=%-4d %z (merged-in version)\n", mid, z);
503 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
504 fossil_print("V=%-4d %z (current version)\n", vid, z);
505 fossil_print("vAncestor = '%c'\n", vAncestor);
506 }
 
507
508 /*
509 ** The vfile.pathname field is used to match files against each other. The
510 ** FV table contains one row for each each unique filename in
511 ** in the current checkout, the pivot, and the version being merged.
512
--- src/merge.c
+++ src/merge.c
@@ -214,10 +214,67 @@
214 fossil_print(" fnn = [%s]\n", db_column_text(&q, 11));
215 }
216 db_finalize(&q);
217 }
218
219 /*
220 ** Print the content of the VFILE table on standard output, for
221 ** debugging purposes.
222 */
223 static void debug_show_vfile(void){
224 Stmt q;
225 int pvid = -1;
226 db_prepare(&q,
227 "SELECT vid, id, chnged, deleted, isexe, islink, rid, mrid, mtime,"
228 " pathname, origname, mhash FROM vfile"
229 " ORDER BY vid, pathname"
230 );
231 while( db_step(&q)==SQLITE_ROW ){
232 int vid = db_column_int(&q, 0);
233 int chnged = db_column_int(&q, 2);
234 int dltd = db_column_int(&q, 3);
235 int isexe = db_column_int(&q, 4);
236 int islnk = db_column_int(&q, 5);
237 int rid = db_column_int(&q, 6);
238 int mrid = db_column_int(&q, 7);
239 const char *zPath = db_column_text(&q, 9);
240 const char *zOrig = db_column_text(&q, 10);
241 if( vid!=pvid ){
242 fossil_print("VFILE vid=%d (%z):\n", vid,
243 db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid));
244 pvid = vid;
245 }
246 fossil_print(" rid %-6d mrid %-6d %4s %3s %3s %3s %s",
247 rid, mrid,
248 chnged ? "chng" : "",
249 dltd ? "del" : "",
250 isexe ? "exe" : "",
251 islnk ? "lnk" : "", zPath);
252 if( zOrig && zOrig[0] ){
253 fossil_print(" <- %s\n", zOrig);
254 }else{
255 fossil_print("\n");
256 }
257 }
258 db_finalize(&q);
259 }
260
261 /*
262 ** COMMAND: test-show-vfile
263 ** Usage: %fossil test-show-vfile
264 **
265 ** Show the content of the VFILE table in a local check-out.
266 */
267 void test_show_vfile_cmd(void){
268 if( g.argc!=2 ){
269 fossil_fatal("unknown arguments to the %s command\n", g.argv[1]);
270 }
271 verify_all_options();
272 db_must_be_within_tree();
273 debug_show_vfile();
274 }
275
276
277 /*
278 ** COMMAND: merge
279 **
280 ** Usage: %fossil merge ?OPTIONS? ?VERSION?
@@ -288,10 +345,11 @@
345 int forceFlag; /* True if the --force or -f option is present */
346 int forceMissingFlag; /* True if the --force-missing option is present */
347 const char *zBinGlob; /* The value of --binary */
348 const char *zPivot; /* The value of --baseline */
349 int debugFlag; /* True if --debug is present */
350 int showVfileFlag; /* True if the --show-vfile flag is present */
351 int keepMergeFlag; /* True if --keep-merge-files is present */
352 int nConflict = 0; /* Number of conflicts seen */
353 int nOverwrite = 0; /* Number of unmanaged files overwritten */
354 char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
355 Stmt q;
@@ -321,22 +379,25 @@
379 }
380 forceFlag = find_option("force","f",0)!=0;
381 zPivot = find_option("baseline",0,1);
382 keepMergeFlag = find_option("keep-merge-files", "K",0)!=0;
383
384 /* Undocumented --debug and --show-vfile options:
385 **
386 ** When included on the command-line, --debug causes lots of state
387 ** information to be displayed. This option is undocumented as it
388 ** might change or be eliminated in future releases.
389 **
390 ** The --show-vfile flag does a dump of the VFILE table for reference.
391 **
392 ** Hints:
393 ** * Combine --debug and --verbose for still more output.
394 ** * The --dry-run option is also useful in combination with --debug.
395 */
396 debugFlag = find_option("debug",0,0)!=0;
397 if( debugFlag && verboseFlag ) debugFlag = 2;
398 showVfileFlag = find_option("show-vfile",0,0)!=0;
399
400 verify_all_options();
401 db_must_be_within_tree();
402 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
403 vid = db_lget_int("checkout", 0);
@@ -502,10 +563,11 @@
563 fossil_print("M=%-4d %z (merged-in version)\n", mid, z);
564 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
565 fossil_print("V=%-4d %z (current version)\n", vid, z);
566 fossil_print("vAncestor = '%c'\n", vAncestor);
567 }
568 if( showVfileFlag ) debug_show_vfile();
569
570 /*
571 ** The vfile.pathname field is used to match files against each other. The
572 ** FV table contains one row for each each unique filename in
573 ** in the current checkout, the pivot, and the version being merged.
574

Keyboard Shortcuts

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