Fossil

Check-in [9ed13436]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the logic that combines merge risers (originally added to trunk by check-in [95d6ddc3]). Add test cases for this fix to graph-test-1.wiki.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9ed134360bf9b46c46691494b0dec2aecb15ef66
User & Date: drh 2016-12-14 01:09:46
Context
2016-12-19
07:04
Enhance TH1 'redirect' command to support for HTTP redirects with a status code of 307. check-in: bee6dbde user: mistachkin tags: trunk
2016-12-15
22:46
First jab at creating a bash script for command completion Leaf check-in: a4de0004 user: baruch tags: bash-completion
2016-12-14
01:09
Fix the logic that combines merge risers (originally added to trunk by check-in [95d6ddc3]). Add test cases for this fix to graph-test-1.wiki. check-in: 9ed13436 user: drh tags: trunk
2016-12-08
20:10
Bring the change log up-to-date with the latest enhancements. check-in: d1a6222e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/graph.c.

   338    338       pRow = pRow->pPrev;
   339    339     }
   340    340   }
   341    341   
   342    342   
   343    343   /*
   344    344   ** Compute the complete graph
          345  +**
          346  +** When primary or merge parents are off-screen, normally a line is drawn
          347  +** from the node down to the bottom of the graph.  This line is called a
          348  +** "descender".  But if the omitDescenders flag is true, then lines down
          349  +** to the bottom of the screen are omitted.
   345    350   */
   346    351   void graph_finish(GraphContext *p, int omitDescenders){
   347    352     GraphRow *pRow, *pDesc, *pDup, *pLoop, *pParent;
   348    353     int i, j;
   349    354     u64 mask;
   350    355     int hasDup = 0;      /* True if one or more isDup entries */
   351    356     const char *zTrunk;
   352         -  int railRid[GR_MAX_RAIL]; /* Maps rails to rids for lines
   353         -                               that enter from bottom of screen */
          357  +
          358  +  /* If mergeRiserFrom[X]==Y that means rail X holds a merge riser
          359  +  ** coming up from the bottom of the graph from off-screen check-in Y
          360  +  ** where Y is the RID.  There is no riser on rail X if mergeRiserFrom[X]==0.
          361  +  */
          362  +  int mergeRiserFrom[GR_MAX_RAIL];
   354    363   
   355    364     if( p==0 || p->pFirst==0 || p->nErr ) return;
   356    365     p->nErr = 1;   /* Assume an error until proven otherwise */
   357    366   
   358    367     /* Initialize all rows */
   359    368     p->nHash = p->nRow*2 + 1;
   360    369     p->apHash = safeMalloc( sizeof(p->apHash[0])*p->nHash );
................................................................................
   365    374       if( (pDup = hashFind(p, pRow->rid))!=0 ){
   366    375         hasDup = 1;
   367    376         pDup->isDup = 1;
   368    377       }
   369    378       hashInsert(p, pRow, 1);
   370    379     }
   371    380     p->mxRail = -1;
   372         -  memset(railRid, 0, sizeof(railRid));
          381  +  memset(mergeRiserFrom, 0, sizeof(mergeRiserFrom));
   373    382   
   374    383     /* Purge merge-parents that are out-of-graph if descenders are not
   375    384     ** drawn.
   376    385     **
   377    386     ** Each node has one primary parent and zero or more "merge" parents.
   378    387     ** A merge parent is a prior check-in from which changes were merged into
   379    388     ** the current check-in.  If a merge parent is not in the visible section
................................................................................
   458    467           }else{
   459    468             pRow->iRail = ++p->mxRail;
   460    469           }
   461    470           if( p->mxRail>=GR_MAX_RAIL ) return;
   462    471           mask = BIT(pRow->iRail);
   463    472           if( !omitDescenders ){
   464    473             pRow->bDescender = pRow->nParent>0;
   465         -          if( pRow->bDescender ){
   466         -            railRid[pRow->iRail] = pRow->aParent[0];
   467         -          }
   468    474             for(pLoop=pRow; pLoop; pLoop=pLoop->pNext){
   469    475               pLoop->railInUse |= mask;
   470    476             }
   471    477           }
   472    478           assignChildrenToRail(pRow);
   473    479         }
   474    480       }
................................................................................
   541    547       for(i=1; i<pRow->nParent; i++){
   542    548         int parentRid = pRow->aParent[i];
   543    549         pDesc = hashFind(p, parentRid);
   544    550         if( pDesc==0 ){
   545    551           /* Merge from a node that is off-screen */
   546    552           int iMrail = -1;
   547    553           for(j=0; j<GR_MAX_RAIL; j++){
   548         -          if( railRid[j]==parentRid ){
          554  +          if( mergeRiserFrom[j]==parentRid ){
   549    555               iMrail = j;
   550    556               break;
   551    557             }
   552    558           }
   553    559           if( iMrail==-1 ){
   554    560             iMrail = findFreeRail(p, pRow->idx, p->nRow, 0);
   555    561             if( p->mxRail>=GR_MAX_RAIL ) return;
   556         -          railRid[iMrail] = parentRid;
          562  +          mergeRiserFrom[iMrail] = parentRid;
   557    563           }
   558    564           mask = BIT(iMrail);
   559    565           pRow->mergeIn[iMrail] = 1;
   560    566           pRow->mergeDown |= mask;
   561    567           for(pLoop=pRow->pNext; pLoop; pLoop=pLoop->pNext){
   562    568             pLoop->railInUse |= mask;
   563    569           }

Changes to test/graph-test-1.wiki.

    67     67        target="testwindow">
    68     68        This timeline has a hidden commit.</a> Click Unhide to reveal.
    69     69     *  <a href="../../../timeline?y=ci&n=15&b=2a4e4cf03e"
    70     70        target="testwindow">Isolated check-ins.</a>
    71     71     *  <a href="../../../timeline?b=0fa60142&n=50"
    72     72        target="testwindow">Single branch raiser from bottom of page
    73     73        up to checkins 057e4b and d3cc6d</a>
           74  +  *  <a href="../../../timeline?a=68194175&n=2"
           75  +     target="testwindow">Branch riser comes from the bottom of the screen</a>
           76  +  *  <a href="../../../timeline?a=2bc3cfeb&n=5"
           77  +     target="testwindow">Branch risers comes from the bottom of the
           78  +     screen, not from the andygoth-crlf branch.</a>
           79  +  *  <a href="../../../timeline?a=b8c7af5b&n=12"
           80  +     target="testwindow">Check-in 2de15c8e has merge arrows from two
           81  +     different trunk check-ins.  One of the merge risers also branches
           82  +     to check-in ea7f3297</a>
    74     83   
    75     84   External:
    76     85   
    77     86     *  <a href="http://www.sqlite.org/src/timeline?c=2010-09-29&nd"
    78     87        target="testwindow">Timewarp due to a mis-configured system clock.</a>
    79     88     *  <a href="http://core.tcl.tk/tk/finfo?name=tests/id.test"
    80     89        target="testwindow">Show all three separate deletions of "id.test".