Fossil SCM
When displaying the graph for a branch such that the rail for that branch is on the left margin, try to draw merge lines coming into that branch on rails just to the right of the branch itself.
Commit
8b1e14df0b02c73c4c60d5d40332fad87c59ab7c9e4664ca98666952f4ad8b64
Parent
14da62eeb5641bf…
1 file changed
+24
-4
+24
-4
| --- src/graph.c | ||
| +++ src/graph.c | ||
| @@ -840,25 +840,45 @@ | ||
| 840 | 840 | ** Find the maximum rail number. |
| 841 | 841 | */ |
| 842 | 842 | find_max_rail(p); |
| 843 | 843 | |
| 844 | 844 | /* |
| 845 | - ** Compute the rail mapping. | |
| 845 | + ** Compute the rail mapping that tries to put the branch named | |
| 846 | + ** zLeftBranch at the left margin. | |
| 847 | + ** | |
| 848 | + ** aMap[X]=Y means that the X-th rail is drawn as the Y-th rail. | |
| 846 | 849 | */ |
| 847 | 850 | aMap = p->aiRailMap; |
| 848 | 851 | for(i=0; i<=p->mxRail; i++) aMap[i] = i; |
| 849 | 852 | if( zLeftBranch && nTimewarp==0 ){ |
| 850 | 853 | char *zLeft = persistBranchName(p, zLeftBranch); |
| 854 | + u64 pureMergeRail = (BIT(p->mxRail)-1)<<1|1; | |
| 855 | + u64 toLeft = 0; | |
| 851 | 856 | j = 0; |
| 852 | 857 | for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ |
| 853 | - if( pRow->zBranch==zLeft && aMap[pRow->iRail]>=j ){ | |
| 858 | + pureMergeRail &= ~BIT(pRow->iRail); | |
| 859 | + if( pRow->zBranch==zLeft ){ | |
| 854 | 860 | for(i=0; i<=p->mxRail; i++){ |
| 855 | - if( aMap[i]>=j && aMap[i]<=pRow->iRail ) aMap[i]++; | |
| 861 | + if( pRow->mergeIn[i] ) toLeft |= BIT(i); | |
| 856 | 862 | } |
| 857 | - aMap[pRow->iRail] = j++; | |
| 863 | + if( aMap[pRow->iRail]>=j ){ | |
| 864 | + for(i=0; i<=p->mxRail; i++){ | |
| 865 | + if( aMap[i]>=j && aMap[i]<=pRow->iRail ) aMap[i]++; | |
| 866 | + } | |
| 867 | + aMap[pRow->iRail] = j++; | |
| 868 | + } | |
| 858 | 869 | } |
| 859 | 870 | } |
| 871 | + toLeft &= pureMergeRail; | |
| 872 | + for(i=j; i<=p->mxRail; i++){ | |
| 873 | + int k; | |
| 874 | + if( (BIT(i) & toLeft)==0 ) continue; | |
| 875 | + for(k=0; k<=p->mxRail; k++){ | |
| 876 | + if( aMap[k]>=j && aMap[k]<=i ) aMap[k]++; | |
| 877 | + } | |
| 878 | + aMap[i] = j; | |
| 879 | + } | |
| 860 | 880 | cgi_printf("<!-- aiRailMap ="); |
| 861 | 881 | for(i=0; i<=p->mxRail; i++) cgi_printf(" %d", aMap[i]); |
| 862 | 882 | cgi_printf(" -->\n"); |
| 863 | 883 | } |
| 864 | 884 | |
| 865 | 885 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -840,25 +840,45 @@ | |
| 840 | ** Find the maximum rail number. |
| 841 | */ |
| 842 | find_max_rail(p); |
| 843 | |
| 844 | /* |
| 845 | ** Compute the rail mapping. |
| 846 | */ |
| 847 | aMap = p->aiRailMap; |
| 848 | for(i=0; i<=p->mxRail; i++) aMap[i] = i; |
| 849 | if( zLeftBranch && nTimewarp==0 ){ |
| 850 | char *zLeft = persistBranchName(p, zLeftBranch); |
| 851 | j = 0; |
| 852 | for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ |
| 853 | if( pRow->zBranch==zLeft && aMap[pRow->iRail]>=j ){ |
| 854 | for(i=0; i<=p->mxRail; i++){ |
| 855 | if( aMap[i]>=j && aMap[i]<=pRow->iRail ) aMap[i]++; |
| 856 | } |
| 857 | aMap[pRow->iRail] = j++; |
| 858 | } |
| 859 | } |
| 860 | cgi_printf("<!-- aiRailMap ="); |
| 861 | for(i=0; i<=p->mxRail; i++) cgi_printf(" %d", aMap[i]); |
| 862 | cgi_printf(" -->\n"); |
| 863 | } |
| 864 | |
| 865 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -840,25 +840,45 @@ | |
| 840 | ** Find the maximum rail number. |
| 841 | */ |
| 842 | find_max_rail(p); |
| 843 | |
| 844 | /* |
| 845 | ** Compute the rail mapping that tries to put the branch named |
| 846 | ** zLeftBranch at the left margin. |
| 847 | ** |
| 848 | ** aMap[X]=Y means that the X-th rail is drawn as the Y-th rail. |
| 849 | */ |
| 850 | aMap = p->aiRailMap; |
| 851 | for(i=0; i<=p->mxRail; i++) aMap[i] = i; |
| 852 | if( zLeftBranch && nTimewarp==0 ){ |
| 853 | char *zLeft = persistBranchName(p, zLeftBranch); |
| 854 | u64 pureMergeRail = (BIT(p->mxRail)-1)<<1|1; |
| 855 | u64 toLeft = 0; |
| 856 | j = 0; |
| 857 | for(pRow=p->pFirst; pRow; pRow=pRow->pNext){ |
| 858 | pureMergeRail &= ~BIT(pRow->iRail); |
| 859 | if( pRow->zBranch==zLeft ){ |
| 860 | for(i=0; i<=p->mxRail; i++){ |
| 861 | if( pRow->mergeIn[i] ) toLeft |= BIT(i); |
| 862 | } |
| 863 | if( aMap[pRow->iRail]>=j ){ |
| 864 | for(i=0; i<=p->mxRail; i++){ |
| 865 | if( aMap[i]>=j && aMap[i]<=pRow->iRail ) aMap[i]++; |
| 866 | } |
| 867 | aMap[pRow->iRail] = j++; |
| 868 | } |
| 869 | } |
| 870 | } |
| 871 | toLeft &= pureMergeRail; |
| 872 | for(i=j; i<=p->mxRail; i++){ |
| 873 | int k; |
| 874 | if( (BIT(i) & toLeft)==0 ) continue; |
| 875 | for(k=0; k<=p->mxRail; k++){ |
| 876 | if( aMap[k]>=j && aMap[k]<=i ) aMap[k]++; |
| 877 | } |
| 878 | aMap[i] = j; |
| 879 | } |
| 880 | cgi_printf("<!-- aiRailMap ="); |
| 881 | for(i=0; i<=p->mxRail; i++) cgi_printf(" %d", aMap[i]); |
| 882 | cgi_printf(" -->\n"); |
| 883 | } |
| 884 | |
| 885 |