Fossil SCM

Try to keep graph nodes from the same branch on the same rail of the graph.

drh 2015-01-26 16:28 UTC mlink-improvements
Commit fcc9f6642ede764b177a7d065ea7aebd8674839d
1 file changed +21
+21
--- src/graph.c
+++ src/graph.c
@@ -378,10 +378,31 @@
378378
i--;
379379
}
380380
}
381381
}
382382
}
383
+
384
+ /* If the primary parent is in a different branch, but there are
385
+ ** other parents in the same branch, reorder the parents to make
386
+ ** the parent from the same branch the primary parent.
387
+ */
388
+ for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
389
+ if( pRow->isDup ) continue;
390
+ if( pRow->nParent<2 ) continue; /* Not a fork */
391
+ pParent = hashFind(p, pRow->aParent[0]);
392
+ if( pParent==0 ) continue; /* Parent off-screen */
393
+ if( pParent->zBranch==pRow->zBranch ) continue; /* Same branch */
394
+ for(i=1; i<pRow->nParent; i++){
395
+ pParent = hashFind(p, pRow->aParent[i]);
396
+ if( pParent->zBranch==pRow->zBranch ){
397
+ int t = pRow->aParent[0];
398
+ pRow->aParent[0] = pRow->aParent[i];
399
+ pRow->aParent[i] = t;
400
+ break;
401
+ }
402
+ }
403
+ }
383404
384405
385406
/* Find the pChild pointer for each node.
386407
**
387408
** The pChild points to the node directly above on the same rail.
388409
--- src/graph.c
+++ src/graph.c
@@ -378,10 +378,31 @@
378 i--;
379 }
380 }
381 }
382 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
384
385 /* Find the pChild pointer for each node.
386 **
387 ** The pChild points to the node directly above on the same rail.
388
--- src/graph.c
+++ src/graph.c
@@ -378,10 +378,31 @@
378 i--;
379 }
380 }
381 }
382 }
383
384 /* If the primary parent is in a different branch, but there are
385 ** other parents in the same branch, reorder the parents to make
386 ** the parent from the same branch the primary parent.
387 */
388 for(pRow=p->pFirst; pRow; pRow=pRow->pNext){
389 if( pRow->isDup ) continue;
390 if( pRow->nParent<2 ) continue; /* Not a fork */
391 pParent = hashFind(p, pRow->aParent[0]);
392 if( pParent==0 ) continue; /* Parent off-screen */
393 if( pParent->zBranch==pRow->zBranch ) continue; /* Same branch */
394 for(i=1; i<pRow->nParent; i++){
395 pParent = hashFind(p, pRow->aParent[i]);
396 if( pParent->zBranch==pRow->zBranch ){
397 int t = pRow->aParent[0];
398 pRow->aParent[0] = pRow->aParent[i];
399 pRow->aParent[i] = t;
400 break;
401 }
402 }
403 }
404
405
406 /* Find the pChild pointer for each node.
407 **
408 ** The pChild points to the node directly above on the same rail.
409

Keyboard Shortcuts

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