Fossil SCM
Export "manifest", "manifest.uuid", and "manifest.tags" files if that is what the repository needs.
Commit
eafe5ce624349d9643541069f5696eec0547c585a889497891fbbb42a650c9b8
Parent
d74371680d0b38f…
1 file changed
+42
-16
+42
-16
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -995,11 +995,12 @@ | ||
| 995 | 995 | */ |
| 996 | 996 | static void mirror_send_checkin( |
| 997 | 997 | FILE *xCmd, /* Write fast-import text on this pipe */ |
| 998 | 998 | int rid, /* BLOB.RID for the check-in to export */ |
| 999 | 999 | const char *zUuid, /* BLOB.UUID for the check-in to export */ |
| 1000 | - int *pnLimit /* Stop when the counter reaches zero */ | |
| 1000 | + int *pnLimit, /* Stop when the counter reaches zero */ | |
| 1001 | + int fManifest /* MFESTFLG_* values */ | |
| 1001 | 1002 | ){ |
| 1002 | 1003 | Manifest *pMan; /* The check-in to be output */ |
| 1003 | 1004 | int i; /* Loop counter */ |
| 1004 | 1005 | int iParent; /* Which immediate ancestor is primary. -1 for none */ |
| 1005 | 1006 | Stmt q; /* An SQL query */ |
| @@ -1020,11 +1021,11 @@ | ||
| 1020 | 1021 | for(i=0; i<pMan->nParent; i++){ |
| 1021 | 1022 | int iMark = mirror_find_mark(pMan->azParent[i], 0); |
| 1022 | 1023 | if( iMark<=0 ){ |
| 1023 | 1024 | int prid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", |
| 1024 | 1025 | pMan->azParent[i]); |
| 1025 | - mirror_send_checkin(xCmd, prid, pMan->azParent[i], pnLimit); | |
| 1026 | + mirror_send_checkin(xCmd, prid, pMan->azParent[i], pnLimit, fManifest); | |
| 1026 | 1027 | if( *pnLimit<=0 ){ |
| 1027 | 1028 | manifest_destroy(pMan); |
| 1028 | 1029 | return; |
| 1029 | 1030 | } |
| 1030 | 1031 | } |
| @@ -1119,10 +1120,31 @@ | ||
| 1119 | 1120 | zFNQuoted = mirror_quote_filename_if_needed(zFilename); |
| 1120 | 1121 | fprintf(xCmd,"M %s :%d %s\n", zGitMode, iMark, zFNQuoted); |
| 1121 | 1122 | fossil_free(zFNQuoted); |
| 1122 | 1123 | } |
| 1123 | 1124 | db_finalize(&q); |
| 1125 | + | |
| 1126 | + /* Include Fossil-generated auxiliary files in the check-in */ | |
| 1127 | + if( fManifest & MFESTFLG_RAW ){ | |
| 1128 | + Blob manifest; | |
| 1129 | + content_get(rid, &manifest); | |
| 1130 | + fprintf(xCmd,"M 100644 inline manifest\ndata %d\n%s\n", | |
| 1131 | + blob_size(&manifest), blob_str(&manifest)); | |
| 1132 | + blob_reset(&manifest); | |
| 1133 | + } | |
| 1134 | + if( fManifest & MFESTFLG_UUID ){ | |
| 1135 | + int n = (int)strlen(zUuid); | |
| 1136 | + fprintf(xCmd,"M 100644 inline manifest.uuid\ndata %d\n%s\n", n, zUuid); | |
| 1137 | + } | |
| 1138 | + if( fManifest & MFESTFLG_TAGS ){ | |
| 1139 | + Blob tagslist; | |
| 1140 | + blob_init(&tagslist, 0, 0); | |
| 1141 | + get_checkin_taglist(rid, &tagslist); | |
| 1142 | + fprintf(xCmd,"M 100644 inline manifest.tags\ndata %d\n%s\n", | |
| 1143 | + blob_size(&tagslist), blob_str(&tagslist)); | |
| 1144 | + blob_reset(&tagslist); | |
| 1145 | + } | |
| 1124 | 1146 | |
| 1125 | 1147 | /* The check-in is finished, so decrement the counter */ |
| 1126 | 1148 | (*pnLimit)--; |
| 1127 | 1149 | } |
| 1128 | 1150 | |
| @@ -1166,23 +1188,24 @@ | ||
| 1166 | 1188 | ** |
| 1167 | 1189 | ** --limit N Add no more than N new check-ins to MIRROR. |
| 1168 | 1190 | ** Useful for debugging |
| 1169 | 1191 | */ |
| 1170 | 1192 | void mirror_command(void){ |
| 1171 | - const char *zLimit; | |
| 1172 | - int nLimit = 0x7fffffff; | |
| 1173 | - int nTotal = 0; | |
| 1174 | - char *zMirror; | |
| 1175 | - char *z; | |
| 1176 | - char *zCmd; | |
| 1177 | - const char *zDebug = 0; | |
| 1178 | - double rEnd; | |
| 1179 | - int rc; | |
| 1180 | - FILE *xCmd; | |
| 1181 | - FILE *pIn, *pOut; | |
| 1182 | - Stmt q; | |
| 1183 | - char zLine[200]; | |
| 1193 | + const char *zLimit; /* Text of the --limit flag */ | |
| 1194 | + int nLimit = 0x7fffffff; /* Numeric value of the --limit flag */ | |
| 1195 | + int nTotal = 0; /* Total number of check-ins to export */ | |
| 1196 | + char *zMirror; /* Name of the mirror */ | |
| 1197 | + char *z; /* Generic string */ | |
| 1198 | + char *zCmd; /* git command to run as a subprocess */ | |
| 1199 | + const char *zDebug = 0; /* Value of the --debug flag */ | |
| 1200 | + double rEnd; /* time of most recent export */ | |
| 1201 | + int rc; /* Result code */ | |
| 1202 | + int fManifest; /* Current "manifest" setting */ | |
| 1203 | + FILE *xCmd; /* Pipe to the "git fast-import" command */ | |
| 1204 | + FILE *pIn, *pOut; /* Git mark files */ | |
| 1205 | + Stmt q; /* Queries */ | |
| 1206 | + char zLine[200]; /* One line of a mark file */ | |
| 1184 | 1207 | |
| 1185 | 1208 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 1186 | 1209 | zDebug = find_option("debug",0,1); |
| 1187 | 1210 | db_find_and_open_repository(0, 0); |
| 1188 | 1211 | zLimit = find_option("limit", 0, 1); |
| @@ -1241,10 +1264,13 @@ | ||
| 1241 | 1264 | " WHERE key='start'),0.0)") |
| 1242 | 1265 | ){ |
| 1243 | 1266 | fossil_print("no changes\n"); |
| 1244 | 1267 | return; |
| 1245 | 1268 | } |
| 1269 | + | |
| 1270 | + /* Do we need to include manifest files in the clone? */ | |
| 1271 | + fManifest = db_get_manifest_setting(); | |
| 1246 | 1272 | |
| 1247 | 1273 | /* Change to the MIRROR directory so that the Git commands will work */ |
| 1248 | 1274 | rc = file_chdir(zMirror, 0); |
| 1249 | 1275 | if( rc ) fossil_fatal("cannot change the working directory to \"%s\"", |
| 1250 | 1276 | zMirror); |
| @@ -1297,11 +1323,11 @@ | ||
| 1297 | 1323 | const char *zUuid = db_column_text(&q, 3); |
| 1298 | 1324 | if( rMTime>rEnd ) rEnd = rMTime; |
| 1299 | 1325 | if( zType[0]=='t' ){ |
| 1300 | 1326 | mirror_send_tag(xCmd, rid); |
| 1301 | 1327 | }else{ |
| 1302 | - mirror_send_checkin(xCmd, rid, zUuid, &nLimit); | |
| 1328 | + mirror_send_checkin(xCmd, rid, zUuid, &nLimit, fManifest); | |
| 1303 | 1329 | printf("\r%d/%d ", nTotal-nLimit, nTotal); |
| 1304 | 1330 | fflush(stdout); |
| 1305 | 1331 | } |
| 1306 | 1332 | } |
| 1307 | 1333 | db_finalize(&q); |
| 1308 | 1334 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -995,11 +995,12 @@ | |
| 995 | */ |
| 996 | static void mirror_send_checkin( |
| 997 | FILE *xCmd, /* Write fast-import text on this pipe */ |
| 998 | int rid, /* BLOB.RID for the check-in to export */ |
| 999 | const char *zUuid, /* BLOB.UUID for the check-in to export */ |
| 1000 | int *pnLimit /* Stop when the counter reaches zero */ |
| 1001 | ){ |
| 1002 | Manifest *pMan; /* The check-in to be output */ |
| 1003 | int i; /* Loop counter */ |
| 1004 | int iParent; /* Which immediate ancestor is primary. -1 for none */ |
| 1005 | Stmt q; /* An SQL query */ |
| @@ -1020,11 +1021,11 @@ | |
| 1020 | for(i=0; i<pMan->nParent; i++){ |
| 1021 | int iMark = mirror_find_mark(pMan->azParent[i], 0); |
| 1022 | if( iMark<=0 ){ |
| 1023 | int prid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", |
| 1024 | pMan->azParent[i]); |
| 1025 | mirror_send_checkin(xCmd, prid, pMan->azParent[i], pnLimit); |
| 1026 | if( *pnLimit<=0 ){ |
| 1027 | manifest_destroy(pMan); |
| 1028 | return; |
| 1029 | } |
| 1030 | } |
| @@ -1119,10 +1120,31 @@ | |
| 1119 | zFNQuoted = mirror_quote_filename_if_needed(zFilename); |
| 1120 | fprintf(xCmd,"M %s :%d %s\n", zGitMode, iMark, zFNQuoted); |
| 1121 | fossil_free(zFNQuoted); |
| 1122 | } |
| 1123 | db_finalize(&q); |
| 1124 | |
| 1125 | /* The check-in is finished, so decrement the counter */ |
| 1126 | (*pnLimit)--; |
| 1127 | } |
| 1128 | |
| @@ -1166,23 +1188,24 @@ | |
| 1166 | ** |
| 1167 | ** --limit N Add no more than N new check-ins to MIRROR. |
| 1168 | ** Useful for debugging |
| 1169 | */ |
| 1170 | void mirror_command(void){ |
| 1171 | const char *zLimit; |
| 1172 | int nLimit = 0x7fffffff; |
| 1173 | int nTotal = 0; |
| 1174 | char *zMirror; |
| 1175 | char *z; |
| 1176 | char *zCmd; |
| 1177 | const char *zDebug = 0; |
| 1178 | double rEnd; |
| 1179 | int rc; |
| 1180 | FILE *xCmd; |
| 1181 | FILE *pIn, *pOut; |
| 1182 | Stmt q; |
| 1183 | char zLine[200]; |
| 1184 | |
| 1185 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 1186 | zDebug = find_option("debug",0,1); |
| 1187 | db_find_and_open_repository(0, 0); |
| 1188 | zLimit = find_option("limit", 0, 1); |
| @@ -1241,10 +1264,13 @@ | |
| 1241 | " WHERE key='start'),0.0)") |
| 1242 | ){ |
| 1243 | fossil_print("no changes\n"); |
| 1244 | return; |
| 1245 | } |
| 1246 | |
| 1247 | /* Change to the MIRROR directory so that the Git commands will work */ |
| 1248 | rc = file_chdir(zMirror, 0); |
| 1249 | if( rc ) fossil_fatal("cannot change the working directory to \"%s\"", |
| 1250 | zMirror); |
| @@ -1297,11 +1323,11 @@ | |
| 1297 | const char *zUuid = db_column_text(&q, 3); |
| 1298 | if( rMTime>rEnd ) rEnd = rMTime; |
| 1299 | if( zType[0]=='t' ){ |
| 1300 | mirror_send_tag(xCmd, rid); |
| 1301 | }else{ |
| 1302 | mirror_send_checkin(xCmd, rid, zUuid, &nLimit); |
| 1303 | printf("\r%d/%d ", nTotal-nLimit, nTotal); |
| 1304 | fflush(stdout); |
| 1305 | } |
| 1306 | } |
| 1307 | db_finalize(&q); |
| 1308 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -995,11 +995,12 @@ | |
| 995 | */ |
| 996 | static void mirror_send_checkin( |
| 997 | FILE *xCmd, /* Write fast-import text on this pipe */ |
| 998 | int rid, /* BLOB.RID for the check-in to export */ |
| 999 | const char *zUuid, /* BLOB.UUID for the check-in to export */ |
| 1000 | int *pnLimit, /* Stop when the counter reaches zero */ |
| 1001 | int fManifest /* MFESTFLG_* values */ |
| 1002 | ){ |
| 1003 | Manifest *pMan; /* The check-in to be output */ |
| 1004 | int i; /* Loop counter */ |
| 1005 | int iParent; /* Which immediate ancestor is primary. -1 for none */ |
| 1006 | Stmt q; /* An SQL query */ |
| @@ -1020,11 +1021,11 @@ | |
| 1021 | for(i=0; i<pMan->nParent; i++){ |
| 1022 | int iMark = mirror_find_mark(pMan->azParent[i], 0); |
| 1023 | if( iMark<=0 ){ |
| 1024 | int prid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", |
| 1025 | pMan->azParent[i]); |
| 1026 | mirror_send_checkin(xCmd, prid, pMan->azParent[i], pnLimit, fManifest); |
| 1027 | if( *pnLimit<=0 ){ |
| 1028 | manifest_destroy(pMan); |
| 1029 | return; |
| 1030 | } |
| 1031 | } |
| @@ -1119,10 +1120,31 @@ | |
| 1120 | zFNQuoted = mirror_quote_filename_if_needed(zFilename); |
| 1121 | fprintf(xCmd,"M %s :%d %s\n", zGitMode, iMark, zFNQuoted); |
| 1122 | fossil_free(zFNQuoted); |
| 1123 | } |
| 1124 | db_finalize(&q); |
| 1125 | |
| 1126 | /* Include Fossil-generated auxiliary files in the check-in */ |
| 1127 | if( fManifest & MFESTFLG_RAW ){ |
| 1128 | Blob manifest; |
| 1129 | content_get(rid, &manifest); |
| 1130 | fprintf(xCmd,"M 100644 inline manifest\ndata %d\n%s\n", |
| 1131 | blob_size(&manifest), blob_str(&manifest)); |
| 1132 | blob_reset(&manifest); |
| 1133 | } |
| 1134 | if( fManifest & MFESTFLG_UUID ){ |
| 1135 | int n = (int)strlen(zUuid); |
| 1136 | fprintf(xCmd,"M 100644 inline manifest.uuid\ndata %d\n%s\n", n, zUuid); |
| 1137 | } |
| 1138 | if( fManifest & MFESTFLG_TAGS ){ |
| 1139 | Blob tagslist; |
| 1140 | blob_init(&tagslist, 0, 0); |
| 1141 | get_checkin_taglist(rid, &tagslist); |
| 1142 | fprintf(xCmd,"M 100644 inline manifest.tags\ndata %d\n%s\n", |
| 1143 | blob_size(&tagslist), blob_str(&tagslist)); |
| 1144 | blob_reset(&tagslist); |
| 1145 | } |
| 1146 | |
| 1147 | /* The check-in is finished, so decrement the counter */ |
| 1148 | (*pnLimit)--; |
| 1149 | } |
| 1150 | |
| @@ -1166,23 +1188,24 @@ | |
| 1188 | ** |
| 1189 | ** --limit N Add no more than N new check-ins to MIRROR. |
| 1190 | ** Useful for debugging |
| 1191 | */ |
| 1192 | void mirror_command(void){ |
| 1193 | const char *zLimit; /* Text of the --limit flag */ |
| 1194 | int nLimit = 0x7fffffff; /* Numeric value of the --limit flag */ |
| 1195 | int nTotal = 0; /* Total number of check-ins to export */ |
| 1196 | char *zMirror; /* Name of the mirror */ |
| 1197 | char *z; /* Generic string */ |
| 1198 | char *zCmd; /* git command to run as a subprocess */ |
| 1199 | const char *zDebug = 0; /* Value of the --debug flag */ |
| 1200 | double rEnd; /* time of most recent export */ |
| 1201 | int rc; /* Result code */ |
| 1202 | int fManifest; /* Current "manifest" setting */ |
| 1203 | FILE *xCmd; /* Pipe to the "git fast-import" command */ |
| 1204 | FILE *pIn, *pOut; /* Git mark files */ |
| 1205 | Stmt q; /* Queries */ |
| 1206 | char zLine[200]; /* One line of a mark file */ |
| 1207 | |
| 1208 | find_option("git", 0, 0); /* Ignore the --git option for now */ |
| 1209 | zDebug = find_option("debug",0,1); |
| 1210 | db_find_and_open_repository(0, 0); |
| 1211 | zLimit = find_option("limit", 0, 1); |
| @@ -1241,10 +1264,13 @@ | |
| 1264 | " WHERE key='start'),0.0)") |
| 1265 | ){ |
| 1266 | fossil_print("no changes\n"); |
| 1267 | return; |
| 1268 | } |
| 1269 | |
| 1270 | /* Do we need to include manifest files in the clone? */ |
| 1271 | fManifest = db_get_manifest_setting(); |
| 1272 | |
| 1273 | /* Change to the MIRROR directory so that the Git commands will work */ |
| 1274 | rc = file_chdir(zMirror, 0); |
| 1275 | if( rc ) fossil_fatal("cannot change the working directory to \"%s\"", |
| 1276 | zMirror); |
| @@ -1297,11 +1323,11 @@ | |
| 1323 | const char *zUuid = db_column_text(&q, 3); |
| 1324 | if( rMTime>rEnd ) rEnd = rMTime; |
| 1325 | if( zType[0]=='t' ){ |
| 1326 | mirror_send_tag(xCmd, rid); |
| 1327 | }else{ |
| 1328 | mirror_send_checkin(xCmd, rid, zUuid, &nLimit, fManifest); |
| 1329 | printf("\r%d/%d ", nTotal-nLimit, nTotal); |
| 1330 | fflush(stdout); |
| 1331 | } |
| 1332 | } |
| 1333 | db_finalize(&q); |
| 1334 |