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.
Commit
f35eb8e2c9f8a8f82e2ea5c5d6ca575fa142b2610b7d4f4bc5c5f6c29c614c36
Parent
0d4d85b05d45a03…
1 file changed
+63
-1
+63
-1
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -214,10 +214,67 @@ | ||
| 214 | 214 | fossil_print(" fnn = [%s]\n", db_column_text(&q, 11)); |
| 215 | 215 | } |
| 216 | 216 | db_finalize(&q); |
| 217 | 217 | } |
| 218 | 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 | + | |
| 219 | 276 | |
| 220 | 277 | /* |
| 221 | 278 | ** COMMAND: merge |
| 222 | 279 | ** |
| 223 | 280 | ** Usage: %fossil merge ?OPTIONS? ?VERSION? |
| @@ -288,10 +345,11 @@ | ||
| 288 | 345 | int forceFlag; /* True if the --force or -f option is present */ |
| 289 | 346 | int forceMissingFlag; /* True if the --force-missing option is present */ |
| 290 | 347 | const char *zBinGlob; /* The value of --binary */ |
| 291 | 348 | const char *zPivot; /* The value of --baseline */ |
| 292 | 349 | int debugFlag; /* True if --debug is present */ |
| 350 | + int showVfileFlag; /* True if the --show-vfile flag is present */ | |
| 293 | 351 | int keepMergeFlag; /* True if --keep-merge-files is present */ |
| 294 | 352 | int nConflict = 0; /* Number of conflicts seen */ |
| 295 | 353 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| 296 | 354 | char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */ |
| 297 | 355 | Stmt q; |
| @@ -321,22 +379,25 @@ | ||
| 321 | 379 | } |
| 322 | 380 | forceFlag = find_option("force","f",0)!=0; |
| 323 | 381 | zPivot = find_option("baseline",0,1); |
| 324 | 382 | keepMergeFlag = find_option("keep-merge-files", "K",0)!=0; |
| 325 | 383 | |
| 326 | - /* Undocumented --debug option: | |
| 384 | + /* Undocumented --debug and --show-vfile options: | |
| 327 | 385 | ** |
| 328 | 386 | ** When included on the command-line, --debug causes lots of state |
| 329 | 387 | ** information to be displayed. This option is undocumented as it |
| 330 | 388 | ** might change or be eliminated in future releases. |
| 389 | + ** | |
| 390 | + ** The --show-vfile flag does a dump of the VFILE table for reference. | |
| 331 | 391 | ** |
| 332 | 392 | ** Hints: |
| 333 | 393 | ** * Combine --debug and --verbose for still more output. |
| 334 | 394 | ** * The --dry-run option is also useful in combination with --debug. |
| 335 | 395 | */ |
| 336 | 396 | debugFlag = find_option("debug",0,0)!=0; |
| 337 | 397 | if( debugFlag && verboseFlag ) debugFlag = 2; |
| 398 | + showVfileFlag = find_option("show-vfile",0,0)!=0; | |
| 338 | 399 | |
| 339 | 400 | verify_all_options(); |
| 340 | 401 | db_must_be_within_tree(); |
| 341 | 402 | if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0); |
| 342 | 403 | vid = db_lget_int("checkout", 0); |
| @@ -502,10 +563,11 @@ | ||
| 502 | 563 | fossil_print("M=%-4d %z (merged-in version)\n", mid, z); |
| 503 | 564 | z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid); |
| 504 | 565 | fossil_print("V=%-4d %z (current version)\n", vid, z); |
| 505 | 566 | fossil_print("vAncestor = '%c'\n", vAncestor); |
| 506 | 567 | } |
| 568 | + if( showVfileFlag ) debug_show_vfile(); | |
| 507 | 569 | |
| 508 | 570 | /* |
| 509 | 571 | ** The vfile.pathname field is used to match files against each other. The |
| 510 | 572 | ** FV table contains one row for each each unique filename in |
| 511 | 573 | ** in the current checkout, the pivot, and the version being merged. |
| 512 | 574 |
| --- 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 |