Fossil SCM

Make all files mentioned by a public manifest public as well. Ticket [5f194e2c8f475c].

drh 2011-03-04 13:11 trunk
Commit 2985120d93c5fa77657d57a26eb181c7ee27ff38
1 file changed +15 -7
+15 -7
--- src/manifest.c
+++ src/manifest.c
@@ -1102,10 +1102,11 @@
11021102
int mid, /* The record ID of the manifest */
11031103
const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */
11041104
const char *zToUuid, /* UUID for the mlink.fid. "" to delele */
11051105
const char *zFilename, /* Filename */
11061106
const char *zPrior, /* Previous filename. NULL if unchanged */
1107
+ int isPublic, /* True if mid is not a private manifest */
11071108
int mperm /* 1: exec */
11081109
){
11091110
int fnid, pfnid, pid, fid;
11101111
static Stmt s1;
11111112
@@ -1122,10 +1123,11 @@
11221123
}
11231124
if( zToUuid==0 || zToUuid[0]==0 ){
11241125
fid = 0;
11251126
}else{
11261127
fid = uuid_to_rid(zToUuid, 1);
1128
+ if( isPublic ) content_make_public(fid);
11271129
}
11281130
db_static_prepare(&s1,
11291131
"INSERT INTO mlink(mid,pid,fid,fnid,pfnid,mperm)"
11301132
"VALUES(:m,:p,:f,:n,:pfn,:mp)"
11311133
);
@@ -1220,10 +1222,11 @@
12201222
int otherRid;
12211223
int i, rc;
12221224
ManifestFile *pChildFile, *pParentFile;
12231225
Manifest **ppOther;
12241226
static Stmt eq;
1227
+ int isPublic; /* True if pChild is non-private */
12251228
12261229
/* If mlink table entires are already set for cid, then abort early
12271230
** doing no work.
12281231
*/
12291232
db_static_prepare(&eq, "SELECT 1 FROM mlink WHERE mid=:mid");
@@ -1251,10 +1254,11 @@
12511254
}
12521255
if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){
12531256
manifest_destroy(*ppOther);
12541257
return;
12551258
}
1259
+ isPublic = !content_is_private(cid);
12561260
12571261
/* Try to make the parent manifest a delta from the child, if that
12581262
** is an appropriate thing to do. For a new baseline, make the
12591263
** previoius baseline a delta from the current baseline.
12601264
*/
@@ -1284,28 +1288,30 @@
12841288
if( pChildFile->zPrior ){
12851289
pParentFile = manifest_file_seek(pParent, pChildFile->zPrior);
12861290
if( pParentFile ){
12871291
/* File with name change */
12881292
add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
1289
- pChildFile->zName, pChildFile->zPrior, mperm);
1293
+ pChildFile->zName, pChildFile->zPrior, isPublic, mperm);
12901294
}else{
12911295
/* File name changed, but the old name is not found in the parent!
12921296
** Treat this like a new file. */
1293
- add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, mperm);
1297
+ add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1298
+ isPublic, mperm);
12941299
}
12951300
}else{
12961301
pParentFile = manifest_file_seek(pParent, pChildFile->zName);
12971302
if( pParentFile==0 ){
12981303
if( pChildFile->zUuid ){
12991304
/* A new file */
1300
- add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName,0,mperm);
1305
+ add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1306
+ isPublic, mperm);
13011307
}
13021308
}else if( fossil_strcmp(pChildFile->zUuid, pParentFile->zUuid)!=0
13031309
|| manifest_file_mperm(pParentFile)!=mperm ){
13041310
/* Changes in file content or permissions */
13051311
add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
1306
- pChildFile->zName, 0, mperm);
1312
+ pChildFile->zName, 0, isPublic, mperm);
13071313
}
13081314
}
13091315
}
13101316
if( pParent->zBaseline && pChild->zBaseline ){
13111317
/* Both parent and child are delta manifests. Look for files that
@@ -1314,11 +1320,11 @@
13141320
for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){
13151321
if( pParentFile->zUuid ) continue;
13161322
pChildFile = manifest_file_seek(pChild, pParentFile->zName);
13171323
if( pChildFile ){
13181324
add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1319
- manifest_file_mperm(pChildFile));
1325
+ isPublic, manifest_file_mperm(pChildFile));
13201326
}
13211327
}
13221328
}else if( pChild->zBaseline==0 ){
13231329
/* Parent is a delta but pChild is a baseline. Look for files that are
13241330
** present in pParent but which are missing from pChild and mark them
@@ -1325,11 +1331,12 @@
13251331
** has having been deleted. */
13261332
manifest_file_rewind(pParent);
13271333
while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
13281334
pChildFile = manifest_file_seek(pChild, pParentFile->zName);
13291335
if( pChildFile==0 ){
1330
- add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, 0);
1336
+ add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0,
1337
+ isPublic, 0);
13311338
}
13321339
}
13331340
}
13341341
manifest_cache_insert(*ppOther);
13351342
}
@@ -1560,13 +1567,14 @@
15601567
}
15611568
db_finalize(&q);
15621569
if( p->nParent==0 ){
15631570
/* For root files (files without parents) add mlink entries
15641571
** showing all content as new. */
1572
+ int isPublic = !content_is_private(rid);
15651573
for(i=0; i<p->nFile; i++){
15661574
add_one_mlink(rid, 0, p->aFile[i].zUuid, p->aFile[i].zName, 0,
1567
- manifest_file_mperm(&p->aFile[i]));
1575
+ isPublic, manifest_file_mperm(&p->aFile[i]));
15681576
}
15691577
}
15701578
db_multi_exec(
15711579
"REPLACE INTO event(type,mtime,objid,user,comment,"
15721580
"bgcolor,euser,ecomment,omtime)"
15731581
--- src/manifest.c
+++ src/manifest.c
@@ -1102,10 +1102,11 @@
1102 int mid, /* The record ID of the manifest */
1103 const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */
1104 const char *zToUuid, /* UUID for the mlink.fid. "" to delele */
1105 const char *zFilename, /* Filename */
1106 const char *zPrior, /* Previous filename. NULL if unchanged */
 
1107 int mperm /* 1: exec */
1108 ){
1109 int fnid, pfnid, pid, fid;
1110 static Stmt s1;
1111
@@ -1122,10 +1123,11 @@
1122 }
1123 if( zToUuid==0 || zToUuid[0]==0 ){
1124 fid = 0;
1125 }else{
1126 fid = uuid_to_rid(zToUuid, 1);
 
1127 }
1128 db_static_prepare(&s1,
1129 "INSERT INTO mlink(mid,pid,fid,fnid,pfnid,mperm)"
1130 "VALUES(:m,:p,:f,:n,:pfn,:mp)"
1131 );
@@ -1220,10 +1222,11 @@
1220 int otherRid;
1221 int i, rc;
1222 ManifestFile *pChildFile, *pParentFile;
1223 Manifest **ppOther;
1224 static Stmt eq;
 
1225
1226 /* If mlink table entires are already set for cid, then abort early
1227 ** doing no work.
1228 */
1229 db_static_prepare(&eq, "SELECT 1 FROM mlink WHERE mid=:mid");
@@ -1251,10 +1254,11 @@
1251 }
1252 if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){
1253 manifest_destroy(*ppOther);
1254 return;
1255 }
 
1256
1257 /* Try to make the parent manifest a delta from the child, if that
1258 ** is an appropriate thing to do. For a new baseline, make the
1259 ** previoius baseline a delta from the current baseline.
1260 */
@@ -1284,28 +1288,30 @@
1284 if( pChildFile->zPrior ){
1285 pParentFile = manifest_file_seek(pParent, pChildFile->zPrior);
1286 if( pParentFile ){
1287 /* File with name change */
1288 add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
1289 pChildFile->zName, pChildFile->zPrior, mperm);
1290 }else{
1291 /* File name changed, but the old name is not found in the parent!
1292 ** Treat this like a new file. */
1293 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0, mperm);
 
1294 }
1295 }else{
1296 pParentFile = manifest_file_seek(pParent, pChildFile->zName);
1297 if( pParentFile==0 ){
1298 if( pChildFile->zUuid ){
1299 /* A new file */
1300 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName,0,mperm);
 
1301 }
1302 }else if( fossil_strcmp(pChildFile->zUuid, pParentFile->zUuid)!=0
1303 || manifest_file_mperm(pParentFile)!=mperm ){
1304 /* Changes in file content or permissions */
1305 add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
1306 pChildFile->zName, 0, mperm);
1307 }
1308 }
1309 }
1310 if( pParent->zBaseline && pChild->zBaseline ){
1311 /* Both parent and child are delta manifests. Look for files that
@@ -1314,11 +1320,11 @@
1314 for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){
1315 if( pParentFile->zUuid ) continue;
1316 pChildFile = manifest_file_seek(pChild, pParentFile->zName);
1317 if( pChildFile ){
1318 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1319 manifest_file_mperm(pChildFile));
1320 }
1321 }
1322 }else if( pChild->zBaseline==0 ){
1323 /* Parent is a delta but pChild is a baseline. Look for files that are
1324 ** present in pParent but which are missing from pChild and mark them
@@ -1325,11 +1331,12 @@
1325 ** has having been deleted. */
1326 manifest_file_rewind(pParent);
1327 while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
1328 pChildFile = manifest_file_seek(pChild, pParentFile->zName);
1329 if( pChildFile==0 ){
1330 add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0, 0);
 
1331 }
1332 }
1333 }
1334 manifest_cache_insert(*ppOther);
1335 }
@@ -1560,13 +1567,14 @@
1560 }
1561 db_finalize(&q);
1562 if( p->nParent==0 ){
1563 /* For root files (files without parents) add mlink entries
1564 ** showing all content as new. */
 
1565 for(i=0; i<p->nFile; i++){
1566 add_one_mlink(rid, 0, p->aFile[i].zUuid, p->aFile[i].zName, 0,
1567 manifest_file_mperm(&p->aFile[i]));
1568 }
1569 }
1570 db_multi_exec(
1571 "REPLACE INTO event(type,mtime,objid,user,comment,"
1572 "bgcolor,euser,ecomment,omtime)"
1573
--- src/manifest.c
+++ src/manifest.c
@@ -1102,10 +1102,11 @@
1102 int mid, /* The record ID of the manifest */
1103 const char *zFromUuid, /* UUID for the mlink.pid. "" to add file */
1104 const char *zToUuid, /* UUID for the mlink.fid. "" to delele */
1105 const char *zFilename, /* Filename */
1106 const char *zPrior, /* Previous filename. NULL if unchanged */
1107 int isPublic, /* True if mid is not a private manifest */
1108 int mperm /* 1: exec */
1109 ){
1110 int fnid, pfnid, pid, fid;
1111 static Stmt s1;
1112
@@ -1122,10 +1123,11 @@
1123 }
1124 if( zToUuid==0 || zToUuid[0]==0 ){
1125 fid = 0;
1126 }else{
1127 fid = uuid_to_rid(zToUuid, 1);
1128 if( isPublic ) content_make_public(fid);
1129 }
1130 db_static_prepare(&s1,
1131 "INSERT INTO mlink(mid,pid,fid,fnid,pfnid,mperm)"
1132 "VALUES(:m,:p,:f,:n,:pfn,:mp)"
1133 );
@@ -1220,10 +1222,11 @@
1222 int otherRid;
1223 int i, rc;
1224 ManifestFile *pChildFile, *pParentFile;
1225 Manifest **ppOther;
1226 static Stmt eq;
1227 int isPublic; /* True if pChild is non-private */
1228
1229 /* If mlink table entires are already set for cid, then abort early
1230 ** doing no work.
1231 */
1232 db_static_prepare(&eq, "SELECT 1 FROM mlink WHERE mid=:mid");
@@ -1251,10 +1254,11 @@
1254 }
1255 if( fetch_baseline(pParent, 0) || fetch_baseline(pChild, 0) ){
1256 manifest_destroy(*ppOther);
1257 return;
1258 }
1259 isPublic = !content_is_private(cid);
1260
1261 /* Try to make the parent manifest a delta from the child, if that
1262 ** is an appropriate thing to do. For a new baseline, make the
1263 ** previoius baseline a delta from the current baseline.
1264 */
@@ -1284,28 +1288,30 @@
1288 if( pChildFile->zPrior ){
1289 pParentFile = manifest_file_seek(pParent, pChildFile->zPrior);
1290 if( pParentFile ){
1291 /* File with name change */
1292 add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
1293 pChildFile->zName, pChildFile->zPrior, isPublic, mperm);
1294 }else{
1295 /* File name changed, but the old name is not found in the parent!
1296 ** Treat this like a new file. */
1297 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1298 isPublic, mperm);
1299 }
1300 }else{
1301 pParentFile = manifest_file_seek(pParent, pChildFile->zName);
1302 if( pParentFile==0 ){
1303 if( pChildFile->zUuid ){
1304 /* A new file */
1305 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1306 isPublic, mperm);
1307 }
1308 }else if( fossil_strcmp(pChildFile->zUuid, pParentFile->zUuid)!=0
1309 || manifest_file_mperm(pParentFile)!=mperm ){
1310 /* Changes in file content or permissions */
1311 add_one_mlink(cid, pParentFile->zUuid, pChildFile->zUuid,
1312 pChildFile->zName, 0, isPublic, mperm);
1313 }
1314 }
1315 }
1316 if( pParent->zBaseline && pChild->zBaseline ){
1317 /* Both parent and child are delta manifests. Look for files that
@@ -1314,11 +1320,11 @@
1320 for(i=0, pParentFile=pParent->aFile; i<pParent->nFile; i++, pParentFile++){
1321 if( pParentFile->zUuid ) continue;
1322 pChildFile = manifest_file_seek(pChild, pParentFile->zName);
1323 if( pChildFile ){
1324 add_one_mlink(cid, 0, pChildFile->zUuid, pChildFile->zName, 0,
1325 isPublic, manifest_file_mperm(pChildFile));
1326 }
1327 }
1328 }else if( pChild->zBaseline==0 ){
1329 /* Parent is a delta but pChild is a baseline. Look for files that are
1330 ** present in pParent but which are missing from pChild and mark them
@@ -1325,11 +1331,12 @@
1331 ** has having been deleted. */
1332 manifest_file_rewind(pParent);
1333 while( (pParentFile = manifest_file_next(pParent,0))!=0 ){
1334 pChildFile = manifest_file_seek(pChild, pParentFile->zName);
1335 if( pChildFile==0 ){
1336 add_one_mlink(cid, pParentFile->zUuid, 0, pParentFile->zName, 0,
1337 isPublic, 0);
1338 }
1339 }
1340 }
1341 manifest_cache_insert(*ppOther);
1342 }
@@ -1560,13 +1567,14 @@
1567 }
1568 db_finalize(&q);
1569 if( p->nParent==0 ){
1570 /* For root files (files without parents) add mlink entries
1571 ** showing all content as new. */
1572 int isPublic = !content_is_private(rid);
1573 for(i=0; i<p->nFile; i++){
1574 add_one_mlink(rid, 0, p->aFile[i].zUuid, p->aFile[i].zName, 0,
1575 isPublic, manifest_file_mperm(&p->aFile[i]));
1576 }
1577 }
1578 db_multi_exec(
1579 "REPLACE INTO event(type,mtime,objid,user,comment,"
1580 "bgcolor,euser,ecomment,omtime)"
1581

Keyboard Shortcuts

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