Fossil SCM

Improved computation of the rail mapper for timelines on a branch. If the branch is across two or more rails, then all rails of that branch are moved to the left as far as practical.

drh 2019-05-21 19:04 trunk
Commit d19df6161f01cea674a035eef4c9428c9ebc26aa08d5cfc88458803c83d68a3f
1 file changed +13 -11
+13 -11
--- src/graph.c
+++ src/graph.c
@@ -428,10 +428,11 @@
428428
GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
429429
int i, j;
430430
u64 mask;
431431
int hasDup = 0; /* True if one or more isDup entries */
432432
const char *zTrunk;
433
+ u8 *aMap; /* Copy of p->aiRailMap */
433434
int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
434435
435436
/* If mergeRiserFrom[X]==Y that means rail X holds a merge riser
436437
** coming up from the bottom of the graph from off-screen check-in Y
437438
** where Y is the RID. There is no riser on rail X if mergeRiserFrom[X]==0.
@@ -723,24 +724,25 @@
723724
find_max_rail(p);
724725
725726
/*
726727
** Compute the rail mapping.
727728
*/
728
- for(i=0; i<=p->mxRail; i++) p->aiRailMap[i] = i;
729
+ aMap = p->aiRailMap;
730
+ for(i=0; i<=p->mxRail; i++) aMap[i] = i;
729731
if( zLeftBranch ){
730732
char *zLeft = persistBranchName(p, zLeftBranch);
731
- for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
732
- if( pRow->zBranch==zLeft ){
733
- int iLeftRail = pRow->iRail;
734
- p->aiRailMap[iLeftRail] = 0;
735
- for(i=0, j=1; i<=p->mxRail; i++){
736
- if( i==iLeftRail ) continue;
737
- p->aiRailMap[i] = j++;
738
- }
739
- assert( j==p->mxRail+1 );
740
- break;
733
+ j = 0;
734
+ for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
735
+ if( pRow->zBranch==zLeft && aMap[pRow->iRail]>=j ){
736
+ for(i=0; i<=p->mxRail; i++){
737
+ if( aMap[i]>=j && aMap[i]<=pRow->iRail ) aMap[i]++;
738
+ }
739
+ aMap[pRow->iRail] = j++;
741740
}
742741
}
742
+ cgi_printf("<!-- aiRailMap =");
743
+ for(i=0; i<=p->mxRail; i++) cgi_printf(" %d", aMap[i]);
744
+ cgi_printf(" -->\n");
743745
}
744746
745747
p->nErr = 0;
746748
}
747749
--- src/graph.c
+++ src/graph.c
@@ -428,10 +428,11 @@
428 GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
429 int i, j;
430 u64 mask;
431 int hasDup = 0; /* True if one or more isDup entries */
432 const char *zTrunk;
 
433 int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
434
435 /* If mergeRiserFrom[X]==Y that means rail X holds a merge riser
436 ** coming up from the bottom of the graph from off-screen check-in Y
437 ** where Y is the RID. There is no riser on rail X if mergeRiserFrom[X]==0.
@@ -723,24 +724,25 @@
723 find_max_rail(p);
724
725 /*
726 ** Compute the rail mapping.
727 */
728 for(i=0; i<=p->mxRail; i++) p->aiRailMap[i] = i;
 
729 if( zLeftBranch ){
730 char *zLeft = persistBranchName(p, zLeftBranch);
731 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
732 if( pRow->zBranch==zLeft ){
733 int iLeftRail = pRow->iRail;
734 p->aiRailMap[iLeftRail] = 0;
735 for(i=0, j=1; i<=p->mxRail; i++){
736 if( i==iLeftRail ) continue;
737 p->aiRailMap[i] = j++;
738 }
739 assert( j==p->mxRail+1 );
740 break;
741 }
742 }
 
 
 
743 }
744
745 p->nErr = 0;
746 }
747
--- src/graph.c
+++ src/graph.c
@@ -428,10 +428,11 @@
428 GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
429 int i, j;
430 u64 mask;
431 int hasDup = 0; /* True if one or more isDup entries */
432 const char *zTrunk;
433 u8 *aMap; /* Copy of p->aiRailMap */
434 int omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
435
436 /* If mergeRiserFrom[X]==Y that means rail X holds a merge riser
437 ** coming up from the bottom of the graph from off-screen check-in Y
438 ** where Y is the RID. There is no riser on rail X if mergeRiserFrom[X]==0.
@@ -723,24 +724,25 @@
724 find_max_rail(p);
725
726 /*
727 ** Compute the rail mapping.
728 */
729 aMap = p->aiRailMap;
730 for(i=0; i<=p->mxRail; i++) aMap[i] = i;
731 if( zLeftBranch ){
732 char *zLeft = persistBranchName(p, zLeftBranch);
733 j = 0;
734 for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
735 if( pRow->zBranch==zLeft && aMap[pRow->iRail]>=j ){
736 for(i=0; i<=p->mxRail; i++){
737 if( aMap[i]>=j && aMap[i]<=pRow->iRail ) aMap[i]++;
738 }
739 aMap[pRow->iRail] = j++;
 
 
 
740 }
741 }
742 cgi_printf("<!-- aiRailMap =");
743 for(i=0; i<=p->mxRail; i++) cgi_printf(" %d", aMap[i]);
744 cgi_printf(" -->\n");
745 }
746
747 p->nErr = 0;
748 }
749

Keyboard Shortcuts

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