Fossil SCM

Experimental changes that cause branches to appear in the graph in the same order that they are listing the rl= or tl= query parameter.

drh 2024-12-23 20:52 trunk
Commit 2778e55f0715e8e204d9688ed2a8feacad0b7eec53734d5f56af752569a34a35
2 files changed +13 -5 +7 -4
+13 -5
--- src/graph.c
+++ src/graph.c
@@ -979,10 +979,11 @@
979979
** rare so this should not be a serious limitation to the algorithm.
980980
*/
981981
aMap = p->aiRailMap;
982982
for(i=0; i<=p->mxRail; i++) aMap[i] = i; /* Set up a default mapping */
983983
if( nTimewarp==0 ){
984
+ int kk;
984985
/* Priority bits:
985986
**
986987
** 0x04 The preferred branch
987988
**
988989
** 0x02 A merge rail - a rail that contains merge lines into
@@ -990,16 +991,19 @@
990991
** is defined. This improves the display of r=BRANCH
991992
** options to /timeline.
992993
**
993994
** 0x01 A rail that merges with the preferred branch
994995
*/
995
- u8 aPriority[GR_MAX_RAIL];
996
+ u16 aPriority[GR_MAX_RAIL];
997
+ int mxMatch = 0;
996998
memset(aPriority, 0, p->mxRail+1);
997999
if( pLeftBranch ){
9981000
for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
999
- if( match_text(pLeftBranch, pRow->zBranch) ){
1000
- aPriority[pRow->iRail] |= 4;
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;
10011005
for(i=0; i<=p->mxRail; i++){
10021006
if( pRow->mergeIn[i] ) aPriority[i] |= 1;
10031007
}
10041008
if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1;
10051009
}
@@ -1028,12 +1032,16 @@
10281032
for(i=0; i<=p->mxRail; i++) fprintf(stderr," %d", aPriority[i]);
10291033
fprintf(stderr,"\n");
10301034
#endif
10311035
10321036
j = 0;
1033
- for(i=0; i<=p->mxRail; i++){
1034
- if( aPriority[i]>=4 ) aMap[i] = j++;
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
+ }
10351043
}
10361044
for(i=p->mxRail; i>=0; i--){
10371045
if( aPriority[i]==3 ) aMap[i] = j++;
10381046
}
10391047
for(i=0; i<=p->mxRail; i++){
10401048
--- src/graph.c
+++ src/graph.c
@@ -979,10 +979,11 @@
979 ** rare so this should not be a serious limitation to the algorithm.
980 */
981 aMap = p->aiRailMap;
982 for(i=0; i<=p->mxRail; i++) aMap[i] = i; /* Set up a default mapping */
983 if( nTimewarp==0 ){
 
984 /* Priority bits:
985 **
986 ** 0x04 The preferred branch
987 **
988 ** 0x02 A merge rail - a rail that contains merge lines into
@@ -990,16 +991,19 @@
990 ** is defined. This improves the display of r=BRANCH
991 ** options to /timeline.
992 **
993 ** 0x01 A rail that merges with the preferred branch
994 */
995 u8 aPriority[GR_MAX_RAIL];
 
996 memset(aPriority, 0, p->mxRail+1);
997 if( pLeftBranch ){
998 for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
999 if( match_text(pLeftBranch, pRow->zBranch) ){
1000 aPriority[pRow->iRail] |= 4;
 
 
1001 for(i=0; i<=p->mxRail; i++){
1002 if( pRow->mergeIn[i] ) aPriority[i] |= 1;
1003 }
1004 if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1;
1005 }
@@ -1028,12 +1032,16 @@
1028 for(i=0; i<=p->mxRail; i++) fprintf(stderr," %d", aPriority[i]);
1029 fprintf(stderr,"\n");
1030 #endif
1031
1032 j = 0;
1033 for(i=0; i<=p->mxRail; i++){
1034 if( aPriority[i]>=4 ) aMap[i] = j++;
 
 
 
 
1035 }
1036 for(i=p->mxRail; i>=0; i--){
1037 if( aPriority[i]==3 ) aMap[i] = j++;
1038 }
1039 for(i=0; i<=p->mxRail; i++){
1040
--- src/graph.c
+++ src/graph.c
@@ -979,10 +979,11 @@
979 ** rare so this should not be a serious limitation to the algorithm.
980 */
981 aMap = p->aiRailMap;
982 for(i=0; i<=p->mxRail; i++) aMap[i] = i; /* Set up a default mapping */
983 if( nTimewarp==0 ){
984 int kk;
985 /* Priority bits:
986 **
987 ** 0x04 The preferred branch
988 **
989 ** 0x02 A merge rail - a rail that contains merge lines into
@@ -990,16 +991,19 @@
991 ** is defined. This improves the display of r=BRANCH
992 ** options to /timeline.
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;
1009 }
@@ -1028,12 +1032,16 @@
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 if( aPriority[i]==3 ) aMap[i] = j++;
1046 }
1047 for(i=0; i<=p->mxRail; i++){
1048
+7 -4
--- src/match.c
+++ src/match.c
@@ -147,10 +147,13 @@
147147
}
148148
149149
/*
150150
** Return non-zero (true) if the input string matches the pattern
151151
** described by the matcher.
152
+**
153
+** The return value is really the 1-based index of the particular
154
+** pattern that matched.
152155
*/
153156
int match_text(Matcher *p, const char *zText){
154157
int i;
155158
if( p==0 ){
156159
return zText==0;
@@ -157,30 +160,30 @@
157160
}
158161
switch( p->style ){
159162
case MS_BRLIST:
160163
case MS_EXACT: {
161164
for(i=0; i<p->nPattern; i++){
162
- if( strcmp(p->azPattern[i], zText)==0 ) return 1;
165
+ if( strcmp(p->azPattern[i], zText)==0 ) return i+1;
163166
}
164167
break;
165168
}
166169
case MS_GLOB: {
167170
for(i=0; i<p->nPattern; i++){
168
- if( sqlite3_strglob(p->azPattern[i], zText)==0 ) return 1;
171
+ if( sqlite3_strglob(p->azPattern[i], zText)==0 ) return i+1;
169172
}
170173
break;
171174
}
172175
case MS_LIKE: {
173176
for(i=0; i<p->nPattern; i++){
174
- if( sqlite3_strlike(p->azPattern[i], zText, 0)==0 ) return 1;
177
+ if( sqlite3_strlike(p->azPattern[i], zText, 0)==0 ) return i+1;
175178
}
176179
break;
177180
}
178181
case MS_REGEXP: {
179182
int nText = (int)strlen(zText);
180183
for(i=0; i<p->nPattern; i++){
181
- if( re_match(p->aRe[i], (const u8*)zText, nText) ) return 1;
184
+ if( re_match(p->aRe[i], (const u8*)zText, nText) ) return i+1;
182185
}
183186
break;
184187
185188
}
186189
}
187190
--- src/match.c
+++ src/match.c
@@ -147,10 +147,13 @@
147 }
148
149 /*
150 ** Return non-zero (true) if the input string matches the pattern
151 ** described by the matcher.
 
 
 
152 */
153 int match_text(Matcher *p, const char *zText){
154 int i;
155 if( p==0 ){
156 return zText==0;
@@ -157,30 +160,30 @@
157 }
158 switch( p->style ){
159 case MS_BRLIST:
160 case MS_EXACT: {
161 for(i=0; i<p->nPattern; i++){
162 if( strcmp(p->azPattern[i], zText)==0 ) return 1;
163 }
164 break;
165 }
166 case MS_GLOB: {
167 for(i=0; i<p->nPattern; i++){
168 if( sqlite3_strglob(p->azPattern[i], zText)==0 ) return 1;
169 }
170 break;
171 }
172 case MS_LIKE: {
173 for(i=0; i<p->nPattern; i++){
174 if( sqlite3_strlike(p->azPattern[i], zText, 0)==0 ) return 1;
175 }
176 break;
177 }
178 case MS_REGEXP: {
179 int nText = (int)strlen(zText);
180 for(i=0; i<p->nPattern; i++){
181 if( re_match(p->aRe[i], (const u8*)zText, nText) ) return 1;
182 }
183 break;
184
185 }
186 }
187
--- src/match.c
+++ src/match.c
@@ -147,10 +147,13 @@
147 }
148
149 /*
150 ** Return non-zero (true) if the input string matches the pattern
151 ** described by the matcher.
152 **
153 ** The return value is really the 1-based index of the particular
154 ** pattern that matched.
155 */
156 int match_text(Matcher *p, const char *zText){
157 int i;
158 if( p==0 ){
159 return zText==0;
@@ -157,30 +160,30 @@
160 }
161 switch( p->style ){
162 case MS_BRLIST:
163 case MS_EXACT: {
164 for(i=0; i<p->nPattern; i++){
165 if( strcmp(p->azPattern[i], zText)==0 ) return i+1;
166 }
167 break;
168 }
169 case MS_GLOB: {
170 for(i=0; i<p->nPattern; i++){
171 if( sqlite3_strglob(p->azPattern[i], zText)==0 ) return i+1;
172 }
173 break;
174 }
175 case MS_LIKE: {
176 for(i=0; i<p->nPattern; i++){
177 if( sqlite3_strlike(p->azPattern[i], zText, 0)==0 ) return i+1;
178 }
179 break;
180 }
181 case MS_REGEXP: {
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

Keyboard Shortcuts

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