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.
Commit
2778e55f0715e8e204d9688ed2a8feacad0b7eec53734d5f56af752569a34a35
Parent
e89ea2c93c38fe1…
2 files changed
+13
-5
+7
-4
+13
-5
| --- src/graph.c | ||
| +++ src/graph.c | ||
| @@ -979,10 +979,11 @@ | ||
| 979 | 979 | ** rare so this should not be a serious limitation to the algorithm. |
| 980 | 980 | */ |
| 981 | 981 | aMap = p->aiRailMap; |
| 982 | 982 | for(i=0; i<=p->mxRail; i++) aMap[i] = i; /* Set up a default mapping */ |
| 983 | 983 | if( nTimewarp==0 ){ |
| 984 | + int kk; | |
| 984 | 985 | /* Priority bits: |
| 985 | 986 | ** |
| 986 | 987 | ** 0x04 The preferred branch |
| 987 | 988 | ** |
| 988 | 989 | ** 0x02 A merge rail - a rail that contains merge lines into |
| @@ -990,16 +991,19 @@ | ||
| 990 | 991 | ** is defined. This improves the display of r=BRANCH |
| 991 | 992 | ** options to /timeline. |
| 992 | 993 | ** |
| 993 | 994 | ** 0x01 A rail that merges with the preferred branch |
| 994 | 995 | */ |
| 995 | - u8 aPriority[GR_MAX_RAIL]; | |
| 996 | + u16 aPriority[GR_MAX_RAIL]; | |
| 997 | + int mxMatch = 0; | |
| 996 | 998 | memset(aPriority, 0, p->mxRail+1); |
| 997 | 999 | if( pLeftBranch ){ |
| 998 | 1000 | 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; | |
| 1001 | 1005 | for(i=0; i<=p->mxRail; i++){ |
| 1002 | 1006 | if( pRow->mergeIn[i] ) aPriority[i] |= 1; |
| 1003 | 1007 | } |
| 1004 | 1008 | if( pRow->mergeOut>=0 ) aPriority[pRow->mergeOut] |= 1; |
| 1005 | 1009 | } |
| @@ -1028,12 +1032,16 @@ | ||
| 1028 | 1032 | for(i=0; i<=p->mxRail; i++) fprintf(stderr," %d", aPriority[i]); |
| 1029 | 1033 | fprintf(stderr,"\n"); |
| 1030 | 1034 | #endif |
| 1031 | 1035 | |
| 1032 | 1036 | 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 | + } | |
| 1035 | 1043 | } |
| 1036 | 1044 | for(i=p->mxRail; i>=0; i--){ |
| 1037 | 1045 | if( aPriority[i]==3 ) aMap[i] = j++; |
| 1038 | 1046 | } |
| 1039 | 1047 | for(i=0; i<=p->mxRail; i++){ |
| 1040 | 1048 |
| --- 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 @@ | ||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /* |
| 150 | 150 | ** Return non-zero (true) if the input string matches the pattern |
| 151 | 151 | ** described by the matcher. |
| 152 | +** | |
| 153 | +** The return value is really the 1-based index of the particular | |
| 154 | +** pattern that matched. | |
| 152 | 155 | */ |
| 153 | 156 | int match_text(Matcher *p, const char *zText){ |
| 154 | 157 | int i; |
| 155 | 158 | if( p==0 ){ |
| 156 | 159 | return zText==0; |
| @@ -157,30 +160,30 @@ | ||
| 157 | 160 | } |
| 158 | 161 | switch( p->style ){ |
| 159 | 162 | case MS_BRLIST: |
| 160 | 163 | case MS_EXACT: { |
| 161 | 164 | 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; | |
| 163 | 166 | } |
| 164 | 167 | break; |
| 165 | 168 | } |
| 166 | 169 | case MS_GLOB: { |
| 167 | 170 | 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; | |
| 169 | 172 | } |
| 170 | 173 | break; |
| 171 | 174 | } |
| 172 | 175 | case MS_LIKE: { |
| 173 | 176 | 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; | |
| 175 | 178 | } |
| 176 | 179 | break; |
| 177 | 180 | } |
| 178 | 181 | case MS_REGEXP: { |
| 179 | 182 | int nText = (int)strlen(zText); |
| 180 | 183 | 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; | |
| 182 | 185 | } |
| 183 | 186 | break; |
| 184 | 187 | |
| 185 | 188 | } |
| 186 | 189 | } |
| 187 | 190 |
| --- 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 |