Fossil SCM

Partially revert [f73411025e8ebec7]. This fixes a problem that when closing a fork by just doing "fossil merge" and additonal arrow going up is displayed. Probably not the right fix.

jan.nijtmans 2016-07-05 14:17 UTC trunk
Commit a78e51185326b91f2270c50369f52e5edd2279c1
1 file changed +20 -10
+20 -10
--- src/graph.c
+++ src/graph.c
@@ -218,17 +218,17 @@
218218
** top and bottom, inclusive.
219219
*/
220220
static int findFreeRail(
221221
GraphContext *p, /* The graph context */
222222
int top, int btm, /* Span of rows for which the rail is needed */
223
+ u64 inUseMask, /* Mask or rails already in use */
223224
int iNearto /* Find rail nearest to this rail */
224225
){
225226
GraphRow *pRow;
226227
int i;
227228
int iBest = 0;
228229
int iBestDist = 9999;
229
- u64 inUseMask = 0;
230230
for(pRow=p->pFirst; pRow && pRow->idx<top; pRow=pRow->pNext){}
231231
while( pRow && pRow->idx<=btm ){
232232
inUseMask |= pRow->railInUse;
233233
pRow = pRow->pNext;
234234
}
@@ -299,11 +299,12 @@
299299
pParent->mergeUpto = pChild->idx;
300300
}else{
301301
/* The thin merge arrow riser is taller than the thick primary
302302
** child riser, so use separate rails. */
303303
int iTarget = pParent->iRail;
304
- pParent->mergeOut = findFreeRail(p, pChild->idx, pParent->idx-1, iTarget);
304
+ pParent->mergeOut = findFreeRail(p, pChild->idx, pParent->idx-1,
305
+ 0, iTarget);
305306
pParent->mergeUpto = pChild->idx;
306307
mask = BIT(pParent->mergeOut);
307308
for(pLoop=pChild->pNext; pLoop && pLoop->rid!=pParent->rid;
308309
pLoop=pLoop->pNext){
309310
pLoop->railInUse |= mask;
@@ -346,10 +347,11 @@
346347
*/
347348
void graph_finish(GraphContext *p, int omitDescenders){
348349
GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
349350
int i;
350351
u64 mask;
352
+ u64 inUse;
351353
int hasDup = 0; /* True if one or more isDup entries */
352354
const char *zTrunk;
353355
354356
if( p==0 || p->pFirst==0 || p->nErr ) return;
355357
p->nErr = 1; /* Assume an error until proven otherwise */
@@ -450,11 +452,11 @@
450452
}else {
451453
if( pRow->iRail>=0 ) continue;
452454
}
453455
if( pRow->nParent==0 || hashFind(p,pRow->aParent[0])==0 ){
454456
if( omitDescenders ){
455
- pRow->iRail = findFreeRail(p, pRow->idxTop, pRow->idx, 0);
457
+ pRow->iRail = findFreeRail(p, pRow->idxTop, pRow->idx, 0, 0);
456458
}else{
457459
pRow->iRail = ++p->mxRail;
458460
}
459461
if( p->mxRail>=GR_MAX_RAIL ) return;
460462
mask = BIT(pRow->iRail);
@@ -469,19 +471,25 @@
469471
}
470472
}
471473
472474
/* Assign rails to all rows that are still unassigned.
473475
*/
476
+ inUse = BIT(p->mxRail+1) - 1;
474477
for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
475478
int parentRid;
476479
477480
if( pRow->iRail>=0 ){
478481
if( pRow->pChild==0 && !pRow->timeWarp ){
479
- if( omitDescenders || pRow->isLeaf ){
480
- /* no-op */
482
+ if( omitDescenders || count_nonbranch_children(pRow->rid)==0 ){
483
+ inUse &= ~BIT(pRow->iRail);
481484
}else{
482485
riser_to_top(pRow);
486
+ /*pRow->aiRiser[pRow->iRail] = 0;
487
+ mask = BIT(pRow->iRail);
488
+ for(pLoop=pRow; pLoop; pLoop=pLoop->pPrev){
489
+ pLoop->railInUse |= mask;
490
+ }*/
483491
}
484492
}
485493
continue;
486494
}
487495
if( pRow->isDup ){
@@ -497,11 +505,11 @@
497505
continue;
498506
}
499507
if( pParent->idx>pRow->idx ){
500508
/* Common case: Child occurs after parent and is above the
501509
** parent in the timeline */
502
- pRow->iRail = findFreeRail(p, 0, pParent->idx, pParent->iRail);
510
+ pRow->iRail = findFreeRail(p, 0, pParent->idx, inUse, pParent->iRail);
503511
if( p->mxRail>=GR_MAX_RAIL ) return;
504512
pParent->aiRiser[pRow->iRail] = pRow->idx;
505513
}else{
506514
/* Timewarp case: Child occurs earlier in time than parent and
507515
** appears below the parent in the timeline. */
@@ -510,21 +518,23 @@
510518
pRow->iRail = ++p->mxRail;
511519
if( p->mxRail>=GR_MAX_RAIL ) return;
512520
pRow->railInUse = BIT(pRow->iRail);
513521
pParent->aiRiser[iDownRail] = pRow->idx;
514522
mask = BIT(iDownRail);
523
+ inUse |= mask;
515524
for(pLoop=p->pFirst; pLoop; pLoop=pLoop->pNext){
516525
pLoop->railInUse |= mask;
517526
}
518527
}
519528
}
520529
mask = BIT(pRow->iRail);
521530
pRow->railInUse |= mask;
522
- if( pRow->pChild ){
531
+ if( pRow->pChild==0 ){
532
+ inUse &= ~mask;
533
+ }else{
534
+ inUse |= mask;
523535
assignChildrenToRail(pRow);
524
- }else if( !pRow->isLeaf && !omitDescenders ){
525
- riser_to_top(pRow);
526536
}
527537
if( pParent ){
528538
for(pLoop=pParent->pPrev; pLoop && pLoop!=pRow; pLoop=pLoop->pPrev){
529539
pLoop->railInUse |= mask;
530540
}
@@ -538,11 +548,11 @@
538548
for(i=1; i<pRow->nParent; i++){
539549
int parentRid = pRow->aParent[i];
540550
pDesc = hashFind(p, parentRid);
541551
if( pDesc==0 ){
542552
/* Merge from a node that is off-screen */
543
- int iMrail = findFreeRail(p, pRow->idx, p->nRow, 0);
553
+ int iMrail = findFreeRail(p, pRow->idx, p->nRow, 0, 0);
544554
if( p->mxRail>=GR_MAX_RAIL ) return;
545555
mask = BIT(iMrail);
546556
pRow->mergeIn[iMrail] = 1;
547557
pRow->mergeDown |= mask;
548558
for(pLoop=pRow->pNext; pLoop; pLoop=pLoop->pNext){
549559
--- src/graph.c
+++ src/graph.c
@@ -218,17 +218,17 @@
218 ** top and bottom, inclusive.
219 */
220 static int findFreeRail(
221 GraphContext *p, /* The graph context */
222 int top, int btm, /* Span of rows for which the rail is needed */
 
223 int iNearto /* Find rail nearest to this rail */
224 ){
225 GraphRow *pRow;
226 int i;
227 int iBest = 0;
228 int iBestDist = 9999;
229 u64 inUseMask = 0;
230 for(pRow=p->pFirst; pRow && pRow->idx<top; pRow=pRow->pNext){}
231 while( pRow && pRow->idx<=btm ){
232 inUseMask |= pRow->railInUse;
233 pRow = pRow->pNext;
234 }
@@ -299,11 +299,12 @@
299 pParent->mergeUpto = pChild->idx;
300 }else{
301 /* The thin merge arrow riser is taller than the thick primary
302 ** child riser, so use separate rails. */
303 int iTarget = pParent->iRail;
304 pParent->mergeOut = findFreeRail(p, pChild->idx, pParent->idx-1, iTarget);
 
305 pParent->mergeUpto = pChild->idx;
306 mask = BIT(pParent->mergeOut);
307 for(pLoop=pChild->pNext; pLoop && pLoop->rid!=pParent->rid;
308 pLoop=pLoop->pNext){
309 pLoop->railInUse |= mask;
@@ -346,10 +347,11 @@
346 */
347 void graph_finish(GraphContext *p, int omitDescenders){
348 GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
349 int i;
350 u64 mask;
 
351 int hasDup = 0; /* True if one or more isDup entries */
352 const char *zTrunk;
353
354 if( p==0 || p->pFirst==0 || p->nErr ) return;
355 p->nErr = 1; /* Assume an error until proven otherwise */
@@ -450,11 +452,11 @@
450 }else {
451 if( pRow->iRail>=0 ) continue;
452 }
453 if( pRow->nParent==0 || hashFind(p,pRow->aParent[0])==0 ){
454 if( omitDescenders ){
455 pRow->iRail = findFreeRail(p, pRow->idxTop, pRow->idx, 0);
456 }else{
457 pRow->iRail = ++p->mxRail;
458 }
459 if( p->mxRail>=GR_MAX_RAIL ) return;
460 mask = BIT(pRow->iRail);
@@ -469,19 +471,25 @@
469 }
470 }
471
472 /* Assign rails to all rows that are still unassigned.
473 */
 
474 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
475 int parentRid;
476
477 if( pRow->iRail>=0 ){
478 if( pRow->pChild==0 && !pRow->timeWarp ){
479 if( omitDescenders || pRow->isLeaf ){
480 /* no-op */
481 }else{
482 riser_to_top(pRow);
 
 
 
 
 
483 }
484 }
485 continue;
486 }
487 if( pRow->isDup ){
@@ -497,11 +505,11 @@
497 continue;
498 }
499 if( pParent->idx>pRow->idx ){
500 /* Common case: Child occurs after parent and is above the
501 ** parent in the timeline */
502 pRow->iRail = findFreeRail(p, 0, pParent->idx, pParent->iRail);
503 if( p->mxRail>=GR_MAX_RAIL ) return;
504 pParent->aiRiser[pRow->iRail] = pRow->idx;
505 }else{
506 /* Timewarp case: Child occurs earlier in time than parent and
507 ** appears below the parent in the timeline. */
@@ -510,21 +518,23 @@
510 pRow->iRail = ++p->mxRail;
511 if( p->mxRail>=GR_MAX_RAIL ) return;
512 pRow->railInUse = BIT(pRow->iRail);
513 pParent->aiRiser[iDownRail] = pRow->idx;
514 mask = BIT(iDownRail);
 
515 for(pLoop=p->pFirst; pLoop; pLoop=pLoop->pNext){
516 pLoop->railInUse |= mask;
517 }
518 }
519 }
520 mask = BIT(pRow->iRail);
521 pRow->railInUse |= mask;
522 if( pRow->pChild ){
 
 
 
523 assignChildrenToRail(pRow);
524 }else if( !pRow->isLeaf && !omitDescenders ){
525 riser_to_top(pRow);
526 }
527 if( pParent ){
528 for(pLoop=pParent->pPrev; pLoop && pLoop!=pRow; pLoop=pLoop->pPrev){
529 pLoop->railInUse |= mask;
530 }
@@ -538,11 +548,11 @@
538 for(i=1; i<pRow->nParent; i++){
539 int parentRid = pRow->aParent[i];
540 pDesc = hashFind(p, parentRid);
541 if( pDesc==0 ){
542 /* Merge from a node that is off-screen */
543 int iMrail = findFreeRail(p, pRow->idx, p->nRow, 0);
544 if( p->mxRail>=GR_MAX_RAIL ) return;
545 mask = BIT(iMrail);
546 pRow->mergeIn[iMrail] = 1;
547 pRow->mergeDown |= mask;
548 for(pLoop=pRow->pNext; pLoop; pLoop=pLoop->pNext){
549
--- src/graph.c
+++ src/graph.c
@@ -218,17 +218,17 @@
218 ** top and bottom, inclusive.
219 */
220 static int findFreeRail(
221 GraphContext *p, /* The graph context */
222 int top, int btm, /* Span of rows for which the rail is needed */
223 u64 inUseMask, /* Mask or rails already in use */
224 int iNearto /* Find rail nearest to this rail */
225 ){
226 GraphRow *pRow;
227 int i;
228 int iBest = 0;
229 int iBestDist = 9999;
 
230 for(pRow=p->pFirst; pRow && pRow->idx<top; pRow=pRow->pNext){}
231 while( pRow && pRow->idx<=btm ){
232 inUseMask |= pRow->railInUse;
233 pRow = pRow->pNext;
234 }
@@ -299,11 +299,12 @@
299 pParent->mergeUpto = pChild->idx;
300 }else{
301 /* The thin merge arrow riser is taller than the thick primary
302 ** child riser, so use separate rails. */
303 int iTarget = pParent->iRail;
304 pParent->mergeOut = findFreeRail(p, pChild->idx, pParent->idx-1,
305 0, iTarget);
306 pParent->mergeUpto = pChild->idx;
307 mask = BIT(pParent->mergeOut);
308 for(pLoop=pChild->pNext; pLoop && pLoop->rid!=pParent->rid;
309 pLoop=pLoop->pNext){
310 pLoop->railInUse |= mask;
@@ -346,10 +347,11 @@
347 */
348 void graph_finish(GraphContext *p, int omitDescenders){
349 GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
350 int i;
351 u64 mask;
352 u64 inUse;
353 int hasDup = 0; /* True if one or more isDup entries */
354 const char *zTrunk;
355
356 if( p==0 || p->pFirst==0 || p->nErr ) return;
357 p->nErr = 1; /* Assume an error until proven otherwise */
@@ -450,11 +452,11 @@
452 }else {
453 if( pRow->iRail>=0 ) continue;
454 }
455 if( pRow->nParent==0 || hashFind(p,pRow->aParent[0])==0 ){
456 if( omitDescenders ){
457 pRow->iRail = findFreeRail(p, pRow->idxTop, pRow->idx, 0, 0);
458 }else{
459 pRow->iRail = ++p->mxRail;
460 }
461 if( p->mxRail>=GR_MAX_RAIL ) return;
462 mask = BIT(pRow->iRail);
@@ -469,19 +471,25 @@
471 }
472 }
473
474 /* Assign rails to all rows that are still unassigned.
475 */
476 inUse = BIT(p->mxRail+1) - 1;
477 for(pRow=p->pLast; pRow; pRow=pRow->pPrev){
478 int parentRid;
479
480 if( pRow->iRail>=0 ){
481 if( pRow->pChild==0 && !pRow->timeWarp ){
482 if( omitDescenders || count_nonbranch_children(pRow->rid)==0 ){
483 inUse &= ~BIT(pRow->iRail);
484 }else{
485 riser_to_top(pRow);
486 /*pRow->aiRiser[pRow->iRail] = 0;
487 mask = BIT(pRow->iRail);
488 for(pLoop=pRow; pLoop; pLoop=pLoop->pPrev){
489 pLoop->railInUse |= mask;
490 }*/
491 }
492 }
493 continue;
494 }
495 if( pRow->isDup ){
@@ -497,11 +505,11 @@
505 continue;
506 }
507 if( pParent->idx>pRow->idx ){
508 /* Common case: Child occurs after parent and is above the
509 ** parent in the timeline */
510 pRow->iRail = findFreeRail(p, 0, pParent->idx, inUse, pParent->iRail);
511 if( p->mxRail>=GR_MAX_RAIL ) return;
512 pParent->aiRiser[pRow->iRail] = pRow->idx;
513 }else{
514 /* Timewarp case: Child occurs earlier in time than parent and
515 ** appears below the parent in the timeline. */
@@ -510,21 +518,23 @@
518 pRow->iRail = ++p->mxRail;
519 if( p->mxRail>=GR_MAX_RAIL ) return;
520 pRow->railInUse = BIT(pRow->iRail);
521 pParent->aiRiser[iDownRail] = pRow->idx;
522 mask = BIT(iDownRail);
523 inUse |= mask;
524 for(pLoop=p->pFirst; pLoop; pLoop=pLoop->pNext){
525 pLoop->railInUse |= mask;
526 }
527 }
528 }
529 mask = BIT(pRow->iRail);
530 pRow->railInUse |= mask;
531 if( pRow->pChild==0 ){
532 inUse &= ~mask;
533 }else{
534 inUse |= mask;
535 assignChildrenToRail(pRow);
 
 
536 }
537 if( pParent ){
538 for(pLoop=pParent->pPrev; pLoop && pLoop!=pRow; pLoop=pLoop->pPrev){
539 pLoop->railInUse |= mask;
540 }
@@ -538,11 +548,11 @@
548 for(i=1; i<pRow->nParent; i++){
549 int parentRid = pRow->aParent[i];
550 pDesc = hashFind(p, parentRid);
551 if( pDesc==0 ){
552 /* Merge from a node that is off-screen */
553 int iMrail = findFreeRail(p, pRow->idx, p->nRow, 0, 0);
554 if( p->mxRail>=GR_MAX_RAIL ) return;
555 mask = BIT(iMrail);
556 pRow->mergeIn[iMrail] = 1;
557 pRow->mergeDown |= mask;
558 for(pLoop=pRow->pNext; pLoop; pLoop=pLoop->pNext){
559

Keyboard Shortcuts

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