Fossil SCM
Fix a bug in mlink table building during "rebuild". If a check-in and its parent are both deltas of the same baseline and the child reverts to baseline after a change in the parent, be sure to capture this change in the mlink table. This is the correct fix for the errant fix_mlink branch.
Commit
d084043f798277760682287020c4455b73629b0d
Parent
966ae9a942d3c84…
1 file changed
+22
-7
+22
-7
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1334,18 +1334,33 @@ | ||
| 1334 | 1334 | } |
| 1335 | 1335 | } |
| 1336 | 1336 | } |
| 1337 | 1337 | if( pParent->zBaseline && pChild->zBaseline ){ |
| 1338 | 1338 | /* Both parent and child are delta manifests. Look for files that |
| 1339 | - ** are marked as deleted in the parent but which reappear in the child | |
| 1340 | - ** and show such files as being added in the child. */ | |
| 1339 | + ** are deleted or modified in the parent but which reappear or revert | |
| 1340 | + ** to baseline in the child and show such files as being added or changed | |
| 1341 | + ** in the child. */ | |
| 1341 | 1342 | for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){ |
| 1342 | - if( pParentFile->zUuid ) continue; | |
| 1343 | - pChildFile = manifest_file_seek(pChild, pParentFile->zName); | |
| 1344 | - if( pChildFile ){ | |
| 1345 | - add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, | |
| 1346 | - isPublic, manifest_file_mperm(pChildFile)); | |
| 1343 | + if( pParentFile->zUuid ){ | |
| 1344 | + pChildFile = manifest_file_seek_base(pChild, pParentFile->zName); | |
| 1345 | + if( pChildFile==0 ){ | |
| 1346 | + /* The child file reverts to baseline. Show this as a change */ | |
| 1347 | + pChildFile = manifest_file_seek(pChild, pParentFile->zName); | |
| 1348 | + if( pChildFile ){ | |
| 1349 | + add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid, | |
| 1350 | + pChildFile->zName, 0, isPublic, | |
| 1351 | + manifest_file_mperm(pChildFile)); | |
| 1352 | + } | |
| 1353 | + } | |
| 1354 | + }else{ | |
| 1355 | + pChildFile = manifest_file_seek(pChild, pParentFile->zName); | |
| 1356 | + if( pChildFile ){ | |
| 1357 | + /* File resurrected in the child after having been deleted in | |
| 1358 | + ** the parent. Show this as an added file. */ | |
| 1359 | + add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, | |
| 1360 | + isPublic, manifest_file_mperm(pChildFile)); | |
| 1361 | + } | |
| 1347 | 1362 | } |
| 1348 | 1363 | } |
| 1349 | 1364 | }else if( pChild->zBaseline==0 ){ |
| 1350 | 1365 | /* pChild is a baseline. Look for files that are present in pParent |
| 1351 | 1366 | ** but are missing from pChild and mark them as having been deleted. */ |
| 1352 | 1367 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1334,18 +1334,33 @@ | |
| 1334 | } |
| 1335 | } |
| 1336 | } |
| 1337 | if( pParent->zBaseline && pChild->zBaseline ){ |
| 1338 | /* Both parent and child are delta manifests. Look for files that |
| 1339 | ** are marked as deleted in the parent but which reappear in the child |
| 1340 | ** and show such files as being added in the child. */ |
| 1341 | for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){ |
| 1342 | if( pParentFile->zUuid ) continue; |
| 1343 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1344 | if( pChildFile ){ |
| 1345 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1346 | isPublic, manifest_file_mperm(pChildFile)); |
| 1347 | } |
| 1348 | } |
| 1349 | }else if( pChild->zBaseline==0 ){ |
| 1350 | /* pChild is a baseline. Look for files that are present in pParent |
| 1351 | ** but are missing from pChild and mark them as having been deleted. */ |
| 1352 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -1334,18 +1334,33 @@ | |
| 1334 | } |
| 1335 | } |
| 1336 | } |
| 1337 | if( pParent->zBaseline && pChild->zBaseline ){ |
| 1338 | /* Both parent and child are delta manifests. Look for files that |
| 1339 | ** are deleted or modified in the parent but which reappear or revert |
| 1340 | ** to baseline in the child and show such files as being added or changed |
| 1341 | ** in the child. */ |
| 1342 | for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){ |
| 1343 | if( pParentFile->zUuid ){ |
| 1344 | pChildFile = manifest_file_seek_base(pChild, pParentFile->zName); |
| 1345 | if( pChildFile==0 ){ |
| 1346 | /* The child file reverts to baseline. Show this as a change */ |
| 1347 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1348 | if( pChildFile ){ |
| 1349 | add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid, |
| 1350 | pChildFile->zName, 0, isPublic, |
| 1351 | manifest_file_mperm(pChildFile)); |
| 1352 | } |
| 1353 | } |
| 1354 | }else{ |
| 1355 | pChildFile = manifest_file_seek(pChild, pParentFile->zName); |
| 1356 | if( pChildFile ){ |
| 1357 | /* File resurrected in the child after having been deleted in |
| 1358 | ** the parent. Show this as an added file. */ |
| 1359 | add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, |
| 1360 | isPublic, manifest_file_mperm(pChildFile)); |
| 1361 | } |
| 1362 | } |
| 1363 | } |
| 1364 | }else if( pChild->zBaseline==0 ){ |
| 1365 | /* pChild is a baseline. Look for files that are present in pParent |
| 1366 | ** but are missing from pChild and mark them as having been deleted. */ |
| 1367 |