Fossil SCM
Fix a bug in timeline graph generation.
Commit
399d1ca0006bf2f51c353a807f5b139bbb676041
Parent
c5f3e87bb0e1198…
1 file changed
+10
-4
+10
-4
| --- src/graph.c | ||
| +++ src/graph.c | ||
| @@ -152,12 +152,11 @@ | ||
| 152 | 152 | |
| 153 | 153 | /* |
| 154 | 154 | ** Return the index of a rail currently not in use for any row between |
| 155 | 155 | ** top and bottom, inclusive. |
| 156 | 156 | */ |
| 157 | -static int findFreeRail(GraphContext *p, int top, int btm){ | |
| 158 | - u32 inUseMask = 0; | |
| 157 | +static int findFreeRail(GraphContext *p, int top, int btm, u32 inUseMask){ | |
| 159 | 158 | GraphRow *pRow; |
| 160 | 159 | int i; |
| 161 | 160 | for(pRow=p->pFirst; pRow && pRow->idx<top; pRow=pRow->pNext){} |
| 162 | 161 | while( pRow && pRow->idx<=btm ){ |
| 163 | 162 | inUseMask |= pRow->railInUse; |
| @@ -177,10 +176,11 @@ | ||
| 177 | 176 | GraphRow *pRow, *pDesc; |
| 178 | 177 | Bag allRids; |
| 179 | 178 | int i; |
| 180 | 179 | int nRow; |
| 181 | 180 | u32 mask; |
| 181 | + u32 inUse; | |
| 182 | 182 | |
| 183 | 183 | if( p==0 || p->pFirst==0 || p->nErr ) return; |
| 184 | 184 | |
| 185 | 185 | /* Initialize all rows */ |
| 186 | 186 | bag_init(&allRids); |
| @@ -221,10 +221,11 @@ | ||
| 221 | 221 | |
| 222 | 222 | /* Assign rails to all rows that are still unassigned. |
| 223 | 223 | ** The first primary child of a row goes on the same rail as |
| 224 | 224 | ** that row. |
| 225 | 225 | */ |
| 226 | + inUse = 0; | |
| 226 | 227 | for(pRow=p->pLast; pRow; pRow=pRow->pPrev){ |
| 227 | 228 | int parentRid; |
| 228 | 229 | if( pRow->iRail>=0 ) continue; |
| 229 | 230 | assert( pRow->nParent>0 ); |
| 230 | 231 | parentRid = pRow->aParent[0]; |
| @@ -232,14 +233,19 @@ | ||
| 232 | 233 | for(pDesc=pRow->pNext; pDesc && pDesc->rid!=parentRid; pDesc=pDesc->pNext){} |
| 233 | 234 | assert( pDesc!=0 ); |
| 234 | 235 | if( pDesc->aiRaiser[pDesc->iRail]==0 && pDesc->zBranch==pRow->zBranch ){ |
| 235 | 236 | pRow->iRail = pDesc->iRail; |
| 236 | 237 | }else{ |
| 237 | - pRow->iRail = findFreeRail(p, 0, pDesc->idx); | |
| 238 | + pRow->iRail = findFreeRail(p, 0, pDesc->idx, inUse); | |
| 238 | 239 | } |
| 239 | 240 | pDesc->aiRaiser[pRow->iRail] = pRow->idx; |
| 240 | 241 | mask = 1<<pRow->iRail; |
| 242 | + if( pRow->isLeaf ){ | |
| 243 | + inUse &= ~mask; | |
| 244 | + }else{ | |
| 245 | + inUse |= mask; | |
| 246 | + } | |
| 241 | 247 | for(pDesc = pRow; ; pDesc=pDesc->pNext){ |
| 242 | 248 | assert( pDesc!=0 ); |
| 243 | 249 | pDesc->railInUse |= mask; |
| 244 | 250 | if( pDesc->rid==parentRid ) break; |
| 245 | 251 | } |
| @@ -253,11 +259,11 @@ | ||
| 253 | 259 | int parentRid = pRow->aParent[i]; |
| 254 | 260 | for(pDesc=pRow->pNext; pDesc && pDesc->rid!=parentRid; |
| 255 | 261 | pDesc=pDesc->pNext){} |
| 256 | 262 | if( pDesc==0 ) continue; |
| 257 | 263 | if( pDesc->mergeOut<0 ){ |
| 258 | - pDesc->mergeOut = findFreeRail(p, pRow->idx, pDesc->idx); | |
| 264 | + pDesc->mergeOut = findFreeRail(p, pRow->idx, pDesc->idx, 0); | |
| 259 | 265 | pDesc->mergeUpto = pRow->idx; |
| 260 | 266 | } |
| 261 | 267 | pRow->mergeIn |= 1<<pDesc->mergeOut; |
| 262 | 268 | } |
| 263 | 269 | } |
| 264 | 270 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -152,12 +152,11 @@ | |
| 152 | |
| 153 | /* |
| 154 | ** Return the index of a rail currently not in use for any row between |
| 155 | ** top and bottom, inclusive. |
| 156 | */ |
| 157 | static int findFreeRail(GraphContext *p, int top, int btm){ |
| 158 | u32 inUseMask = 0; |
| 159 | GraphRow *pRow; |
| 160 | int i; |
| 161 | for(pRow=p->pFirst; pRow && pRow->idx<top; pRow=pRow->pNext){} |
| 162 | while( pRow && pRow->idx<=btm ){ |
| 163 | inUseMask |= pRow->railInUse; |
| @@ -177,10 +176,11 @@ | |
| 177 | GraphRow *pRow, *pDesc; |
| 178 | Bag allRids; |
| 179 | int i; |
| 180 | int nRow; |
| 181 | u32 mask; |
| 182 | |
| 183 | if( p==0 || p->pFirst==0 || p->nErr ) return; |
| 184 | |
| 185 | /* Initialize all rows */ |
| 186 | bag_init(&allRids); |
| @@ -221,10 +221,11 @@ | |
| 221 | |
| 222 | /* Assign rails to all rows that are still unassigned. |
| 223 | ** The first primary child of a row goes on the same rail as |
| 224 | ** that row. |
| 225 | */ |
| 226 | for(pRow=p->pLast; pRow; pRow=pRow->pPrev){ |
| 227 | int parentRid; |
| 228 | if( pRow->iRail>=0 ) continue; |
| 229 | assert( pRow->nParent>0 ); |
| 230 | parentRid = pRow->aParent[0]; |
| @@ -232,14 +233,19 @@ | |
| 232 | for(pDesc=pRow->pNext; pDesc && pDesc->rid!=parentRid; pDesc=pDesc->pNext){} |
| 233 | assert( pDesc!=0 ); |
| 234 | if( pDesc->aiRaiser[pDesc->iRail]==0 && pDesc->zBranch==pRow->zBranch ){ |
| 235 | pRow->iRail = pDesc->iRail; |
| 236 | }else{ |
| 237 | pRow->iRail = findFreeRail(p, 0, pDesc->idx); |
| 238 | } |
| 239 | pDesc->aiRaiser[pRow->iRail] = pRow->idx; |
| 240 | mask = 1<<pRow->iRail; |
| 241 | for(pDesc = pRow; ; pDesc=pDesc->pNext){ |
| 242 | assert( pDesc!=0 ); |
| 243 | pDesc->railInUse |= mask; |
| 244 | if( pDesc->rid==parentRid ) break; |
| 245 | } |
| @@ -253,11 +259,11 @@ | |
| 253 | int parentRid = pRow->aParent[i]; |
| 254 | for(pDesc=pRow->pNext; pDesc && pDesc->rid!=parentRid; |
| 255 | pDesc=pDesc->pNext){} |
| 256 | if( pDesc==0 ) continue; |
| 257 | if( pDesc->mergeOut<0 ){ |
| 258 | pDesc->mergeOut = findFreeRail(p, pRow->idx, pDesc->idx); |
| 259 | pDesc->mergeUpto = pRow->idx; |
| 260 | } |
| 261 | pRow->mergeIn |= 1<<pDesc->mergeOut; |
| 262 | } |
| 263 | } |
| 264 |
| --- src/graph.c | |
| +++ src/graph.c | |
| @@ -152,12 +152,11 @@ | |
| 152 | |
| 153 | /* |
| 154 | ** Return the index of a rail currently not in use for any row between |
| 155 | ** top and bottom, inclusive. |
| 156 | */ |
| 157 | static int findFreeRail(GraphContext *p, int top, int btm, u32 inUseMask){ |
| 158 | GraphRow *pRow; |
| 159 | int i; |
| 160 | for(pRow=p->pFirst; pRow && pRow->idx<top; pRow=pRow->pNext){} |
| 161 | while( pRow && pRow->idx<=btm ){ |
| 162 | inUseMask |= pRow->railInUse; |
| @@ -177,10 +176,11 @@ | |
| 176 | GraphRow *pRow, *pDesc; |
| 177 | Bag allRids; |
| 178 | int i; |
| 179 | int nRow; |
| 180 | u32 mask; |
| 181 | u32 inUse; |
| 182 | |
| 183 | if( p==0 || p->pFirst==0 || p->nErr ) return; |
| 184 | |
| 185 | /* Initialize all rows */ |
| 186 | bag_init(&allRids); |
| @@ -221,10 +221,11 @@ | |
| 221 | |
| 222 | /* Assign rails to all rows that are still unassigned. |
| 223 | ** The first primary child of a row goes on the same rail as |
| 224 | ** that row. |
| 225 | */ |
| 226 | inUse = 0; |
| 227 | for(pRow=p->pLast; pRow; pRow=pRow->pPrev){ |
| 228 | int parentRid; |
| 229 | if( pRow->iRail>=0 ) continue; |
| 230 | assert( pRow->nParent>0 ); |
| 231 | parentRid = pRow->aParent[0]; |
| @@ -232,14 +233,19 @@ | |
| 233 | for(pDesc=pRow->pNext; pDesc && pDesc->rid!=parentRid; pDesc=pDesc->pNext){} |
| 234 | assert( pDesc!=0 ); |
| 235 | if( pDesc->aiRaiser[pDesc->iRail]==0 && pDesc->zBranch==pRow->zBranch ){ |
| 236 | pRow->iRail = pDesc->iRail; |
| 237 | }else{ |
| 238 | pRow->iRail = findFreeRail(p, 0, pDesc->idx, inUse); |
| 239 | } |
| 240 | pDesc->aiRaiser[pRow->iRail] = pRow->idx; |
| 241 | mask = 1<<pRow->iRail; |
| 242 | if( pRow->isLeaf ){ |
| 243 | inUse &= ~mask; |
| 244 | }else{ |
| 245 | inUse |= mask; |
| 246 | } |
| 247 | for(pDesc = pRow; ; pDesc=pDesc->pNext){ |
| 248 | assert( pDesc!=0 ); |
| 249 | pDesc->railInUse |= mask; |
| 250 | if( pDesc->rid==parentRid ) break; |
| 251 | } |
| @@ -253,11 +259,11 @@ | |
| 259 | int parentRid = pRow->aParent[i]; |
| 260 | for(pDesc=pRow->pNext; pDesc && pDesc->rid!=parentRid; |
| 261 | pDesc=pDesc->pNext){} |
| 262 | if( pDesc==0 ) continue; |
| 263 | if( pDesc->mergeOut<0 ){ |
| 264 | pDesc->mergeOut = findFreeRail(p, pRow->idx, pDesc->idx, 0); |
| 265 | pDesc->mergeUpto = pRow->idx; |
| 266 | } |
| 267 | pRow->mergeIn |= 1<<pDesc->mergeOut; |
| 268 | } |
| 269 | } |
| 270 |