Fossil SCM

Optionally print mtime and mhash in test-show-vfile output.

preben 2024-01-11 16:34 hash-if-mtime-is-current
Commit 25f486135d982906f05e5536c0d43b165ccd82e906dc887fee0db96ee7205e31
1 file changed +18 -6
+18 -6
--- src/merge.c
+++ src/merge.c
@@ -218,17 +218,18 @@
218218
219219
/*
220220
** Print the content of the VFILE table on standard output, for
221221
** debugging purposes.
222222
*/
223
-static void debug_show_vfile(void){
223
+static void debug_show_vfile(int shoeAll){
224224
Stmt q;
225225
int pvid = -1;
226226
db_prepare(&q,
227227
"SELECT vid, id, chnged, deleted, isexe, islink, rid, mrid, mtime,"
228
- " pathname, origname, mhash FROM vfile"
229
- " ORDER BY vid, pathname"
228
+ " pathname, origname, mhash, %s FROM vfile"
229
+ " ORDER BY vid, pathname",
230
+ shoeAll ? "COALESCE(datetime(mtime, 'unixepoch', 'localtime'), 'NULL')" : "''"
230231
);
231232
while( db_step(&q)==SQLITE_ROW ){
232233
int vid = db_column_int(&q, 0);
233234
int chnged = db_column_int(&q, 2);
234235
int dltd = db_column_int(&q, 3);
@@ -252,27 +253,35 @@
252253
if( zOrig && zOrig[0] ){
253254
fossil_print(" <- %s\n", zOrig);
254255
}else{
255256
fossil_print("\n");
256257
}
258
+ if( shoeAll ){
259
+ fossil_print(" mtime %19s / %-10i mhash %s\n", db_column_text(&q, 12),
260
+ db_column_int(&q , 8), db_column_text(&q, 11));
261
+ }
257262
}
258263
db_finalize(&q);
259264
}
260265
261266
/*
262267
** COMMAND: test-show-vfile
263268
** Usage: %fossil test-show-vfile
264269
**
270
+** Options:
271
+** --all Show all fields
272
+**
265273
** Show the content of the VFILE table in a local check-out.
266274
*/
267275
void test_show_vfile_cmd(void){
276
+ int showVfileAll = find_option("mtime",0,0)!=0;
268277
if( g.argc!=2 ){
269278
fossil_fatal("unknown arguments to the %s command\n", g.argv[1]);
270279
}
271280
verify_all_options();
272281
db_must_be_within_tree();
273
- debug_show_vfile();
282
+ debug_show_vfile(showVfileAll);
274283
}
275284
276285
277286
/*
278287
** COMMAND: merge
@@ -333,10 +342,11 @@
333342
int forceMissingFlag; /* True if the --force-missing option is present */
334343
const char *zBinGlob; /* The value of --binary */
335344
const char *zPivot; /* The value of --baseline */
336345
int debugFlag; /* True if --debug is present */
337346
int showVfileFlag; /* True if the --show-vfile flag is present */
347
+ int showVfileAll; /* True if the --show-vfile-all flag is present */
338348
int keepMergeFlag; /* True if --keep-merge-files is present */
339349
int nConflict = 0; /* Number of conflicts seen */
340350
int nOverwrite = 0; /* Number of unmanaged files overwritten */
341351
char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
342352
Stmt q;
@@ -369,25 +379,27 @@
369379
}
370380
forceFlag = find_option("force","f",0)!=0;
371381
zPivot = find_option("baseline",0,1);
372382
keepMergeFlag = find_option("keep-merge-files", "K",0)!=0;
373383
374
- /* Undocumented --debug and --show-vfile options:
384
+ /* Undocumented --debug, --show-vfile, --show-vfile-all options:
375385
**
376386
** When included on the command-line, --debug causes lots of state
377387
** information to be displayed. This option is undocumented as it
378388
** might change or be eliminated in future releases.
379389
**
380390
** The --show-vfile flag does a dump of the VFILE table for reference.
391
+ ** The --show-vfile-all shows all fields from the VFILE table.
381392
**
382393
** Hints:
383394
** * Combine --debug and --verbose for still more output.
384395
** * The --dry-run option is also useful in combination with --debug.
385396
*/
386397
debugFlag = find_option("debug",0,0)!=0;
387398
if( debugFlag && verboseFlag ) debugFlag = 2;
388399
showVfileFlag = find_option("show-vfile",0,0)!=0;
400
+ showVfileAll = find_option("show-vfile-all",0,0)!=0;
389401
390402
verify_all_options();
391403
db_must_be_within_tree();
392404
if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
393405
vid = db_lget_int("checkout", 0);
@@ -555,11 +567,11 @@
555567
fossil_print("M=%-4d %z (merged-in version)\n", mid, z);
556568
z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
557569
fossil_print("V=%-4d %z (current version)\n", vid, z);
558570
fossil_print("vAncestor = '%c'\n", vAncestor);
559571
}
560
- if( showVfileFlag ) debug_show_vfile();
572
+ if( showVfileFlag || showVfileAll ) debug_show_vfile(showVfileAll);
561573
562574
/*
563575
** The vfile.pathname field is used to match files against each other. The
564576
** FV table contains one row for each each unique filename in
565577
** in the current check-out, the pivot, and the version being merged.
566578
--- src/merge.c
+++ src/merge.c
@@ -218,17 +218,18 @@
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);
@@ -252,27 +253,35 @@
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
@@ -333,10 +342,11 @@
333 int forceMissingFlag; /* True if the --force-missing option is present */
334 const char *zBinGlob; /* The value of --binary */
335 const char *zPivot; /* The value of --baseline */
336 int debugFlag; /* True if --debug is present */
337 int showVfileFlag; /* True if the --show-vfile flag is present */
 
338 int keepMergeFlag; /* True if --keep-merge-files is present */
339 int nConflict = 0; /* Number of conflicts seen */
340 int nOverwrite = 0; /* Number of unmanaged files overwritten */
341 char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
342 Stmt q;
@@ -369,25 +379,27 @@
369 }
370 forceFlag = find_option("force","f",0)!=0;
371 zPivot = find_option("baseline",0,1);
372 keepMergeFlag = find_option("keep-merge-files", "K",0)!=0;
373
374 /* Undocumented --debug and --show-vfile options:
375 **
376 ** When included on the command-line, --debug causes lots of state
377 ** information to be displayed. This option is undocumented as it
378 ** might change or be eliminated in future releases.
379 **
380 ** The --show-vfile flag does a dump of the VFILE table for reference.
 
381 **
382 ** Hints:
383 ** * Combine --debug and --verbose for still more output.
384 ** * The --dry-run option is also useful in combination with --debug.
385 */
386 debugFlag = find_option("debug",0,0)!=0;
387 if( debugFlag && verboseFlag ) debugFlag = 2;
388 showVfileFlag = find_option("show-vfile",0,0)!=0;
 
389
390 verify_all_options();
391 db_must_be_within_tree();
392 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
393 vid = db_lget_int("checkout", 0);
@@ -555,11 +567,11 @@
555 fossil_print("M=%-4d %z (merged-in version)\n", mid, z);
556 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
557 fossil_print("V=%-4d %z (current version)\n", vid, z);
558 fossil_print("vAncestor = '%c'\n", vAncestor);
559 }
560 if( showVfileFlag ) debug_show_vfile();
561
562 /*
563 ** The vfile.pathname field is used to match files against each other. The
564 ** FV table contains one row for each each unique filename in
565 ** in the current check-out, the pivot, and the version being merged.
566
--- src/merge.c
+++ src/merge.c
@@ -218,17 +218,18 @@
218
219 /*
220 ** Print the content of the VFILE table on standard output, for
221 ** debugging purposes.
222 */
223 static void debug_show_vfile(int shoeAll){
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, %s FROM vfile"
229 " ORDER BY vid, pathname",
230 shoeAll ? "COALESCE(datetime(mtime, 'unixepoch', 'localtime'), 'NULL')" : "''"
231 );
232 while( db_step(&q)==SQLITE_ROW ){
233 int vid = db_column_int(&q, 0);
234 int chnged = db_column_int(&q, 2);
235 int dltd = db_column_int(&q, 3);
@@ -252,27 +253,35 @@
253 if( zOrig && zOrig[0] ){
254 fossil_print(" <- %s\n", zOrig);
255 }else{
256 fossil_print("\n");
257 }
258 if( shoeAll ){
259 fossil_print(" mtime %19s / %-10i mhash %s\n", db_column_text(&q, 12),
260 db_column_int(&q , 8), db_column_text(&q, 11));
261 }
262 }
263 db_finalize(&q);
264 }
265
266 /*
267 ** COMMAND: test-show-vfile
268 ** Usage: %fossil test-show-vfile
269 **
270 ** Options:
271 ** --all Show all fields
272 **
273 ** Show the content of the VFILE table in a local check-out.
274 */
275 void test_show_vfile_cmd(void){
276 int showVfileAll = find_option("mtime",0,0)!=0;
277 if( g.argc!=2 ){
278 fossil_fatal("unknown arguments to the %s command\n", g.argv[1]);
279 }
280 verify_all_options();
281 db_must_be_within_tree();
282 debug_show_vfile(showVfileAll);
283 }
284
285
286 /*
287 ** COMMAND: merge
@@ -333,10 +342,11 @@
342 int forceMissingFlag; /* True if the --force-missing option is present */
343 const char *zBinGlob; /* The value of --binary */
344 const char *zPivot; /* The value of --baseline */
345 int debugFlag; /* True if --debug is present */
346 int showVfileFlag; /* True if the --show-vfile flag is present */
347 int showVfileAll; /* True if the --show-vfile-all flag is present */
348 int keepMergeFlag; /* True if --keep-merge-files is present */
349 int nConflict = 0; /* Number of conflicts seen */
350 int nOverwrite = 0; /* Number of unmanaged files overwritten */
351 char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
352 Stmt q;
@@ -369,25 +379,27 @@
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, --show-vfile, --show-vfile-all 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 ** The --show-vfile-all shows all fields from the VFILE table.
392 **
393 ** Hints:
394 ** * Combine --debug and --verbose for still more output.
395 ** * The --dry-run option is also useful in combination with --debug.
396 */
397 debugFlag = find_option("debug",0,0)!=0;
398 if( debugFlag && verboseFlag ) debugFlag = 2;
399 showVfileFlag = find_option("show-vfile",0,0)!=0;
400 showVfileAll = find_option("show-vfile-all",0,0)!=0;
401
402 verify_all_options();
403 db_must_be_within_tree();
404 if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
405 vid = db_lget_int("checkout", 0);
@@ -555,11 +567,11 @@
567 fossil_print("M=%-4d %z (merged-in version)\n", mid, z);
568 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
569 fossil_print("V=%-4d %z (current version)\n", vid, z);
570 fossil_print("vAncestor = '%c'\n", vAncestor);
571 }
572 if( showVfileFlag || showVfileAll ) debug_show_vfile(showVfileAll);
573
574 /*
575 ** The vfile.pathname field is used to match files against each other. The
576 ** FV table contains one row for each each unique filename in
577 ** in the current check-out, the pivot, and the version being merged.
578

Keyboard Shortcuts

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