969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
|
/* Export the check-in */
fprintf(xCmd, "commit refs/head/%s\n", zBranch);
fossil_free(zBranch);
iMark = mirror_find_mark(zUuid, 1);
fprintf(xCmd, "mark :%d\n", iMark);
fprintf(xCmd, "committer %s <%s@noemail.net> %lld +0000\n",
pMan->zUser, pMan->zUser,
(sqlite3_int64)(pMan->rDate-2440587.5)*86400
);
fprintf(xCmd, "data %d\n", (int)strlen(pMan->zComment));
fprintf(xCmd, "%s\n", pMan->zComment);
for(i=0; i<pMan->nParent; i++){
int iOther = mirror_find_mark(pMan->azParent[i], 0);
if( i==0 ){
fprintf(xCmd, "from :%d\n", iOther);
|
|
|
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
|
/* Export the check-in */
fprintf(xCmd, "commit refs/head/%s\n", zBranch);
fossil_free(zBranch);
iMark = mirror_find_mark(zUuid, 1);
fprintf(xCmd, "mark :%d\n", iMark);
fprintf(xCmd, "committer %s <%s@noemail.net> %lld +0000\n",
pMan->zUser, pMan->zUser,
(sqlite3_int64)((pMan->rDate-2440587.5)*86400.0)
);
fprintf(xCmd, "data %d\n", (int)strlen(pMan->zComment));
fprintf(xCmd, "%s\n", pMan->zComment);
for(i=0; i<pMan->nParent; i++){
int iOther = mirror_find_mark(pMan->azParent[i], 0);
if( i==0 ){
fprintf(xCmd, "from :%d\n", iOther);
|
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
|
*/
void mirror_command(void){
const char *zLimit;
int nLimit = 0x7fffffff;
int nTotal = 0;
char *zMirror;
char *z;
char *zInFile;
char *zOutFile;
char *zCmd;
const char *zDebug = 0;
double rEnd;
int rc;
FILE *xCmd;
FILE *pIn, *pOut;
Stmt q;
|
<
<
|
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
|
*/
void mirror_command(void){
const char *zLimit;
int nLimit = 0x7fffffff;
int nTotal = 0;
char *zMirror;
char *z;
char *zCmd;
const char *zDebug = 0;
double rEnd;
int rc;
FILE *xCmd;
FILE *pIn, *pOut;
Stmt q;
|
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
|
pclose(xCmd);
}
fossil_print("%d check-ins added to the mirror\n", nTotal-nLimit);
/* Read the export-marks file. Transfer the new marks over into
** the import-marks file.
*/
zInFile = mprintf("%s/.mirror_state/in", zMirror);
zOutFile = mprintf("%s/.mirror_state/out", zMirror);
pOut = fopen(zOutFile, "rb");
if( pOut ){
pIn = fopen(zInFile, "ab");
if( pIn==0 ){
fossil_fatal("cannot open %s for appending", zInFile);
}
while( fgets(zLine, sizeof(zLine), pIn) ){
fputs(zLine, pOut);
}
fclose(pOut);
fclose(pIn);
file_delete(zOutFile);
}
fossil_free(zInFile);
fossil_free(zOutFile);
/* Optionally do a "git push" */
}
|
<
|
<
|
|
|
|
|
>
>
<
<
|
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
|
pclose(xCmd);
}
fossil_print("%d check-ins added to the mirror\n", nTotal-nLimit);
/* Read the export-marks file. Transfer the new marks over into
** the import-marks file.
*/
pOut = fopen(".mirror_state/out", "rb");
if( pOut ){
pIn = fopen(".mirror_state/in", "ab");
if( pIn==0 ){
fossil_fatal("cannot open %s/.mirror_state/in for appending", zMirror);
}
while( fgets(zLine, sizeof(zLine), pOut) ){
fputs(zLine, pIn);
}
fclose(pOut);
fclose(pIn);
file_delete(".mirror_state/out");
}else{
fossil_fatal("git fast-import didn't generate a marks file!");
}
/* Optionally do a "git push" */
}
|