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.

drh 2022-03-07 20:00 trunk
Commit 8b1e14df0b02c73c4c60d5d40332fad87c59ab7c9e4664ca98666952f4ad8b64
1 file changed +24 -4
+24 -4
--- src/graph.c
+++ src/graph.c
@@ -840,25 +840,45 @@
840840
** Find the maximum rail number.
841841
*/
842842
find_max_rail(p);
843843
844844
/*
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.
846849
*/
847850
aMap = p->aiRailMap;
848851
for(i=0; i<=p->mxRail; i++) aMap[i] = i;
849852
if( zLeftBranch && nTimewarp==0 ){
850853
char *zLeft = persistBranchName(p, zLeftBranch);
854
+ u64 pureMergeRail = (BIT(p->mxRail)-1)<<1|1;
855
+ u64 toLeft = 0;
851856
j = 0;
852857
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 ){
854860
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);
856862
}
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
+ }
858869
}
859870
}
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
+ }
860880
cgi_printf("<!-- aiRailMap =");
861881
for(i=0; i<=p->mxRail; i++) cgi_printf(" %d", aMap[i]);
862882
cgi_printf(" -->\n");
863883
}
864884
865885
--- 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

Keyboard Shortcuts

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