Fossil SCM

Add the -v/--verbose option to the "fossil merge-info" command.

drh 2026-06-22 15:34 UTC trunk
Commit 3c8de67618e6557c3a59a9ee71809dd423f72ae5a0e5b0a10e2983c98e121eed
1 file changed +61 -21
+61 -21
--- src/merge.c
+++ src/merge.c
@@ -300,10 +300,11 @@
300300
** lines are shown
301301
** -c|--context N Show N lines of context around each change,
302302
** with negative N meaning show all content. Only
303303
** meaningful in combination with --tcl or --tk.
304304
** --dark Use dark mode for the Tcl/Tk-based GUI
305
+** -v|--verbose Show extra information about each merge operation
305306
** --tk Bring up a Tcl/Tk GUI that shows the changes
306307
** associated with the most recent merge.
307308
**
308309
** Options used internally by --tk:
309310
** --diff12 FILE Bring up a separate --tk diff for just the baseline
@@ -323,10 +324,11 @@
323324
const char *zCnt;
324325
const char *zTcl;
325326
int bTk;
326327
int bDark;
327328
int bAll;
329
+ int bDetail;
328330
int nContext;
329331
Stmt q;
330332
const char *zWhere;
331333
int cnt = 0;
332334
const char *zDiff2 = 0;
@@ -336,10 +338,11 @@
336338
bTk = find_option("tk", 0, 0)!=0;
337339
zTcl = find_option("tcl", 0, 1);
338340
zCnt = find_option("context", "c", 1);
339341
bDark = find_option("dark", 0, 0)!=0;
340342
bAll = find_option("all", "a", 0)!=0;
343
+ bDetail = find_option("verbose", "v", 0)!=0;
341344
if( (zDiff2 = find_option("diff12", 0, 1))!=0 ){
342345
diffMode = 12;
343346
}else
344347
if( (zDiff2 = find_option("diff13", 0, 1))!=0 ){
345348
diffMode = 13;
@@ -388,31 +391,68 @@
388391
if( bAll ){
389392
zWhere = "";
390393
}else{
391394
zWhere = "WHERE op IN ('MERGE','CONFLICT','ERROR')";
392395
}
393
- db_prepare(&q,
394
- "WITH priority(op,pri) AS (VALUES('CONFLICT',0),('ERROR',0),"
395
- "('MERGE',1),('ADDED',2),('UPDATE',2))"
396
-
397
- /* 0 1 2 */
398
- "SELECT op, coalesce(fnr,fn), msg"
399
- " FROM mergestat JOIN priority USING(op)"
400
- " %s"
401
- " ORDER BY pri, coalesce(fnr,fn)",
402
- zWhere /*safe-for-%s*/
403
- );
404
- while( db_step(&q)==SQLITE_ROW ){
405
- const char *zOp = db_column_text(&q, 0);
406
- const char *zName = db_column_text(&q, 1);
407
- const char *zErr = db_column_text(&q, 2);
408
- if( zErr && fossil_strcmp(zOp,"CONFLICT")!=0 ){
409
- fossil_print("%-9s %s (%s)\n", zOp, zName, zErr);
410
- }else{
411
- fossil_print("%-9s %s\n", zOp, zName);
412
- }
413
- cnt++;
396
+ if( !bDetail ){
397
+ db_prepare(&q,
398
+ "WITH priority(op,pri) AS (VALUES('CONFLICT',0),('ERROR',0),"
399
+ "('MERGE',1),('ADDED',2),('UPDATE',2))"
400
+
401
+ /* 0 1 2 */
402
+ "SELECT op, coalesce(fnr,fn), msg"
403
+ " FROM mergestat JOIN priority USING(op)"
404
+ " %s"
405
+ " ORDER BY pri, coalesce(fnr,fn)",
406
+ zWhere /*safe-for-%s*/
407
+ );
408
+ while( db_step(&q)==SQLITE_ROW ){
409
+ const char *zOp = db_column_text(&q, 0);
410
+ const char *zName = db_column_text(&q, 1);
411
+ const char *zErr = db_column_text(&q, 2);
412
+ if( zErr && fossil_strcmp(zOp,"CONFLICT")!=0 ){
413
+ fossil_print("%-9s %s (%s)\n", zOp, zName, zErr);
414
+ }else{
415
+ fossil_print("%-9s %s\n", zOp, zName);
416
+ }
417
+ cnt++;
418
+ }
419
+ }else{
420
+ fossil_print(
421
+ " Status Local Pivot Merge-in Filename\n"
422
+ "--------- ---------- ---------- ---------- ----------------\n");
423
+ db_prepare(&q,
424
+ "WITH priority(op,pri) AS (VALUES('CONFLICT',0),('ERROR',0),"
425
+ "('MERGE',1),('ADDED',2),('UPDATE',2))"
426
+
427
+ /* 0 1 2 */
428
+ "SELECT op, coalesce(fnr,fn), msg,"
429
+ " (SELECT uuid FROM blob WHERE blob.rid=mergestat.ridv)," /* 3: local */
430
+ " (SELECT uuid FROM blob WHERE blob.rid=mergestat.ridp)," /* 4: pivot */
431
+ " (SELECT uuid FROM blob WHERE blob.rid=mergestat.ridm)" /* 5: mergein*/
432
+ " FROM mergestat JOIN priority USING(op)"
433
+ " %s"
434
+ " ORDER BY pri, coalesce(fnr,fn)",
435
+ zWhere /*safe-for-%s*/
436
+ );
437
+ while( db_step(&q)==SQLITE_ROW ){
438
+ const char *zOp = db_column_text(&q, 0);
439
+ const char *zName = db_column_text(&q, 1);
440
+ const char *zErr = db_column_text(&q, 2);
441
+ const char *zLocal = db_column_text(&q, 3);
442
+ const char *zPivot = db_column_text(&q, 4);
443
+ const char *zMergein = db_column_text(&q, 5);
444
+ if( zLocal==0 ) zLocal = "";
445
+ if( zErr && fossil_strcmp(zOp,"CONFLICT")!=0 ){
446
+ fossil_print("%-9s %10.10s %10.10s %10.10s %s (%s)\n",
447
+ zOp, zLocal, zPivot, zMergein, zName, zErr);
448
+ }else{
449
+ fossil_print("%-9s %10.10s %10.10s %10.10s %s\n",
450
+ zOp, zLocal, zPivot, zMergein, zName);
451
+ }
452
+ cnt++;
453
+ }
414454
}
415455
db_finalize(&q);
416456
if( !bAll && cnt==0 ){
417457
fossil_print(
418458
"No interesting changes in this merge. Use --all to see everything.\n"
419459
--- src/merge.c
+++ src/merge.c
@@ -300,10 +300,11 @@
300 ** lines are shown
301 ** -c|--context N Show N lines of context around each change,
302 ** with negative N meaning show all content. Only
303 ** meaningful in combination with --tcl or --tk.
304 ** --dark Use dark mode for the Tcl/Tk-based GUI
 
305 ** --tk Bring up a Tcl/Tk GUI that shows the changes
306 ** associated with the most recent merge.
307 **
308 ** Options used internally by --tk:
309 ** --diff12 FILE Bring up a separate --tk diff for just the baseline
@@ -323,10 +324,11 @@
323 const char *zCnt;
324 const char *zTcl;
325 int bTk;
326 int bDark;
327 int bAll;
 
328 int nContext;
329 Stmt q;
330 const char *zWhere;
331 int cnt = 0;
332 const char *zDiff2 = 0;
@@ -336,10 +338,11 @@
336 bTk = find_option("tk", 0, 0)!=0;
337 zTcl = find_option("tcl", 0, 1);
338 zCnt = find_option("context", "c", 1);
339 bDark = find_option("dark", 0, 0)!=0;
340 bAll = find_option("all", "a", 0)!=0;
 
341 if( (zDiff2 = find_option("diff12", 0, 1))!=0 ){
342 diffMode = 12;
343 }else
344 if( (zDiff2 = find_option("diff13", 0, 1))!=0 ){
345 diffMode = 13;
@@ -388,31 +391,68 @@
388 if( bAll ){
389 zWhere = "";
390 }else{
391 zWhere = "WHERE op IN ('MERGE','CONFLICT','ERROR')";
392 }
393 db_prepare(&q,
394 "WITH priority(op,pri) AS (VALUES('CONFLICT',0),('ERROR',0),"
395 "('MERGE',1),('ADDED',2),('UPDATE',2))"
396
397 /* 0 1 2 */
398 "SELECT op, coalesce(fnr,fn), msg"
399 " FROM mergestat JOIN priority USING(op)"
400 " %s"
401 " ORDER BY pri, coalesce(fnr,fn)",
402 zWhere /*safe-for-%s*/
403 );
404 while( db_step(&q)==SQLITE_ROW ){
405 const char *zOp = db_column_text(&q, 0);
406 const char *zName = db_column_text(&q, 1);
407 const char *zErr = db_column_text(&q, 2);
408 if( zErr && fossil_strcmp(zOp,"CONFLICT")!=0 ){
409 fossil_print("%-9s %s (%s)\n", zOp, zName, zErr);
410 }else{
411 fossil_print("%-9s %s\n", zOp, zName);
412 }
413 cnt++;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414 }
415 db_finalize(&q);
416 if( !bAll && cnt==0 ){
417 fossil_print(
418 "No interesting changes in this merge. Use --all to see everything.\n"
419
--- src/merge.c
+++ src/merge.c
@@ -300,10 +300,11 @@
300 ** lines are shown
301 ** -c|--context N Show N lines of context around each change,
302 ** with negative N meaning show all content. Only
303 ** meaningful in combination with --tcl or --tk.
304 ** --dark Use dark mode for the Tcl/Tk-based GUI
305 ** -v|--verbose Show extra information about each merge operation
306 ** --tk Bring up a Tcl/Tk GUI that shows the changes
307 ** associated with the most recent merge.
308 **
309 ** Options used internally by --tk:
310 ** --diff12 FILE Bring up a separate --tk diff for just the baseline
@@ -323,10 +324,11 @@
324 const char *zCnt;
325 const char *zTcl;
326 int bTk;
327 int bDark;
328 int bAll;
329 int bDetail;
330 int nContext;
331 Stmt q;
332 const char *zWhere;
333 int cnt = 0;
334 const char *zDiff2 = 0;
@@ -336,10 +338,11 @@
338 bTk = find_option("tk", 0, 0)!=0;
339 zTcl = find_option("tcl", 0, 1);
340 zCnt = find_option("context", "c", 1);
341 bDark = find_option("dark", 0, 0)!=0;
342 bAll = find_option("all", "a", 0)!=0;
343 bDetail = find_option("verbose", "v", 0)!=0;
344 if( (zDiff2 = find_option("diff12", 0, 1))!=0 ){
345 diffMode = 12;
346 }else
347 if( (zDiff2 = find_option("diff13", 0, 1))!=0 ){
348 diffMode = 13;
@@ -388,31 +391,68 @@
391 if( bAll ){
392 zWhere = "";
393 }else{
394 zWhere = "WHERE op IN ('MERGE','CONFLICT','ERROR')";
395 }
396 if( !bDetail ){
397 db_prepare(&q,
398 "WITH priority(op,pri) AS (VALUES('CONFLICT',0),('ERROR',0),"
399 "('MERGE',1),('ADDED',2),('UPDATE',2))"
400
401 /* 0 1 2 */
402 "SELECT op, coalesce(fnr,fn), msg"
403 " FROM mergestat JOIN priority USING(op)"
404 " %s"
405 " ORDER BY pri, coalesce(fnr,fn)",
406 zWhere /*safe-for-%s*/
407 );
408 while( db_step(&q)==SQLITE_ROW ){
409 const char *zOp = db_column_text(&q, 0);
410 const char *zName = db_column_text(&q, 1);
411 const char *zErr = db_column_text(&q, 2);
412 if( zErr && fossil_strcmp(zOp,"CONFLICT")!=0 ){
413 fossil_print("%-9s %s (%s)\n", zOp, zName, zErr);
414 }else{
415 fossil_print("%-9s %s\n", zOp, zName);
416 }
417 cnt++;
418 }
419 }else{
420 fossil_print(
421 " Status Local Pivot Merge-in Filename\n"
422 "--------- ---------- ---------- ---------- ----------------\n");
423 db_prepare(&q,
424 "WITH priority(op,pri) AS (VALUES('CONFLICT',0),('ERROR',0),"
425 "('MERGE',1),('ADDED',2),('UPDATE',2))"
426
427 /* 0 1 2 */
428 "SELECT op, coalesce(fnr,fn), msg,"
429 " (SELECT uuid FROM blob WHERE blob.rid=mergestat.ridv)," /* 3: local */
430 " (SELECT uuid FROM blob WHERE blob.rid=mergestat.ridp)," /* 4: pivot */
431 " (SELECT uuid FROM blob WHERE blob.rid=mergestat.ridm)" /* 5: mergein*/
432 " FROM mergestat JOIN priority USING(op)"
433 " %s"
434 " ORDER BY pri, coalesce(fnr,fn)",
435 zWhere /*safe-for-%s*/
436 );
437 while( db_step(&q)==SQLITE_ROW ){
438 const char *zOp = db_column_text(&q, 0);
439 const char *zName = db_column_text(&q, 1);
440 const char *zErr = db_column_text(&q, 2);
441 const char *zLocal = db_column_text(&q, 3);
442 const char *zPivot = db_column_text(&q, 4);
443 const char *zMergein = db_column_text(&q, 5);
444 if( zLocal==0 ) zLocal = "";
445 if( zErr && fossil_strcmp(zOp,"CONFLICT")!=0 ){
446 fossil_print("%-9s %10.10s %10.10s %10.10s %s (%s)\n",
447 zOp, zLocal, zPivot, zMergein, zName, zErr);
448 }else{
449 fossil_print("%-9s %10.10s %10.10s %10.10s %s\n",
450 zOp, zLocal, zPivot, zMergein, zName);
451 }
452 cnt++;
453 }
454 }
455 db_finalize(&q);
456 if( !bAll && cnt==0 ){
457 fossil_print(
458 "No interesting changes in this merge. Use --all to see everything.\n"
459

Keyboard Shortcuts

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