Fossil SCM
Progress on the "fossil mirror" command.
Commit
5063eb521ed10926d736cd54fbff2fb9707c97ba27104c9eead71d545e0d7a1b
Parent
dbc1c62a995ae76…
1 file changed
+9
-13
+9
-13
| --- src/export.c | ||
| +++ src/export.c | ||
| @@ -971,11 +971,11 @@ | ||
| 971 | 971 | fossil_free(zBranch); |
| 972 | 972 | iMark = mirror_find_mark(zUuid, 1); |
| 973 | 973 | fprintf(xCmd, "mark :%d\n", iMark); |
| 974 | 974 | fprintf(xCmd, "committer %s <%[email protected]> %lld +0000\n", |
| 975 | 975 | pMan->zUser, pMan->zUser, |
| 976 | - (sqlite3_int64)(pMan->rDate-2440587.5)*86400 | |
| 976 | + (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0) | |
| 977 | 977 | ); |
| 978 | 978 | fprintf(xCmd, "data %d\n", (int)strlen(pMan->zComment)); |
| 979 | 979 | fprintf(xCmd, "%s\n", pMan->zComment); |
| 980 | 980 | for(i=0; i<pMan->nParent; i++){ |
| 981 | 981 | int iOther = mirror_find_mark(pMan->azParent[i], 0); |
| @@ -1074,12 +1074,10 @@ | ||
| 1074 | 1074 | const char *zLimit; |
| 1075 | 1075 | int nLimit = 0x7fffffff; |
| 1076 | 1076 | int nTotal = 0; |
| 1077 | 1077 | char *zMirror; |
| 1078 | 1078 | char *z; |
| 1079 | - char *zInFile; | |
| 1080 | - char *zOutFile; | |
| 1081 | 1079 | char *zCmd; |
| 1082 | 1080 | const char *zDebug = 0; |
| 1083 | 1081 | double rEnd; |
| 1084 | 1082 | int rc; |
| 1085 | 1083 | FILE *xCmd; |
| @@ -1219,25 +1217,23 @@ | ||
| 1219 | 1217 | fossil_print("%d check-ins added to the mirror\n", nTotal-nLimit); |
| 1220 | 1218 | |
| 1221 | 1219 | /* Read the export-marks file. Transfer the new marks over into |
| 1222 | 1220 | ** the import-marks file. |
| 1223 | 1221 | */ |
| 1224 | - zInFile = mprintf("%s/.mirror_state/in", zMirror); | |
| 1225 | - zOutFile = mprintf("%s/.mirror_state/out", zMirror); | |
| 1226 | - pOut = fopen(zOutFile, "rb"); | |
| 1222 | + pOut = fopen(".mirror_state/out", "rb"); | |
| 1227 | 1223 | if( pOut ){ |
| 1228 | - pIn = fopen(zInFile, "ab"); | |
| 1224 | + pIn = fopen(".mirror_state/in", "ab"); | |
| 1229 | 1225 | if( pIn==0 ){ |
| 1230 | - fossil_fatal("cannot open %s for appending", zInFile); | |
| 1226 | + fossil_fatal("cannot open %s/.mirror_state/in for appending", zMirror); | |
| 1231 | 1227 | } |
| 1232 | - while( fgets(zLine, sizeof(zLine), pIn) ){ | |
| 1233 | - fputs(zLine, pOut); | |
| 1228 | + while( fgets(zLine, sizeof(zLine), pOut) ){ | |
| 1229 | + fputs(zLine, pIn); | |
| 1234 | 1230 | } |
| 1235 | 1231 | fclose(pOut); |
| 1236 | 1232 | fclose(pIn); |
| 1237 | - file_delete(zOutFile); | |
| 1233 | + file_delete(".mirror_state/out"); | |
| 1234 | + }else{ | |
| 1235 | + fossil_fatal("git fast-import didn't generate a marks file!"); | |
| 1238 | 1236 | } |
| 1239 | - fossil_free(zInFile); | |
| 1240 | - fossil_free(zOutFile); | |
| 1241 | 1237 | |
| 1242 | 1238 | /* Optionally do a "git push" */ |
| 1243 | 1239 | } |
| 1244 | 1240 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -971,11 +971,11 @@ | |
| 971 | fossil_free(zBranch); |
| 972 | iMark = mirror_find_mark(zUuid, 1); |
| 973 | fprintf(xCmd, "mark :%d\n", iMark); |
| 974 | fprintf(xCmd, "committer %s <%[email protected]> %lld +0000\n", |
| 975 | pMan->zUser, pMan->zUser, |
| 976 | (sqlite3_int64)(pMan->rDate-2440587.5)*86400 |
| 977 | ); |
| 978 | fprintf(xCmd, "data %d\n", (int)strlen(pMan->zComment)); |
| 979 | fprintf(xCmd, "%s\n", pMan->zComment); |
| 980 | for(i=0; i<pMan->nParent; i++){ |
| 981 | int iOther = mirror_find_mark(pMan->azParent[i], 0); |
| @@ -1074,12 +1074,10 @@ | |
| 1074 | const char *zLimit; |
| 1075 | int nLimit = 0x7fffffff; |
| 1076 | int nTotal = 0; |
| 1077 | char *zMirror; |
| 1078 | char *z; |
| 1079 | char *zInFile; |
| 1080 | char *zOutFile; |
| 1081 | char *zCmd; |
| 1082 | const char *zDebug = 0; |
| 1083 | double rEnd; |
| 1084 | int rc; |
| 1085 | FILE *xCmd; |
| @@ -1219,25 +1217,23 @@ | |
| 1219 | fossil_print("%d check-ins added to the mirror\n", nTotal-nLimit); |
| 1220 | |
| 1221 | /* Read the export-marks file. Transfer the new marks over into |
| 1222 | ** the import-marks file. |
| 1223 | */ |
| 1224 | zInFile = mprintf("%s/.mirror_state/in", zMirror); |
| 1225 | zOutFile = mprintf("%s/.mirror_state/out", zMirror); |
| 1226 | pOut = fopen(zOutFile, "rb"); |
| 1227 | if( pOut ){ |
| 1228 | pIn = fopen(zInFile, "ab"); |
| 1229 | if( pIn==0 ){ |
| 1230 | fossil_fatal("cannot open %s for appending", zInFile); |
| 1231 | } |
| 1232 | while( fgets(zLine, sizeof(zLine), pIn) ){ |
| 1233 | fputs(zLine, pOut); |
| 1234 | } |
| 1235 | fclose(pOut); |
| 1236 | fclose(pIn); |
| 1237 | file_delete(zOutFile); |
| 1238 | } |
| 1239 | fossil_free(zInFile); |
| 1240 | fossil_free(zOutFile); |
| 1241 | |
| 1242 | /* Optionally do a "git push" */ |
| 1243 | } |
| 1244 |
| --- src/export.c | |
| +++ src/export.c | |
| @@ -971,11 +971,11 @@ | |
| 971 | fossil_free(zBranch); |
| 972 | iMark = mirror_find_mark(zUuid, 1); |
| 973 | fprintf(xCmd, "mark :%d\n", iMark); |
| 974 | fprintf(xCmd, "committer %s <%[email protected]> %lld +0000\n", |
| 975 | pMan->zUser, pMan->zUser, |
| 976 | (sqlite3_int64)((pMan->rDate-2440587.5)*86400.0) |
| 977 | ); |
| 978 | fprintf(xCmd, "data %d\n", (int)strlen(pMan->zComment)); |
| 979 | fprintf(xCmd, "%s\n", pMan->zComment); |
| 980 | for(i=0; i<pMan->nParent; i++){ |
| 981 | int iOther = mirror_find_mark(pMan->azParent[i], 0); |
| @@ -1074,12 +1074,10 @@ | |
| 1074 | const char *zLimit; |
| 1075 | int nLimit = 0x7fffffff; |
| 1076 | int nTotal = 0; |
| 1077 | char *zMirror; |
| 1078 | char *z; |
| 1079 | char *zCmd; |
| 1080 | const char *zDebug = 0; |
| 1081 | double rEnd; |
| 1082 | int rc; |
| 1083 | FILE *xCmd; |
| @@ -1219,25 +1217,23 @@ | |
| 1217 | fossil_print("%d check-ins added to the mirror\n", nTotal-nLimit); |
| 1218 | |
| 1219 | /* Read the export-marks file. Transfer the new marks over into |
| 1220 | ** the import-marks file. |
| 1221 | */ |
| 1222 | pOut = fopen(".mirror_state/out", "rb"); |
| 1223 | if( pOut ){ |
| 1224 | pIn = fopen(".mirror_state/in", "ab"); |
| 1225 | if( pIn==0 ){ |
| 1226 | fossil_fatal("cannot open %s/.mirror_state/in for appending", zMirror); |
| 1227 | } |
| 1228 | while( fgets(zLine, sizeof(zLine), pOut) ){ |
| 1229 | fputs(zLine, pIn); |
| 1230 | } |
| 1231 | fclose(pOut); |
| 1232 | fclose(pIn); |
| 1233 | file_delete(".mirror_state/out"); |
| 1234 | }else{ |
| 1235 | fossil_fatal("git fast-import didn't generate a marks file!"); |
| 1236 | } |
| 1237 | |
| 1238 | /* Optionally do a "git push" */ |
| 1239 | } |
| 1240 |