Fossil SCM

Add the bo=LIST query parameter that specifies the branch display order. Fix the branch display order so that it actually works.

drh 2024-12-23 23:49 rl-determines-graph-order
Commit fe356e3ef8658fe9c6f679325efc9fe925f156a76496e3248bc8a820d3348108
+10 -6
--- src/graph.c
+++ src/graph.c
@@ -993,16 +993,17 @@
993993
**
994994
** 0x01 A rail that merges with the preferred branch
995995
*/
996996
u16 aPriority[GR_MAX_RAIL];
997997
int mxMatch = 0;
998
- memset(aPriority, 0, p->mxRail+1);
998
+ memset(aPriority, 0, (p->mxRail+1)*sizeof(aPriority[0]));
999999
if( pLeftBranch ){
10001000
for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
10011001
int iMatch = match_text(pLeftBranch, pRow->zBranch);
1002
- if( iMatch>0 && iMatch<0x3fff ){
1003
- aPriority[pRow->iRail] |= iMatch*4;
1002
+ if( iMatch>0 ){
1003
+ if( iMatch>10 ) iMatch = 10;
1004
+ aPriority[pRow->iRail] |= 1<<(iMatch+1);
10041005
if( mxMatch<iMatch ) mxMatch = iMatch;
10051006
for(i=0; i<=p->mxRail; i++){
10061007
if( pRow->mergeIn[i] ) aPriority[i] |= 1;
10071008
}
10081009
if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1;
@@ -1027,18 +1028,21 @@
10271028
}
10281029
10291030
#if 0
10301031
fprintf(stderr,"mergeRail: 0x%llx\n", p->mergeRail);
10311032
fprintf(stderr,"Priority:");
1032
- for(i=0; i<=p->mxRail; i++) fprintf(stderr," %d", aPriority[i]);
1033
+ for(i=0; i<=p->mxRail; i++){
1034
+ fprintf(stderr," %x.%x",
1035
+ aPriority[i]/4, aPriority[i]&3);
1036
+ }
10331037
fprintf(stderr,"\n");
10341038
#endif
10351039
10361040
j = 0;
1037
- for(kk=4; kk<=mxMatch*4; kk+=4){
1041
+ for(kk=4; kk<=1<<(mxMatch+1); kk*=2){
10381042
for(i=0; i<=p->mxRail; i++){
1039
- if( aPriority[i]>=kk && aPriority[i]<=kk+3 ){
1043
+ if( aPriority[i]>=kk && aPriority[i]<kk*2 ){
10401044
aMap[i] = j++;
10411045
}
10421046
}
10431047
}
10441048
for(i=p->mxRail; i>=0; i--){
10451049
--- src/graph.c
+++ src/graph.c
@@ -993,16 +993,17 @@
993 **
994 ** 0x01 A rail that merges with the preferred branch
995 */
996 u16 aPriority[GR_MAX_RAIL];
997 int mxMatch = 0;
998 memset(aPriority, 0, p->mxRail+1);
999 if( pLeftBranch ){
1000 for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
1001 int iMatch = match_text(pLeftBranch, pRow->zBranch);
1002 if( iMatch>0 && iMatch<0x3fff ){
1003 aPriority[pRow->iRail] |= iMatch*4;
 
1004 if( mxMatch<iMatch ) mxMatch = iMatch;
1005 for(i=0; i<=p->mxRail; i++){
1006 if( pRow->mergeIn[i] ) aPriority[i] |= 1;
1007 }
1008 if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1;
@@ -1027,18 +1028,21 @@
1027 }
1028
1029 #if 0
1030 fprintf(stderr,"mergeRail: 0x%llx\n", p->mergeRail);
1031 fprintf(stderr,"Priority:");
1032 for(i=0; i<=p->mxRail; i++) fprintf(stderr," %d", aPriority[i]);
 
 
 
1033 fprintf(stderr,"\n");
1034 #endif
1035
1036 j = 0;
1037 for(kk=4; kk<=mxMatch*4; kk+=4){
1038 for(i=0; i<=p->mxRail; i++){
1039 if( aPriority[i]>=kk && aPriority[i]<=kk+3 ){
1040 aMap[i] = j++;
1041 }
1042 }
1043 }
1044 for(i=p->mxRail; i>=0; i--){
1045
--- src/graph.c
+++ src/graph.c
@@ -993,16 +993,17 @@
993 **
994 ** 0x01 A rail that merges with the preferred branch
995 */
996 u16 aPriority[GR_MAX_RAIL];
997 int mxMatch = 0;
998 memset(aPriority, 0, (p->mxRail+1)*sizeof(aPriority[0]));
999 if( pLeftBranch ){
1000 for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
1001 int iMatch = match_text(pLeftBranch, pRow->zBranch);
1002 if( iMatch>0 ){
1003 if( iMatch>10 ) iMatch = 10;
1004 aPriority[pRow->iRail] |= 1<<(iMatch+1);
1005 if( mxMatch<iMatch ) mxMatch = iMatch;
1006 for(i=0; i<=p->mxRail; i++){
1007 if( pRow->mergeIn[i] ) aPriority[i] |= 1;
1008 }
1009 if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1;
@@ -1027,18 +1028,21 @@
1028 }
1029
1030 #if 0
1031 fprintf(stderr,"mergeRail: 0x%llx\n", p->mergeRail);
1032 fprintf(stderr,"Priority:");
1033 for(i=0; i<=p->mxRail; i++){
1034 fprintf(stderr," %x.%x",
1035 aPriority[i]/4, aPriority[i]&3);
1036 }
1037 fprintf(stderr,"\n");
1038 #endif
1039
1040 j = 0;
1041 for(kk=4; kk<=1<<(mxMatch+1); kk*=2){
1042 for(i=0; i<=p->mxRail; i++){
1043 if( aPriority[i]>=kk && aPriority[i]<kk*2 ){
1044 aMap[i] = j++;
1045 }
1046 }
1047 }
1048 for(i=p->mxRail; i>=0; i--){
1049
--- src/match.c
+++ src/match.c
@@ -182,11 +182,10 @@
182182
int nText = (int)strlen(zText);
183183
for(i=0; i<p->nPattern; i++){
184184
if( re_match(p->aRe[i], (const u8*)zText, nText) ) return i+1;
185185
}
186186
break;
187
-
188187
}
189188
}
190189
return 0;
191190
}
192191
193192
--- src/match.c
+++ src/match.c
@@ -182,11 +182,10 @@
182 int nText = (int)strlen(zText);
183 for(i=0; i<p->nPattern; i++){
184 if( re_match(p->aRe[i], (const u8*)zText, nText) ) return i+1;
185 }
186 break;
187
188 }
189 }
190 return 0;
191 }
192
193
--- src/match.c
+++ src/match.c
@@ -182,11 +182,10 @@
182 int nText = (int)strlen(zText);
183 for(i=0; i<p->nPattern; i++){
184 if( re_match(p->aRe[i], (const u8*)zText, nText) ) return i+1;
185 }
186 break;
 
187 }
188 }
189 return 0;
190 }
191
192
+7 -1
--- src/timeline.c
+++ src/timeline.c
@@ -1552,10 +1552,11 @@
15521552
** from=CX ... shortest path from CX up to CHECKIN
15531553
** t=TAG Show only check-ins with the given TAG
15541554
** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
15551555
** tl=TAGLIST Same as 't=TAGLIST&ms=brlist'
15561556
** rl=TAGLIST Same as 'r=TAGLIST&ms=brlist'
1557
+** bo=TAGLIST Show branches of the graph in the order defined TAGLIST
15571558
** rel Show related check-ins as well as those matching t=TAG
15581559
** mionly Limit rel to show ancestors but not descendants
15591560
** nowiki Do not show wiki associated with branch or tag
15601561
** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP
15611562
** u=USER Only show items associated with USER
@@ -2915,11 +2916,16 @@
29152916
@ %z(chref("button","%s",zNewerButton))%h(zNewerButtonLabel)\
29162917
@ &nbsp;&uarr;</a>
29172918
}
29182919
cgi_check_for_malice();
29192920
{
2920
- Matcher *pLeftBranch = match_create(matchStyle, zBrName);
2921
+ Matcher *pLeftBranch;
2922
+ if( P("bo")!=0 ){
2923
+ pLeftBranch = match_create(MS_BRLIST, P("bo"));
2924
+ }else{
2925
+ pLeftBranch = match_create(matchStyle, zBrName);
2926
+ }
29212927
www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
29222928
selectedRid, secondaryRid, 0);
29232929
match_free(pLeftBranch);
29242930
}
29252931
db_finalize(&q);
29262932
--- src/timeline.c
+++ src/timeline.c
@@ -1552,10 +1552,11 @@
1552 ** from=CX ... shortest path from CX up to CHECKIN
1553 ** t=TAG Show only check-ins with the given TAG
1554 ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
1555 ** tl=TAGLIST Same as 't=TAGLIST&ms=brlist'
1556 ** rl=TAGLIST Same as 'r=TAGLIST&ms=brlist'
 
1557 ** rel Show related check-ins as well as those matching t=TAG
1558 ** mionly Limit rel to show ancestors but not descendants
1559 ** nowiki Do not show wiki associated with branch or tag
1560 ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP
1561 ** u=USER Only show items associated with USER
@@ -2915,11 +2916,16 @@
2915 @ %z(chref("button","%s",zNewerButton))%h(zNewerButtonLabel)\
2916 @ &nbsp;&uarr;</a>
2917 }
2918 cgi_check_for_malice();
2919 {
2920 Matcher *pLeftBranch = match_create(matchStyle, zBrName);
 
 
 
 
 
2921 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
2922 selectedRid, secondaryRid, 0);
2923 match_free(pLeftBranch);
2924 }
2925 db_finalize(&q);
2926
--- src/timeline.c
+++ src/timeline.c
@@ -1552,10 +1552,11 @@
1552 ** from=CX ... shortest path from CX up to CHECKIN
1553 ** t=TAG Show only check-ins with the given TAG
1554 ** r=TAG Show check-ins related to TAG, equivalent to t=TAG&rel
1555 ** tl=TAGLIST Same as 't=TAGLIST&ms=brlist'
1556 ** rl=TAGLIST Same as 'r=TAGLIST&ms=brlist'
1557 ** bo=TAGLIST Show branches of the graph in the order defined TAGLIST
1558 ** rel Show related check-ins as well as those matching t=TAG
1559 ** mionly Limit rel to show ancestors but not descendants
1560 ** nowiki Do not show wiki associated with branch or tag
1561 ** ms=MATCHSTYLE Set tag match style to EXACT, GLOB, LIKE, REGEXP
1562 ** u=USER Only show items associated with USER
@@ -2915,11 +2916,16 @@
2916 @ %z(chref("button","%s",zNewerButton))%h(zNewerButtonLabel)\
2917 @ &nbsp;&uarr;</a>
2918 }
2919 cgi_check_for_malice();
2920 {
2921 Matcher *pLeftBranch;
2922 if( P("bo")!=0 ){
2923 pLeftBranch = match_create(MS_BRLIST, P("bo"));
2924 }else{
2925 pLeftBranch = match_create(matchStyle, zBrName);
2926 }
2927 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, pLeftBranch,
2928 selectedRid, secondaryRid, 0);
2929 match_free(pLeftBranch);
2930 }
2931 db_finalize(&q);
2932

Keyboard Shortcuts

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