Fossil SCM
Enhance the "fossil git export" so that it works for repositories that use a single artifact as both an ordinary file and as a check-in manifest.
Commit
fdde65e7f1497f6512593adfd7b84b0735280714878fb7b6d7a161587bb856a3
Parent
f77ebeeaec04fd6…
1 file changed
+34
-11
+34
-11
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -952,17 +952,18 @@ | ||
| 952 | 952 | ** then create the mark. |
| 953 | 953 | ** |
| 954 | 954 | ** The string returned is obtained from fossil_malloc() and should |
| 955 | 955 | ** be freed by the caller. |
| 956 | 956 | */ |
| 957 | -static char *gitmirror_find_mark(const char *zUuid, int bCreate){ | |
| 957 | +static char *gitmirror_find_mark(const char *zUuid, int isFile, int bCreate){ | |
| 958 | 958 | static Stmt sFind, sIns; |
| 959 | 959 | db_static_prepare(&sFind, |
| 960 | 960 | "SELECT coalesce(githash,printf(':%%d',id))" |
| 961 | - " FROM mirror.mmark WHERE uuid=:uuid" | |
| 961 | + " FROM mirror.mmark WHERE uuid=:uuid AND isfile=:isfile" | |
| 962 | 962 | ); |
| 963 | 963 | db_bind_text(&sFind, ":uuid", zUuid); |
| 964 | + db_bind_int(&sFind, ":isfile", isFile!=0); | |
| 964 | 965 | if( db_step(&sFind)==SQLITE_ROW ){ |
| 965 | 966 | char *zMark = fossil_strdup(db_column_text(&sFind, 0)); |
| 966 | 967 | db_reset(&sFind); |
| 967 | 968 | return zMark; |
| 968 | 969 | } |
| @@ -969,13 +970,14 @@ | ||
| 969 | 970 | db_reset(&sFind); |
| 970 | 971 | if( !bCreate ){ |
| 971 | 972 | return 0; |
| 972 | 973 | } |
| 973 | 974 | db_static_prepare(&sIns, |
| 974 | - "INSERT INTO mirror.mmark(uuid) VALUES(:uuid)" | |
| 975 | + "INSERT INTO mirror.mmark(uuid,isfile) VALUES(:uuid,:isfile)" | |
| 975 | 976 | ); |
| 976 | 977 | db_bind_text(&sIns, ":uuid", zUuid); |
| 978 | + db_bind_int(&sIns, ":isfile", isFile!=0); | |
| 977 | 979 | db_step(&sIns); |
| 978 | 980 | db_reset(&sIns); |
| 979 | 981 | return mprintf(":%d", db_last_insert_rowid()); |
| 980 | 982 | } |
| 981 | 983 | |
| @@ -1016,11 +1018,11 @@ | ||
| 1016 | 1018 | }else{ |
| 1017 | 1019 | return 1; |
| 1018 | 1020 | } |
| 1019 | 1021 | } |
| 1020 | 1022 | } |
| 1021 | - zMark = gitmirror_find_mark(zUuid, 1); | |
| 1023 | + zMark = gitmirror_find_mark(zUuid, 1, 1); | |
| 1022 | 1024 | if( zMark[0]==':' ){ |
| 1023 | 1025 | fprintf(xCmd, "blob\nmark %s\ndata %d\n", zMark, blob_size(&data)); |
| 1024 | 1026 | fwrite(blob_buffer(&data), 1, blob_size(&data), xCmd); |
| 1025 | 1027 | fprintf(xCmd, "\n"); |
| 1026 | 1028 | } |
| @@ -1071,11 +1073,11 @@ | ||
| 1071 | 1073 | } |
| 1072 | 1074 | |
| 1073 | 1075 | /* Check to see if any parent logins have not yet been processed, and |
| 1074 | 1076 | ** if so, create them */ |
| 1075 | 1077 | for(i=0; i<pMan->nParent; i++){ |
| 1076 | - char *zPMark = gitmirror_find_mark(pMan->azParent[i], 0); | |
| 1078 | + char *zPMark = gitmirror_find_mark(pMan->azParent[i], 0, 0); | |
| 1077 | 1079 | if( zPMark==0 ){ |
| 1078 | 1080 | int prid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", |
| 1079 | 1081 | pMan->azParent[i]); |
| 1080 | 1082 | int rc = gitmirror_send_checkin(xCmd, prid, pMan->azParent[i], |
| 1081 | 1083 | pnLimit, fManifest); |
| @@ -1129,11 +1131,11 @@ | ||
| 1129 | 1131 | } |
| 1130 | 1132 | |
| 1131 | 1133 | /* Export the check-in */ |
| 1132 | 1134 | fprintf(xCmd, "commit refs/heads/%s\n", zBranch); |
| 1133 | 1135 | fossil_free(zBranch); |
| 1134 | - zMark = gitmirror_find_mark(zUuid,1); | |
| 1136 | + zMark = gitmirror_find_mark(zUuid,0,1); | |
| 1135 | 1137 | fprintf(xCmd, "mark %s\n", zMark); |
| 1136 | 1138 | fossil_free(zMark); |
| 1137 | 1139 | fprintf(xCmd, "committer %s <%[email protected]> %lld +0000\n", |
| 1138 | 1140 | pMan->zUser, pMan->zUser, |
| 1139 | 1141 | (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0) |
| @@ -1145,11 +1147,11 @@ | ||
| 1145 | 1147 | blob_appendf(&comment, "\n\nFossilOrigin-Name: %s", zUuid); |
| 1146 | 1148 | fprintf(xCmd, "data %d\n%s\n", blob_size(&comment), blob_str(&comment)); |
| 1147 | 1149 | blob_reset(&comment); |
| 1148 | 1150 | iParent = -1; /* Which ancestor is the primary parent */ |
| 1149 | 1151 | for(i=0; i<pMan->nParent; i++){ |
| 1150 | - char *zOther = gitmirror_find_mark(pMan->azParent[i], 0); | |
| 1152 | + char *zOther = gitmirror_find_mark(pMan->azParent[i],0,0); | |
| 1151 | 1153 | if( zOther==0 ) continue; |
| 1152 | 1154 | if( iParent<0 ){ |
| 1153 | 1155 | iParent = i; |
| 1154 | 1156 | fprintf(xCmd, "from %s\n", zOther); |
| 1155 | 1157 | }else{ |
| @@ -1180,11 +1182,11 @@ | ||
| 1180 | 1182 | } |
| 1181 | 1183 | db_prepare(&q, |
| 1182 | 1184 | "SELECT x.filename, x.perm," |
| 1183 | 1185 | " coalesce(mmark.githash,printf(':%%d',mmark.id))" |
| 1184 | 1186 | " FROM (%s) AS x, mirror.mmark" |
| 1185 | - " WHERE mmark.uuid=x.uuid", | |
| 1187 | + " WHERE mmark.uuid=x.uuid AND isfile", | |
| 1186 | 1188 | blob_sql_text(&sql) |
| 1187 | 1189 | ); |
| 1188 | 1190 | blob_reset(&sql); |
| 1189 | 1191 | while( db_step(&q)==SQLITE_ROW ){ |
| 1190 | 1192 | const char *zFilename = db_column_text(&q,0); |
| @@ -1308,14 +1310,35 @@ | ||
| 1308 | 1310 | " key TEXT PRIMARY KEY,\n" |
| 1309 | 1311 | " Value ANY\n" |
| 1310 | 1312 | ") WITHOUT ROWID;\n" |
| 1311 | 1313 | "CREATE TABLE IF NOT EXISTS mirror.mmark(\n" |
| 1312 | 1314 | " id INTEGER PRIMARY KEY,\n" |
| 1313 | - " uuid TEXT UNIQUE,\n" | |
| 1314 | - " githash TEXT\n" | |
| 1315 | + " uuid TEXT,\n" | |
| 1316 | + " isfile BOOLEAN,\n" | |
| 1317 | + " githash TEXT,\n" | |
| 1318 | + " UNIQUE(uuid,isfile)\n" | |
| 1315 | 1319 | ");" |
| 1316 | 1320 | ); |
| 1321 | + if( !db_table_has_column("mirror","mmark","isfile") ){ | |
| 1322 | + db_multi_exec( | |
| 1323 | + "ALTER TABLE mirror.mmark RENAME TO mmark_old;" | |
| 1324 | + "CREATE TABLE IF NOT EXISTS mirror.mmark(\n" | |
| 1325 | + " id INTEGER PRIMARY KEY,\n" | |
| 1326 | + " uuid TEXT,\n" | |
| 1327 | + " isfile BOOLEAN,\n" | |
| 1328 | + " githash TEXT,\n" | |
| 1329 | + " UNIQUE(uuid,isfile)\n" | |
| 1330 | + ");" | |
| 1331 | + "INSERT INTO mirror.mmark(id,uuid,githash,isfile)" | |
| 1332 | + " SELECT id,uuid,githash," | |
| 1333 | + " EXISTS(SELECT 1 FROM repository.event, repository.blob" | |
| 1334 | + " WHERE objid=blob.rid" | |
| 1335 | + " AND blob.uuid=mmark_old.uuid)" | |
| 1336 | + " FROM mirror.mmark_old;\n" | |
| 1337 | + "DROP TABLE mirror.mmark_old;\n" | |
| 1338 | + ); | |
| 1339 | + } | |
| 1317 | 1340 | |
| 1318 | 1341 | /* Change the autopush setting if the --autopush flag is present */ |
| 1319 | 1342 | if( zAutoPush ){ |
| 1320 | 1343 | if( is_false(zAutoPush) ){ |
| 1321 | 1344 | db_multi_exec("DELETE FROM mirror.mconfig WHERE key='autopush'"); |
| @@ -1375,11 +1398,11 @@ | ||
| 1375 | 1398 | "INSERT INTO tomirror " |
| 1376 | 1399 | "SELECT objid, mtime, blob.uuid FROM event, blob\n" |
| 1377 | 1400 | " WHERE type='ci'" |
| 1378 | 1401 | " AND mtime>coalesce((SELECT value FROM mconfig WHERE key='start'),0.0)" |
| 1379 | 1402 | " AND blob.rid=event.objid" |
| 1380 | - " AND blob.uuid NOT IN (SELECT uuid FROM mirror.mmark);" | |
| 1403 | + " AND blob.uuid NOT IN (SELECT uuid FROM mirror.mmark WHERE NOT isfile);" | |
| 1381 | 1404 | ); |
| 1382 | 1405 | nTotal = db_int(0, "SELECT count(*) FROM tomirror"); |
| 1383 | 1406 | if( nLimit<nTotal ){ |
| 1384 | 1407 | nTotal = nLimit; |
| 1385 | 1408 | }else if( nLimit>nTotal ){ |
| 1386 | 1409 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -952,17 +952,18 @@ | |
| 952 | ** then create the mark. |
| 953 | ** |
| 954 | ** The string returned is obtained from fossil_malloc() and should |
| 955 | ** be freed by the caller. |
| 956 | */ |
| 957 | static char *gitmirror_find_mark(const char *zUuid, int bCreate){ |
| 958 | static Stmt sFind, sIns; |
| 959 | db_static_prepare(&sFind, |
| 960 | "SELECT coalesce(githash,printf(':%%d',id))" |
| 961 | " FROM mirror.mmark WHERE uuid=:uuid" |
| 962 | ); |
| 963 | db_bind_text(&sFind, ":uuid", zUuid); |
| 964 | if( db_step(&sFind)==SQLITE_ROW ){ |
| 965 | char *zMark = fossil_strdup(db_column_text(&sFind, 0)); |
| 966 | db_reset(&sFind); |
| 967 | return zMark; |
| 968 | } |
| @@ -969,13 +970,14 @@ | |
| 969 | db_reset(&sFind); |
| 970 | if( !bCreate ){ |
| 971 | return 0; |
| 972 | } |
| 973 | db_static_prepare(&sIns, |
| 974 | "INSERT INTO mirror.mmark(uuid) VALUES(:uuid)" |
| 975 | ); |
| 976 | db_bind_text(&sIns, ":uuid", zUuid); |
| 977 | db_step(&sIns); |
| 978 | db_reset(&sIns); |
| 979 | return mprintf(":%d", db_last_insert_rowid()); |
| 980 | } |
| 981 | |
| @@ -1016,11 +1018,11 @@ | |
| 1016 | }else{ |
| 1017 | return 1; |
| 1018 | } |
| 1019 | } |
| 1020 | } |
| 1021 | zMark = gitmirror_find_mark(zUuid, 1); |
| 1022 | if( zMark[0]==':' ){ |
| 1023 | fprintf(xCmd, "blob\nmark %s\ndata %d\n", zMark, blob_size(&data)); |
| 1024 | fwrite(blob_buffer(&data), 1, blob_size(&data), xCmd); |
| 1025 | fprintf(xCmd, "\n"); |
| 1026 | } |
| @@ -1071,11 +1073,11 @@ | |
| 1071 | } |
| 1072 | |
| 1073 | /* Check to see if any parent logins have not yet been processed, and |
| 1074 | ** if so, create them */ |
| 1075 | for(i=0; i<pMan->nParent; i++){ |
| 1076 | char *zPMark = gitmirror_find_mark(pMan->azParent[i], 0); |
| 1077 | if( zPMark==0 ){ |
| 1078 | int prid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", |
| 1079 | pMan->azParent[i]); |
| 1080 | int rc = gitmirror_send_checkin(xCmd, prid, pMan->azParent[i], |
| 1081 | pnLimit, fManifest); |
| @@ -1129,11 +1131,11 @@ | |
| 1129 | } |
| 1130 | |
| 1131 | /* Export the check-in */ |
| 1132 | fprintf(xCmd, "commit refs/heads/%s\n", zBranch); |
| 1133 | fossil_free(zBranch); |
| 1134 | zMark = gitmirror_find_mark(zUuid,1); |
| 1135 | fprintf(xCmd, "mark %s\n", zMark); |
| 1136 | fossil_free(zMark); |
| 1137 | fprintf(xCmd, "committer %s <%[email protected]> %lld +0000\n", |
| 1138 | pMan->zUser, pMan->zUser, |
| 1139 | (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0) |
| @@ -1145,11 +1147,11 @@ | |
| 1145 | blob_appendf(&comment, "\n\nFossilOrigin-Name: %s", zUuid); |
| 1146 | fprintf(xCmd, "data %d\n%s\n", blob_size(&comment), blob_str(&comment)); |
| 1147 | blob_reset(&comment); |
| 1148 | iParent = -1; /* Which ancestor is the primary parent */ |
| 1149 | for(i=0; i<pMan->nParent; i++){ |
| 1150 | char *zOther = gitmirror_find_mark(pMan->azParent[i], 0); |
| 1151 | if( zOther==0 ) continue; |
| 1152 | if( iParent<0 ){ |
| 1153 | iParent = i; |
| 1154 | fprintf(xCmd, "from %s\n", zOther); |
| 1155 | }else{ |
| @@ -1180,11 +1182,11 @@ | |
| 1180 | } |
| 1181 | db_prepare(&q, |
| 1182 | "SELECT x.filename, x.perm," |
| 1183 | " coalesce(mmark.githash,printf(':%%d',mmark.id))" |
| 1184 | " FROM (%s) AS x, mirror.mmark" |
| 1185 | " WHERE mmark.uuid=x.uuid", |
| 1186 | blob_sql_text(&sql) |
| 1187 | ); |
| 1188 | blob_reset(&sql); |
| 1189 | while( db_step(&q)==SQLITE_ROW ){ |
| 1190 | const char *zFilename = db_column_text(&q,0); |
| @@ -1308,14 +1310,35 @@ | |
| 1308 | " key TEXT PRIMARY KEY,\n" |
| 1309 | " Value ANY\n" |
| 1310 | ") WITHOUT ROWID;\n" |
| 1311 | "CREATE TABLE IF NOT EXISTS mirror.mmark(\n" |
| 1312 | " id INTEGER PRIMARY KEY,\n" |
| 1313 | " uuid TEXT UNIQUE,\n" |
| 1314 | " githash TEXT\n" |
| 1315 | ");" |
| 1316 | ); |
| 1317 | |
| 1318 | /* Change the autopush setting if the --autopush flag is present */ |
| 1319 | if( zAutoPush ){ |
| 1320 | if( is_false(zAutoPush) ){ |
| 1321 | db_multi_exec("DELETE FROM mirror.mconfig WHERE key='autopush'"); |
| @@ -1375,11 +1398,11 @@ | |
| 1375 | "INSERT INTO tomirror " |
| 1376 | "SELECT objid, mtime, blob.uuid FROM event, blob\n" |
| 1377 | " WHERE type='ci'" |
| 1378 | " AND mtime>coalesce((SELECT value FROM mconfig WHERE key='start'),0.0)" |
| 1379 | " AND blob.rid=event.objid" |
| 1380 | " AND blob.uuid NOT IN (SELECT uuid FROM mirror.mmark);" |
| 1381 | ); |
| 1382 | nTotal = db_int(0, "SELECT count(*) FROM tomirror"); |
| 1383 | if( nLimit<nTotal ){ |
| 1384 | nTotal = nLimit; |
| 1385 | }else if( nLimit>nTotal ){ |
| 1386 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -952,17 +952,18 @@ | |
| 952 | ** then create the mark. |
| 953 | ** |
| 954 | ** The string returned is obtained from fossil_malloc() and should |
| 955 | ** be freed by the caller. |
| 956 | */ |
| 957 | static char *gitmirror_find_mark(const char *zUuid, int isFile, int bCreate){ |
| 958 | static Stmt sFind, sIns; |
| 959 | db_static_prepare(&sFind, |
| 960 | "SELECT coalesce(githash,printf(':%%d',id))" |
| 961 | " FROM mirror.mmark WHERE uuid=:uuid AND isfile=:isfile" |
| 962 | ); |
| 963 | db_bind_text(&sFind, ":uuid", zUuid); |
| 964 | db_bind_int(&sFind, ":isfile", isFile!=0); |
| 965 | if( db_step(&sFind)==SQLITE_ROW ){ |
| 966 | char *zMark = fossil_strdup(db_column_text(&sFind, 0)); |
| 967 | db_reset(&sFind); |
| 968 | return zMark; |
| 969 | } |
| @@ -969,13 +970,14 @@ | |
| 970 | db_reset(&sFind); |
| 971 | if( !bCreate ){ |
| 972 | return 0; |
| 973 | } |
| 974 | db_static_prepare(&sIns, |
| 975 | "INSERT INTO mirror.mmark(uuid,isfile) VALUES(:uuid,:isfile)" |
| 976 | ); |
| 977 | db_bind_text(&sIns, ":uuid", zUuid); |
| 978 | db_bind_int(&sIns, ":isfile", isFile!=0); |
| 979 | db_step(&sIns); |
| 980 | db_reset(&sIns); |
| 981 | return mprintf(":%d", db_last_insert_rowid()); |
| 982 | } |
| 983 | |
| @@ -1016,11 +1018,11 @@ | |
| 1018 | }else{ |
| 1019 | return 1; |
| 1020 | } |
| 1021 | } |
| 1022 | } |
| 1023 | zMark = gitmirror_find_mark(zUuid, 1, 1); |
| 1024 | if( zMark[0]==':' ){ |
| 1025 | fprintf(xCmd, "blob\nmark %s\ndata %d\n", zMark, blob_size(&data)); |
| 1026 | fwrite(blob_buffer(&data), 1, blob_size(&data), xCmd); |
| 1027 | fprintf(xCmd, "\n"); |
| 1028 | } |
| @@ -1071,11 +1073,11 @@ | |
| 1073 | } |
| 1074 | |
| 1075 | /* Check to see if any parent logins have not yet been processed, and |
| 1076 | ** if so, create them */ |
| 1077 | for(i=0; i<pMan->nParent; i++){ |
| 1078 | char *zPMark = gitmirror_find_mark(pMan->azParent[i], 0, 0); |
| 1079 | if( zPMark==0 ){ |
| 1080 | int prid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", |
| 1081 | pMan->azParent[i]); |
| 1082 | int rc = gitmirror_send_checkin(xCmd, prid, pMan->azParent[i], |
| 1083 | pnLimit, fManifest); |
| @@ -1129,11 +1131,11 @@ | |
| 1131 | } |
| 1132 | |
| 1133 | /* Export the check-in */ |
| 1134 | fprintf(xCmd, "commit refs/heads/%s\n", zBranch); |
| 1135 | fossil_free(zBranch); |
| 1136 | zMark = gitmirror_find_mark(zUuid,0,1); |
| 1137 | fprintf(xCmd, "mark %s\n", zMark); |
| 1138 | fossil_free(zMark); |
| 1139 | fprintf(xCmd, "committer %s <%[email protected]> %lld +0000\n", |
| 1140 | pMan->zUser, pMan->zUser, |
| 1141 | (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0) |
| @@ -1145,11 +1147,11 @@ | |
| 1147 | blob_appendf(&comment, "\n\nFossilOrigin-Name: %s", zUuid); |
| 1148 | fprintf(xCmd, "data %d\n%s\n", blob_size(&comment), blob_str(&comment)); |
| 1149 | blob_reset(&comment); |
| 1150 | iParent = -1; /* Which ancestor is the primary parent */ |
| 1151 | for(i=0; i<pMan->nParent; i++){ |
| 1152 | char *zOther = gitmirror_find_mark(pMan->azParent[i],0,0); |
| 1153 | if( zOther==0 ) continue; |
| 1154 | if( iParent<0 ){ |
| 1155 | iParent = i; |
| 1156 | fprintf(xCmd, "from %s\n", zOther); |
| 1157 | }else{ |
| @@ -1180,11 +1182,11 @@ | |
| 1182 | } |
| 1183 | db_prepare(&q, |
| 1184 | "SELECT x.filename, x.perm," |
| 1185 | " coalesce(mmark.githash,printf(':%%d',mmark.id))" |
| 1186 | " FROM (%s) AS x, mirror.mmark" |
| 1187 | " WHERE mmark.uuid=x.uuid AND isfile", |
| 1188 | blob_sql_text(&sql) |
| 1189 | ); |
| 1190 | blob_reset(&sql); |
| 1191 | while( db_step(&q)==SQLITE_ROW ){ |
| 1192 | const char *zFilename = db_column_text(&q,0); |
| @@ -1308,14 +1310,35 @@ | |
| 1310 | " key TEXT PRIMARY KEY,\n" |
| 1311 | " Value ANY\n" |
| 1312 | ") WITHOUT ROWID;\n" |
| 1313 | "CREATE TABLE IF NOT EXISTS mirror.mmark(\n" |
| 1314 | " id INTEGER PRIMARY KEY,\n" |
| 1315 | " uuid TEXT,\n" |
| 1316 | " isfile BOOLEAN,\n" |
| 1317 | " githash TEXT,\n" |
| 1318 | " UNIQUE(uuid,isfile)\n" |
| 1319 | ");" |
| 1320 | ); |
| 1321 | if( !db_table_has_column("mirror","mmark","isfile") ){ |
| 1322 | db_multi_exec( |
| 1323 | "ALTER TABLE mirror.mmark RENAME TO mmark_old;" |
| 1324 | "CREATE TABLE IF NOT EXISTS mirror.mmark(\n" |
| 1325 | " id INTEGER PRIMARY KEY,\n" |
| 1326 | " uuid TEXT,\n" |
| 1327 | " isfile BOOLEAN,\n" |
| 1328 | " githash TEXT,\n" |
| 1329 | " UNIQUE(uuid,isfile)\n" |
| 1330 | ");" |
| 1331 | "INSERT INTO mirror.mmark(id,uuid,githash,isfile)" |
| 1332 | " SELECT id,uuid,githash," |
| 1333 | " EXISTS(SELECT 1 FROM repository.event, repository.blob" |
| 1334 | " WHERE objid=blob.rid" |
| 1335 | " AND blob.uuid=mmark_old.uuid)" |
| 1336 | " FROM mirror.mmark_old;\n" |
| 1337 | "DROP TABLE mirror.mmark_old;\n" |
| 1338 | ); |
| 1339 | } |
| 1340 | |
| 1341 | /* Change the autopush setting if the --autopush flag is present */ |
| 1342 | if( zAutoPush ){ |
| 1343 | if( is_false(zAutoPush) ){ |
| 1344 | db_multi_exec("DELETE FROM mirror.mconfig WHERE key='autopush'"); |
| @@ -1375,11 +1398,11 @@ | |
| 1398 | "INSERT INTO tomirror " |
| 1399 | "SELECT objid, mtime, blob.uuid FROM event, blob\n" |
| 1400 | " WHERE type='ci'" |
| 1401 | " AND mtime>coalesce((SELECT value FROM mconfig WHERE key='start'),0.0)" |
| 1402 | " AND blob.rid=event.objid" |
| 1403 | " AND blob.uuid NOT IN (SELECT uuid FROM mirror.mmark WHERE NOT isfile);" |
| 1404 | ); |
| 1405 | nTotal = db_int(0, "SELECT count(*) FROM tomirror"); |
| 1406 | if( nLimit<nTotal ){ |
| 1407 | nTotal = nLimit; |
| 1408 | }else if( nLimit>nTotal ){ |
| 1409 |