Fossil SCM

Use main-branch setting, instead of hard-coded trunk, for determining whether a given leaf should show its branch point, per forum feedback.

stephan 2021-02-15 18:24 leaves-command-branched-from
Commit 0d5349cd1c41a9ef927af14557b25ffeb87f18731f2886a102f26cd9ac07a41c
1 file changed +4 -2
--- src/descendants.c
+++ src/descendants.c
@@ -422,10 +422,11 @@
422422
int multipleFlag = find_option("multiple","m",0)!=0;
423423
const char *zWidth = find_option("width","W",1);
424424
char *zLastBr = 0;
425425
int n, width;
426426
char zLineNo[10];
427
+ char * const zMainBranch = db_get("main-branch","trunk");
427428
428429
if( multipleFlag ) byBranch = 1;
429430
if( zWidth ){
430431
width = atoi(zWidth);
431432
if( (width!=0) && (width<=39) ){
@@ -492,11 +493,10 @@
492493
const char *zId = db_column_text(&q, 1);
493494
const char *zDate = db_column_text(&q, 2);
494495
const char *zCom = db_column_text(&q, 3);
495496
const char *zBr = db_column_text(&q, 7);
496497
char *z = 0;
497
- int ridOfRoot = 0;
498498
char * zBranchPoint = 0;
499499
500500
if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){
501501
fossil_print("*** %s ***\n", zBr);
502502
fossil_free(zLastBr);
@@ -504,11 +504,12 @@
504504
if( multipleFlag ) n = 0;
505505
}
506506
n++;
507507
sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
508508
fossil_print("%6s ", zLineNo);
509
- if(0!=fossil_strcmp(zBr,"trunk")){
509
+ if(0!=fossil_strcmp(zBr,zMainBranch)){
510
+ int ridOfRoot;
510511
z = mprintf("root:%s", zId);
511512
ridOfRoot = symbolic_name_to_rid(z, "ci");
512513
if(ridOfRoot>0){
513514
zBranchPoint = mprintf(" (branched from: [%.*z])", hash_digits(0),
514515
rid_to_uuid(ridOfRoot));
@@ -519,10 +520,11 @@
519520
zBranchPoint ? zBranchPoint : "");
520521
comment_print(z, zCom, 7, width, get_comment_format());
521522
fossil_free(z);
522523
fossil_free(zBranchPoint);
523524
}
525
+ fossil_free(zMainBranch);
524526
fossil_free(zLastBr);
525527
db_finalize(&q);
526528
}
527529
528530
/*
529531
--- src/descendants.c
+++ src/descendants.c
@@ -422,10 +422,11 @@
422 int multipleFlag = find_option("multiple","m",0)!=0;
423 const char *zWidth = find_option("width","W",1);
424 char *zLastBr = 0;
425 int n, width;
426 char zLineNo[10];
 
427
428 if( multipleFlag ) byBranch = 1;
429 if( zWidth ){
430 width = atoi(zWidth);
431 if( (width!=0) && (width<=39) ){
@@ -492,11 +493,10 @@
492 const char *zId = db_column_text(&q, 1);
493 const char *zDate = db_column_text(&q, 2);
494 const char *zCom = db_column_text(&q, 3);
495 const char *zBr = db_column_text(&q, 7);
496 char *z = 0;
497 int ridOfRoot = 0;
498 char * zBranchPoint = 0;
499
500 if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){
501 fossil_print("*** %s ***\n", zBr);
502 fossil_free(zLastBr);
@@ -504,11 +504,12 @@
504 if( multipleFlag ) n = 0;
505 }
506 n++;
507 sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
508 fossil_print("%6s ", zLineNo);
509 if(0!=fossil_strcmp(zBr,"trunk")){
 
510 z = mprintf("root:%s", zId);
511 ridOfRoot = symbolic_name_to_rid(z, "ci");
512 if(ridOfRoot>0){
513 zBranchPoint = mprintf(" (branched from: [%.*z])", hash_digits(0),
514 rid_to_uuid(ridOfRoot));
@@ -519,10 +520,11 @@
519 zBranchPoint ? zBranchPoint : "");
520 comment_print(z, zCom, 7, width, get_comment_format());
521 fossil_free(z);
522 fossil_free(zBranchPoint);
523 }
 
524 fossil_free(zLastBr);
525 db_finalize(&q);
526 }
527
528 /*
529
--- src/descendants.c
+++ src/descendants.c
@@ -422,10 +422,11 @@
422 int multipleFlag = find_option("multiple","m",0)!=0;
423 const char *zWidth = find_option("width","W",1);
424 char *zLastBr = 0;
425 int n, width;
426 char zLineNo[10];
427 char * const zMainBranch = db_get("main-branch","trunk");
428
429 if( multipleFlag ) byBranch = 1;
430 if( zWidth ){
431 width = atoi(zWidth);
432 if( (width!=0) && (width<=39) ){
@@ -492,11 +493,10 @@
493 const char *zId = db_column_text(&q, 1);
494 const char *zDate = db_column_text(&q, 2);
495 const char *zCom = db_column_text(&q, 3);
496 const char *zBr = db_column_text(&q, 7);
497 char *z = 0;
 
498 char * zBranchPoint = 0;
499
500 if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){
501 fossil_print("*** %s ***\n", zBr);
502 fossil_free(zLastBr);
@@ -504,11 +504,12 @@
504 if( multipleFlag ) n = 0;
505 }
506 n++;
507 sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n);
508 fossil_print("%6s ", zLineNo);
509 if(0!=fossil_strcmp(zBr,zMainBranch)){
510 int ridOfRoot;
511 z = mprintf("root:%s", zId);
512 ridOfRoot = symbolic_name_to_rid(z, "ci");
513 if(ridOfRoot>0){
514 zBranchPoint = mprintf(" (branched from: [%.*z])", hash_digits(0),
515 rid_to_uuid(ridOfRoot));
@@ -519,10 +520,11 @@
520 zBranchPoint ? zBranchPoint : "");
521 comment_print(z, zCom, 7, width, get_comment_format());
522 fossil_free(z);
523 fossil_free(zBranchPoint);
524 }
525 fossil_free(zMainBranch);
526 fossil_free(zLastBr);
527 db_finalize(&q);
528 }
529
530 /*
531

Keyboard Shortcuts

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