Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved graph display when a single checkin is the parent of both a normal and a cherrypick merge. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
30aec47aa0cf8d2c6dcc1da8534eb802 |
User & Date: | drh 2018-12-28 16:21:56.150 |
Context
2018-12-28
| ||
16:52 | Add compression to the built-in javascript. Update comments on graph.js. ... (check-in: 4da95b25 user: drh tags: trunk) | |
16:21 | Improved graph display when a single checkin is the parent of both a normal and a cherrypick merge. ... (check-in: 30aec47a user: drh tags: trunk) | |
02:01 | In /timeline, the cherrypicks query parameter puts the graph into "disjoint" mode, which displays much better for the data it is presenting. ... (check-in: 35e892b4 user: drh tags: trunk) | |
Changes
Changes to src/graph.c.
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 | u8 timeWarp; /* Child is earlier in time */ u8 bDescender; /* True if riser from bottom of graph to here. */ i8 iRail; /* Which rail this check-in appears on. 0-based.*/ i8 mergeOut; /* Merge out to this rail. -1 if no merge-out */ u8 mergeIn[GR_MAX_RAIL]; /* Merge in from non-zero rails */ int aiRiser[GR_MAX_RAIL]; /* Risers from this node to a higher row. */ int mergeUpto; /* Draw the mergeOut rail up to this level */ u64 mergeDown; /* Draw merge lines up from bottom of graph */ u64 cherrypickDown; /* Draw cherrypick lines up from bottom */ u64 railInUse; /* Mask of occupied rails at this row */ }; /* Context while building a graph | > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | u8 timeWarp; /* Child is earlier in time */ u8 bDescender; /* True if riser from bottom of graph to here. */ i8 iRail; /* Which rail this check-in appears on. 0-based.*/ i8 mergeOut; /* Merge out to this rail. -1 if no merge-out */ u8 mergeIn[GR_MAX_RAIL]; /* Merge in from non-zero rails */ int aiRiser[GR_MAX_RAIL]; /* Risers from this node to a higher row. */ int mergeUpto; /* Draw the mergeOut rail up to this level */ int cherrypickUpto; /* Continue the mergeOut rail up to here */ u64 mergeDown; /* Draw merge lines up from bottom of graph */ u64 cherrypickDown; /* Draw cherrypick lines up from bottom */ u64 railInUse; /* Mask of occupied rails at this row */ }; /* Context while building a graph |
︙ | ︙ | |||
306 307 308 309 310 311 312 | if( pParent->mergeOut<0 ){ u = pParent->aiRiser[pParent->iRail]; if( u>=0 && u<pChild->idx ){ /* The thick arrow up to the next primary child of pDesc goes ** further up than the thin merge arrow riser, so draw them both ** on the same rail. */ pParent->mergeOut = pParent->iRail; | < | < | > > > > > > > | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | if( pParent->mergeOut<0 ){ u = pParent->aiRiser[pParent->iRail]; if( u>=0 && u<pChild->idx ){ /* The thick arrow up to the next primary child of pDesc goes ** further up than the thin merge arrow riser, so draw them both ** on the same rail. */ pParent->mergeOut = pParent->iRail; }else{ /* The thin merge arrow riser is taller than the thick primary ** child riser, so use separate rails. */ int iTarget = pParent->iRail; pParent->mergeOut = findFreeRail(p, pChild->idx, pParent->idx-1, iTarget); mask = BIT(pParent->mergeOut); for(pLoop=pChild->pNext; pLoop && pLoop->rid!=pParent->rid; pLoop=pLoop->pNext){ pLoop->railInUse |= mask; } } } if( isCherrypick ){ if( pParent->cherrypickUpto==0 || pParent->cherrypickUpto > pChild->idx ){ pParent->cherrypickUpto = pChild->idx; } }else{ pParent->hasNormalOutMerge = 1; if( pParent->mergeUpto==0 || pParent->mergeUpto > pChild->idx ){ pParent->mergeUpto = pChild->idx; } } pChild->mergeIn[pParent->mergeOut] = isCherrypick ? 2 : 1; } /* ** Compute the maximum rail number. */ |
︙ | ︙ |
Changes to src/graph.js.
︙ | ︙ | |||
19 20 21 22 23 24 25 | ** "rowinfo": ROWINFO-ARRAY } ** ** The rowinfo field is an array of structures, one per entry in the timeline, ** where each structure has the following fields: ** ** id: The id of the <div> element for the row. This is an integer. ** to get an actual id, prepend "m" to the integer. The top node | | | | | | > > > > > > | > > | > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ** "rowinfo": ROWINFO-ARRAY } ** ** The rowinfo field is an array of structures, one per entry in the timeline, ** where each structure has the following fields: ** ** id: The id of the <div> element for the row. This is an integer. ** to get an actual id, prepend "m" to the integer. The top node ** is iTopRow and numbers increase moving down the timeline. ** bg: The background color for this row ** r: The "rail" that the node for this row sits on. The left-most ** rail is 0 and the number increases to the right. ** d: If exists and true then there is a "descender" - an arrow ** coming from the bottom of the page straight up to this node. ** mo: "merge-out". If it exists, this is the rail position ** for the upward portion of a merge arrow. The merge arrow goes up ** to the row identified by mu:. If this value is omitted then ** node has no merge children and no merge-out line is drawn. ** mu: The id of the row which is the top of the merge-out arrow. ** Only exists if "mo" exists. ** cu: The id of the top row of the merge-out arrow for a cherrypick ** merge arrow that extends beyond the main merge arrow. Only ** exists if "mo" exists and if there is a cherrpick merge that is ** higher than "mu". ** u: Draw a thick child-line out of the top of this node and up to ** the node with an id equal to this value. 0 if it is straight to ** the top of the page, -1 if there is no thick-line riser. ** f: 0x01: a leaf node. ** 0x02: all output merges are cherrypicks ** au: An array of integers that define thick-line risers for branches. ** The integers are in pairs. For each pair, the first integer is ** is the rail on which the riser should run and the second integer ** is the id of the node upto which the riser should run. If there ** are no risers, this array does not exist. ** mi: "merge-in". An array of integer rail positions from which ** merge arrows should be drawn into this node. If the value is ** negative, then the rail position is the absolute value of mi[] ** and a thin merge-arrow descender is drawn to the bottom of ** the screen. This array is omitted if there are no inbound ** merges. ** ci: "cherrypick-in". Like "mi" except for cherrypick merges. ** omitted if there are no cherrypick merges. ** h: The artifact hash of the object being graphed */ var amendCssOnce = 1; // Only change the CSS one time function amendCss(circleNodes,showArrowheads){ if( !amendCssOnce ) return; var css = ""; if( circleNodes ){ |
︙ | ︙ | |||
242 243 244 245 246 247 248 | if( p.hasOwnProperty('d') ) drawUpArrow({x: p.x, y: btm-node.h/2},p,p.fg); } if( p.hasOwnProperty('mo') ){ var x0 = p.x + node.w/2; var x1 = p.mo*railPitch + node.w/2; var u = tx.rowinfo[p.mu-tx.iTopRow]; var y1 = miLineY(u); | < > > > > | | > > > > > > > | > > > > > > | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | if( p.hasOwnProperty('d') ) drawUpArrow({x: p.x, y: btm-node.h/2},p,p.fg); } if( p.hasOwnProperty('mo') ){ var x0 = p.x + node.w/2; var x1 = p.mo*railPitch + node.w/2; var u = tx.rowinfo[p.mu-tx.iTopRow]; var y1 = miLineY(u); if( p.u<0 || p.mo!=p.r ){ x1 += mergeLines[p.mo] = -mLine.w/2; var y0 = p.y+2; if( p.mu==p.id ){ drawCherrypickLine(x0,y0,x1+(x0<x1 ? mLine.w : 0),null); y1 = y0; }else{ drawMergeLine(x0,y0,x1+(x0<x1 ? mLine.w : 0),null); drawMergeLine(x1,y0+mLine.w,null,y1); } if( p.hasOwnProperty('cu') ){ var u2 = tx.rowinfo[p.cu-tx.iTopRow]; var y2 = miLineY(u2); drawCherrypickLine(x1,y1,null,y2); } }else if( mergeOffset ){ mergeLines[p.mo] = u.r<p.r ? -mergeOffset-mLine.w : mergeOffset; x1 += mergeLines[p.mo]; if( p.mo<p.id ){ drawMergeLine(x1,p.y+node.h/2,null,y1); } if( p.hasOwnProperty('cu') ){ var u2 = tx.rowinfo[p.cu-tx.iTopRow]; var y2 = miLineY(u2); drawCherrypickLine(x1,y1,null,y2); } }else{ delete mergeLines[p.mo]; } } if( p.hasOwnProperty('au') ){ for( var i=0; i<p.au.length; i+=2 ){ var rail = p.au[i]; |
︙ | ︙ | |||
289 290 291 292 293 294 295 | if( p.hasOwnProperty('mi') ){ for( var i=0; i<p.mi.length; i++ ){ var rail = p.mi[i]; if( rail<0 ){ rail = -rail; mergeLines[rail] = -mLine.w/2; var x = rail*railPitch + (node.w-mLine.w)/2; | > | > | | | > | > > > | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | if( p.hasOwnProperty('mi') ){ for( var i=0; i<p.mi.length; i++ ){ var rail = p.mi[i]; if( rail<0 ){ rail = -rail; mergeLines[rail] = -mLine.w/2; var x = rail*railPitch + (node.w-mLine.w)/2; var y = miLineY(p); drawMergeLine(x,y,null,mergeBtm[rail]); mergeBtm[rail] = y; } drawMergeArrow(p,rail,0); } } if( p.hasOwnProperty('ci') ){ for( var i=0; i<p.ci.length; i++ ){ var rail = p.ci[i]; if( rail<0 ){ rail = -rail; mergeLines[rail] = -mLine.w/2; var x = rail*railPitch + (node.w-mLine.w)/2; var y = miLineY(p); drawCherrypickLine(x,y,null,mergeBtm[rail]); mergeBtm[rail] = y; } drawMergeArrow(p,rail,1); } } } var mergeLines; var mergeBtm = new Array; function renderGraph(){ mergeLines = {}; canvasDiv.innerHTML = ""; var canvasY = absoluteY(canvasDiv); for(var i=0; i<tx.rowinfo.length; i++ ){ var e = document.getElementById("m"+tx.rowinfo[i].id); tx.rowinfo[i].y = absoluteY(e) - canvasY; tx.rowinfo[i].x = tx.rowinfo[i].r*railPitch; } var tlBtm = document.querySelector(".timelineBottom"); if( tlBtm.offsetHeight<node.h ){ tlBtm.style.height = node.h + "px"; } var btm = absoluteY(tlBtm) - canvasY + tlBtm.offsetHeight; for( var i=0; i<tx.nrail; i++) mergeBtm[i] = btm; for( var i=tx.rowinfo.length-1; i>=0; i-- ){ drawNode(tx.rowinfo[i], btm); } } var selRow; function clickOnNode(){ var p = tx.rowinfo[parseInt(this.id.match(/\d+$/)[0], 10)-tx.iTopRow]; |
︙ | ︙ |
Changes to src/timeline.c.
︙ | ︙ | |||
864 865 866 867 868 869 870 | ** is iTopRow and numbers increase moving down the timeline. ** bg: The background color for this row ** r: The "rail" that the node for this row sits on. The left-most ** rail is 0 and the number increases to the right. ** d: If exists and true then there is a "descender" - an arrow ** coming from the bottom of the page straight up to this node. ** mo: "merge-out". If it exists, this is the rail position | | | > | > > < | > > > > < | 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | ** is iTopRow and numbers increase moving down the timeline. ** bg: The background color for this row ** r: The "rail" that the node for this row sits on. The left-most ** rail is 0 and the number increases to the right. ** d: If exists and true then there is a "descender" - an arrow ** coming from the bottom of the page straight up to this node. ** mo: "merge-out". If it exists, this is the rail position ** for the upward portion of a merge arrow. The merge arrow goes as ** a solid normal merge line up to the row identified by "mu" and ** then as a dashed cherrypick merge line up further to "cu". ** If this value is omitted if there are no merge children. ** mu: The id of the row which is the top of the merge-out arrow. ** Only exists if "mo" exists. ** cu: Extend the mu merge error on up to this row as a cherrypick ** merge line, if this value exists. ** u: Draw a thick child-line out of the top of this node and up to ** the node with an id equal to this value. 0 if it is straight to ** the top of the page, -1 if there is no thick-line riser. ** f: 0x01: a leaf node. ** au: An array of integers that define thick-line risers for branches. ** The integers are in pairs. For each pair, the first integer is ** is the rail on which the riser should run and the second integer ** is the id of the node upto which the riser should run. If there ** are no risers, this array does not exist. ** mi: "merge-in". An array of integer rail positions from which ** merge arrows should be drawn into this node. If the value is ** negative, then the rail position is the absolute value of mi[] ** and a thin merge-arrow descender is drawn to the bottom of ** the screen. This array is omitted if there are no inbound ** merges. ** ci: "cherrypick-in". Like "mi" except for cherrypick merges. ** omitted if there are no cherrypick merges. ** h: The artifact hash of the object being graphed */ for(pRow=pGraph->pFirst; pRow; pRow=pRow->pNext){ int k = 0; cgi_printf("{\"id\":%d,", pRow->idx); cgi_printf("\"bg\":\"%s\",", pRow->zBgClr); cgi_printf("\"r\":%d,", pRow->iRail); if( pRow->bDescender ){ cgi_printf("\"d\":%d,", pRow->bDescender); } if( pRow->mergeOut>=0 ){ cgi_printf("\"mo\":%d,", pRow->mergeOut); if( pRow->mergeUpto==0 ) pRow->mergeUpto = pRow->idx; cgi_printf("\"mu\":%d,", pRow->mergeUpto); if( pRow->cherrypickUpto>0 && pRow->cherrypickUpto<pRow->mergeUpto ){ cgi_printf("\"cu\":%d,", pRow->cherrypickUpto); } } cgi_printf("\"u\":%d,", pRow->aiRiser[pRow->iRail]); k = 0; if( pRow->isLeaf ) k |= 1; cgi_printf("\"f\":%d,",k); for(i=k=0; i<GR_MAX_RAIL; i++){ if( i==pRow->iRail ) continue; if( pRow->aiRiser[i]>0 ){ if( k==0 ){ cgi_printf("\"au\":"); cSep = '['; |
︙ | ︙ | |||
939 940 941 942 943 944 945 | } k++; cgi_printf("%c%d", cSep, mi); cSep = ','; } } if( k ) cgi_printf("],"); | | | | 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | } k++; cgi_printf("%c%d", cSep, mi); cSep = ','; } } if( k ) cgi_printf("],"); /* ci */ for(i=k=0; i<GR_MAX_RAIL; i++){ if( pRow->mergeIn[i]==2 ){ int mi = i; if( (pRow->cherrypickDown >> i) & 1 ) mi = -mi; if( k==0 ){ cgi_printf("\"ci\":"); cSep = '['; } k++; cgi_printf("%c%d", cSep, mi); cSep = ','; } } |
︙ | ︙ |
Changes to test/graph-test-1.wiki.
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | to check-in ea7f3297</a> * <a href="../../../timeline?b=ae8709e2&n=25" target="testwindow"> Cherrypick merge arrows</a> * <a href="../../../timeline?r=branch-1.37" target="testwindow">Branch 1.37 with cherry-pick merges from trunk.</a> * <a href="../../../timeline?f=68bd2e7bedb8d05a" target="testwindow"> Single check-in takes both a full merge and a cherrypick merge</a> External: * <a href="http://www.sqlite.org/src/timeline?c=2010-09-29&nd" target="testwindow">Timewarp due to a mis-configured system clock.</a> * <a href="http://core.tcl.tk/tk/finfo?name=tests/id.test" target="testwindow">Show all three separate deletions of "id.test". | > > > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | to check-in ea7f3297</a> * <a href="../../../timeline?b=ae8709e2&n=25" target="testwindow"> Cherrypick merge arrows</a> * <a href="../../../timeline?r=branch-1.37" target="testwindow">Branch 1.37 with cherry-pick merges from trunk.</a> * <a href="../../../timeline?f=68bd2e7bedb8d05a" target="testwindow"> Single check-in takes both a full merge and a cherrypick merge</a> * <a href="../../../timeline?b=?b=dc81ac70&n=14" target="testwindow"> Mixed merge arrow, partly fully and partly cherrypick</a> * <a href="../../../timeline?b=?b=dc81ac70&n=13" target="testwindow"> Mixed merge arrow to bottom of screen.</a> External: * <a href="http://www.sqlite.org/src/timeline?c=2010-09-29&nd" target="testwindow">Timewarp due to a mis-configured system clock.</a> * <a href="http://core.tcl.tk/tk/finfo?name=tests/id.test" target="testwindow">Show all three separate deletions of "id.test". |
︙ | ︙ |