Fossil SCM
Optionally print mtime and mhash in test-show-vfile output.
Commit
25f486135d982906f05e5536c0d43b165ccd82e906dc887fee0db96ee7205e31
Parent
f0aa85e302ee674…
1 file changed
+18
-6
+18
-6
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -218,17 +218,18 @@ | ||
| 218 | 218 | |
| 219 | 219 | /* |
| 220 | 220 | ** Print the content of the VFILE table on standard output, for |
| 221 | 221 | ** debugging purposes. |
| 222 | 222 | */ |
| 223 | -static void debug_show_vfile(void){ | |
| 223 | +static void debug_show_vfile(int shoeAll){ | |
| 224 | 224 | Stmt q; |
| 225 | 225 | int pvid = -1; |
| 226 | 226 | db_prepare(&q, |
| 227 | 227 | "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')" : "''" | |
| 230 | 231 | ); |
| 231 | 232 | while( db_step(&q)==SQLITE_ROW ){ |
| 232 | 233 | int vid = db_column_int(&q, 0); |
| 233 | 234 | int chnged = db_column_int(&q, 2); |
| 234 | 235 | int dltd = db_column_int(&q, 3); |
| @@ -252,27 +253,35 @@ | ||
| 252 | 253 | if( zOrig && zOrig[0] ){ |
| 253 | 254 | fossil_print(" <- %s\n", zOrig); |
| 254 | 255 | }else{ |
| 255 | 256 | fossil_print("\n"); |
| 256 | 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 | + } | |
| 257 | 262 | } |
| 258 | 263 | db_finalize(&q); |
| 259 | 264 | } |
| 260 | 265 | |
| 261 | 266 | /* |
| 262 | 267 | ** COMMAND: test-show-vfile |
| 263 | 268 | ** Usage: %fossil test-show-vfile |
| 264 | 269 | ** |
| 270 | +** Options: | |
| 271 | +** --all Show all fields | |
| 272 | +** | |
| 265 | 273 | ** Show the content of the VFILE table in a local check-out. |
| 266 | 274 | */ |
| 267 | 275 | void test_show_vfile_cmd(void){ |
| 276 | + int showVfileAll = find_option("mtime",0,0)!=0; | |
| 268 | 277 | if( g.argc!=2 ){ |
| 269 | 278 | fossil_fatal("unknown arguments to the %s command\n", g.argv[1]); |
| 270 | 279 | } |
| 271 | 280 | verify_all_options(); |
| 272 | 281 | db_must_be_within_tree(); |
| 273 | - debug_show_vfile(); | |
| 282 | + debug_show_vfile(showVfileAll); | |
| 274 | 283 | } |
| 275 | 284 | |
| 276 | 285 | |
| 277 | 286 | /* |
| 278 | 287 | ** COMMAND: merge |
| @@ -333,10 +342,11 @@ | ||
| 333 | 342 | int forceMissingFlag; /* True if the --force-missing option is present */ |
| 334 | 343 | const char *zBinGlob; /* The value of --binary */ |
| 335 | 344 | const char *zPivot; /* The value of --baseline */ |
| 336 | 345 | int debugFlag; /* True if --debug is present */ |
| 337 | 346 | int showVfileFlag; /* True if the --show-vfile flag is present */ |
| 347 | + int showVfileAll; /* True if the --show-vfile-all flag is present */ | |
| 338 | 348 | int keepMergeFlag; /* True if --keep-merge-files is present */ |
| 339 | 349 | int nConflict = 0; /* Number of conflicts seen */ |
| 340 | 350 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| 341 | 351 | char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */ |
| 342 | 352 | Stmt q; |
| @@ -369,25 +379,27 @@ | ||
| 369 | 379 | } |
| 370 | 380 | forceFlag = find_option("force","f",0)!=0; |
| 371 | 381 | zPivot = find_option("baseline",0,1); |
| 372 | 382 | keepMergeFlag = find_option("keep-merge-files", "K",0)!=0; |
| 373 | 383 | |
| 374 | - /* Undocumented --debug and --show-vfile options: | |
| 384 | + /* Undocumented --debug, --show-vfile, --show-vfile-all options: | |
| 375 | 385 | ** |
| 376 | 386 | ** When included on the command-line, --debug causes lots of state |
| 377 | 387 | ** information to be displayed. This option is undocumented as it |
| 378 | 388 | ** might change or be eliminated in future releases. |
| 379 | 389 | ** |
| 380 | 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. | |
| 381 | 392 | ** |
| 382 | 393 | ** Hints: |
| 383 | 394 | ** * Combine --debug and --verbose for still more output. |
| 384 | 395 | ** * The --dry-run option is also useful in combination with --debug. |
| 385 | 396 | */ |
| 386 | 397 | debugFlag = find_option("debug",0,0)!=0; |
| 387 | 398 | if( debugFlag && verboseFlag ) debugFlag = 2; |
| 388 | 399 | showVfileFlag = find_option("show-vfile",0,0)!=0; |
| 400 | + showVfileAll = find_option("show-vfile-all",0,0)!=0; | |
| 389 | 401 | |
| 390 | 402 | verify_all_options(); |
| 391 | 403 | db_must_be_within_tree(); |
| 392 | 404 | if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0); |
| 393 | 405 | vid = db_lget_int("checkout", 0); |
| @@ -555,11 +567,11 @@ | ||
| 555 | 567 | fossil_print("M=%-4d %z (merged-in version)\n", mid, z); |
| 556 | 568 | z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| 557 | 569 | fossil_print("V=%-4d %z (current version)\n", vid, z); |
| 558 | 570 | fossil_print("vAncestor = '%c'\n", vAncestor); |
| 559 | 571 | } |
| 560 | - if( showVfileFlag ) debug_show_vfile(); | |
| 572 | + if( showVfileFlag || showVfileAll ) debug_show_vfile(showVfileAll); | |
| 561 | 573 | |
| 562 | 574 | /* |
| 563 | 575 | ** The vfile.pathname field is used to match files against each other. The |
| 564 | 576 | ** FV table contains one row for each each unique filename in |
| 565 | 577 | ** in the current check-out, the pivot, and the version being merged. |
| 566 | 578 |
| --- 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 |