Fossil SCM

Sync operations now commit each round-trip.

andybradford 2014-05-20 06:03 trunk merge
Commit 16da1b6dff02f5031d2566bb4b6856605a54338a
+9 -4
--- src/http.c
+++ src/http.c
@@ -323,14 +323,18 @@
323323
}
324324
}else if( rc==302 && fossil_strnicmp(zLine, "location:", 9)==0 ){
325325
int i, j;
326326
327327
if ( --maxRedirect == 0){
328
- fossil_fatal("redirect limit exceeded");
328
+ fossil_warning("redirect limit exceeded");
329
+ goto write_err;
329330
}
330331
for(i=9; zLine[i] && zLine[i]==' '; i++){}
331
- if( zLine[i]==0 ) fossil_fatal("malformed redirect: %s", zLine);
332
+ if( zLine[i]==0 ){
333
+ fossil_warning("malformed redirect: %s", zLine);
334
+ goto write_err;
335
+ }
332336
j = strlen(zLine) - 1;
333337
while( j>4 && fossil_strcmp(&zLine[j-4],"/xfer")==0 ){
334338
j -= 4;
335339
zLine[j] = 0;
336340
}
@@ -351,11 +355,11 @@
351355
isError = 1;
352356
}
353357
}
354358
}
355359
if( iLength<0 ){
356
- fossil_fatal("server did not reply");
360
+ fossil_warning("server did not reply");
357361
goto write_err;
358362
}
359363
if( rc!=200 ){
360364
fossil_warning("\"location:\" missing from 302 redirect reply");
361365
goto write_err;
@@ -378,11 +382,12 @@
378382
if( z[i]==0 ) break;
379383
}
380384
z[j] = z[i];
381385
}
382386
z[j] = 0;
383
- fossil_fatal("server sends error: %s", z);
387
+ fossil_warning("server sends error: %s", z);
388
+ goto write_err;
384389
}
385390
if( isCompressed ) blob_uncompress(pReply, pReply);
386391
387392
/*
388393
** Close the connection to the server if appropriate.
389394
--- src/http.c
+++ src/http.c
@@ -323,14 +323,18 @@
323 }
324 }else if( rc==302 && fossil_strnicmp(zLine, "location:", 9)==0 ){
325 int i, j;
326
327 if ( --maxRedirect == 0){
328 fossil_fatal("redirect limit exceeded");
 
329 }
330 for(i=9; zLine[i] && zLine[i]==' '; i++){}
331 if( zLine[i]==0 ) fossil_fatal("malformed redirect: %s", zLine);
 
 
 
332 j = strlen(zLine) - 1;
333 while( j>4 && fossil_strcmp(&zLine[j-4],"/xfer")==0 ){
334 j -= 4;
335 zLine[j] = 0;
336 }
@@ -351,11 +355,11 @@
351 isError = 1;
352 }
353 }
354 }
355 if( iLength<0 ){
356 fossil_fatal("server did not reply");
357 goto write_err;
358 }
359 if( rc!=200 ){
360 fossil_warning("\"location:\" missing from 302 redirect reply");
361 goto write_err;
@@ -378,11 +382,12 @@
378 if( z[i]==0 ) break;
379 }
380 z[j] = z[i];
381 }
382 z[j] = 0;
383 fossil_fatal("server sends error: %s", z);
 
384 }
385 if( isCompressed ) blob_uncompress(pReply, pReply);
386
387 /*
388 ** Close the connection to the server if appropriate.
389
--- src/http.c
+++ src/http.c
@@ -323,14 +323,18 @@
323 }
324 }else if( rc==302 && fossil_strnicmp(zLine, "location:", 9)==0 ){
325 int i, j;
326
327 if ( --maxRedirect == 0){
328 fossil_warning("redirect limit exceeded");
329 goto write_err;
330 }
331 for(i=9; zLine[i] && zLine[i]==' '; i++){}
332 if( zLine[i]==0 ){
333 fossil_warning("malformed redirect: %s", zLine);
334 goto write_err;
335 }
336 j = strlen(zLine) - 1;
337 while( j>4 && fossil_strcmp(&zLine[j-4],"/xfer")==0 ){
338 j -= 4;
339 zLine[j] = 0;
340 }
@@ -351,11 +355,11 @@
355 isError = 1;
356 }
357 }
358 }
359 if( iLength<0 ){
360 fossil_warning("server did not reply");
361 goto write_err;
362 }
363 if( rc!=200 ){
364 fossil_warning("\"location:\" missing from 302 redirect reply");
365 goto write_err;
@@ -378,11 +382,12 @@
382 if( z[i]==0 ) break;
383 }
384 z[j] = z[i];
385 }
386 z[j] = 0;
387 fossil_warning("server sends error: %s", z);
388 goto write_err;
389 }
390 if( isCompressed ) blob_uncompress(pReply, pReply);
391
392 /*
393 ** Close the connection to the server if appropriate.
394
+10 -2
--- src/merge.c
+++ src/merge.c
@@ -91,10 +91,12 @@
9191
** files whose names differ only in case are taken
9292
** to be the same file.
9393
**
9494
** -f|--force Force the merge even if it would be a no-op.
9595
**
96
+** --force-missing Force the merge even if there is missing content.
97
+**
9698
** --integrate Merged branch will be closed when committing.
9799
**
98100
** -n|--dry-run If given, display instead of run actions
99101
**
100102
** -v|--verbose Show additional details of the merge
@@ -107,10 +109,11 @@
107109
int integrateFlag; /* True if the --integrate option is present */
108110
int pickFlag; /* True if the --cherrypick option is present */
109111
int backoutFlag; /* True if the --backout option is present */
110112
int dryRunFlag; /* True if the --dry-run or -n option is present */
111113
int forceFlag; /* True if the --force or -f option is present */
114
+ int forceMissingFlag; /* True if the --force-missing option is present */
112115
const char *zBinGlob; /* The value of --binary */
113116
const char *zPivot; /* The value of --baseline */
114117
int debugFlag; /* True if --debug is present */
115118
int nChng; /* Number of file name changes */
116119
int *aChng; /* An array of file name changes */
@@ -127,10 +130,11 @@
127130
** P The "pivot" - the most recent common ancestor of V and M.
128131
*/
129132
130133
undo_capture_command_line();
131134
verboseFlag = find_option("verbose","v",0)!=0;
135
+ forceMissingFlag = find_option("force-missing",0,0)!=0;
132136
if( !verboseFlag ){
133137
verboseFlag = find_option("detail",0,0)!=0; /* deprecated */
134138
}
135139
pickFlag = find_option("cherrypick",0,0)!=0;
136140
integrateFlag = find_option("integrate",0,0)!=0;
@@ -269,12 +273,16 @@
269273
print_checkin_description(pid, 12, "baseline:");
270274
}
271275
vfile_check_signature(vid, CKSIG_ENOTFILE);
272276
db_begin_transaction();
273277
if( !dryRunFlag ) undo_begin();
274
- load_vfile_from_rid(mid);
275
- load_vfile_from_rid(pid);
278
+ if( load_vfile_from_rid(mid) && !forceMissingFlag ){
279
+ fossil_fatal("missing content, unable to merge");
280
+ }
281
+ if( load_vfile_from_rid(pid) && !forceMissingFlag ){
282
+ fossil_fatal("missing content, unable to merge");
283
+ }
276284
if( debugFlag ){
277285
char *z;
278286
z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pid);
279287
fossil_print("P=%d %z\n", pid, z);
280288
z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid);
281289
--- src/merge.c
+++ src/merge.c
@@ -91,10 +91,12 @@
91 ** files whose names differ only in case are taken
92 ** to be the same file.
93 **
94 ** -f|--force Force the merge even if it would be a no-op.
95 **
 
 
96 ** --integrate Merged branch will be closed when committing.
97 **
98 ** -n|--dry-run If given, display instead of run actions
99 **
100 ** -v|--verbose Show additional details of the merge
@@ -107,10 +109,11 @@
107 int integrateFlag; /* True if the --integrate option is present */
108 int pickFlag; /* True if the --cherrypick option is present */
109 int backoutFlag; /* True if the --backout option is present */
110 int dryRunFlag; /* True if the --dry-run or -n option is present */
111 int forceFlag; /* True if the --force or -f option is present */
 
112 const char *zBinGlob; /* The value of --binary */
113 const char *zPivot; /* The value of --baseline */
114 int debugFlag; /* True if --debug is present */
115 int nChng; /* Number of file name changes */
116 int *aChng; /* An array of file name changes */
@@ -127,10 +130,11 @@
127 ** P The "pivot" - the most recent common ancestor of V and M.
128 */
129
130 undo_capture_command_line();
131 verboseFlag = find_option("verbose","v",0)!=0;
 
132 if( !verboseFlag ){
133 verboseFlag = find_option("detail",0,0)!=0; /* deprecated */
134 }
135 pickFlag = find_option("cherrypick",0,0)!=0;
136 integrateFlag = find_option("integrate",0,0)!=0;
@@ -269,12 +273,16 @@
269 print_checkin_description(pid, 12, "baseline:");
270 }
271 vfile_check_signature(vid, CKSIG_ENOTFILE);
272 db_begin_transaction();
273 if( !dryRunFlag ) undo_begin();
274 load_vfile_from_rid(mid);
275 load_vfile_from_rid(pid);
 
 
 
 
276 if( debugFlag ){
277 char *z;
278 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pid);
279 fossil_print("P=%d %z\n", pid, z);
280 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid);
281
--- src/merge.c
+++ src/merge.c
@@ -91,10 +91,12 @@
91 ** files whose names differ only in case are taken
92 ** to be the same file.
93 **
94 ** -f|--force Force the merge even if it would be a no-op.
95 **
96 ** --force-missing Force the merge even if there is missing content.
97 **
98 ** --integrate Merged branch will be closed when committing.
99 **
100 ** -n|--dry-run If given, display instead of run actions
101 **
102 ** -v|--verbose Show additional details of the merge
@@ -107,10 +109,11 @@
109 int integrateFlag; /* True if the --integrate option is present */
110 int pickFlag; /* True if the --cherrypick option is present */
111 int backoutFlag; /* True if the --backout option is present */
112 int dryRunFlag; /* True if the --dry-run or -n option is present */
113 int forceFlag; /* True if the --force or -f option is present */
114 int forceMissingFlag; /* True if the --force-missing option is present */
115 const char *zBinGlob; /* The value of --binary */
116 const char *zPivot; /* The value of --baseline */
117 int debugFlag; /* True if --debug is present */
118 int nChng; /* Number of file name changes */
119 int *aChng; /* An array of file name changes */
@@ -127,10 +130,11 @@
130 ** P The "pivot" - the most recent common ancestor of V and M.
131 */
132
133 undo_capture_command_line();
134 verboseFlag = find_option("verbose","v",0)!=0;
135 forceMissingFlag = find_option("force-missing",0,0)!=0;
136 if( !verboseFlag ){
137 verboseFlag = find_option("detail",0,0)!=0; /* deprecated */
138 }
139 pickFlag = find_option("cherrypick",0,0)!=0;
140 integrateFlag = find_option("integrate",0,0)!=0;
@@ -269,12 +273,16 @@
273 print_checkin_description(pid, 12, "baseline:");
274 }
275 vfile_check_signature(vid, CKSIG_ENOTFILE);
276 db_begin_transaction();
277 if( !dryRunFlag ) undo_begin();
278 if( load_vfile_from_rid(mid) && !forceMissingFlag ){
279 fossil_fatal("missing content, unable to merge");
280 }
281 if( load_vfile_from_rid(pid) && !forceMissingFlag ){
282 fossil_fatal("missing content, unable to merge");
283 }
284 if( debugFlag ){
285 char *z;
286 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", pid);
287 fossil_print("P=%d %z\n", pid, z);
288 z = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid);
289
+9 -2
--- src/update.c
+++ src/update.c
@@ -88,10 +88,11 @@
8888
**
8989
** Options:
9090
** --case-sensitive <BOOL> override case-sensitive setting
9191
** --debug print debug information on stdout
9292
** --latest acceptable in place of VERSION, update to latest version
93
+** --force-missing force update if missing content after sync
9394
** -n|--dry-run If given, display instead of run actions
9495
** -v|--verbose print status information about all files
9596
**
9697
** See also: revert
9798
*/
@@ -100,10 +101,11 @@
100101
int tid=0; /* Target version - version we are changing to */
101102
Stmt q;
102103
int latestFlag; /* --latest. Pick the latest version if true */
103104
int dryRunFlag; /* -n or --dry-run. Do a dry run */
104105
int verboseFlag; /* -v or --verbose. Output extra information */
106
+ int forceMissingFlag; /* --force-missing. Continue if missing content */
105107
int debugFlag; /* --debug option */
106108
int setmtimeFlag; /* --setmtime. Set mtimes on files */
107109
int nChng; /* Number of file renames */
108110
int *aChng; /* Array of file renames */
109111
int i; /* Loop counter */
@@ -120,18 +122,21 @@
120122
dryRunFlag = find_option("dry-run","n",0)!=0;
121123
if( !dryRunFlag ){
122124
dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
123125
}
124126
verboseFlag = find_option("verbose","v",0)!=0;
127
+ forceMissingFlag = find_option("force-missing",0,0)!=0;
125128
debugFlag = find_option("debug",0,0)!=0;
126129
setmtimeFlag = find_option("setmtime",0,0)!=0;
127130
capture_case_sensitive_option();
128131
db_must_be_within_tree();
129132
vid = db_lget_int("checkout", 0);
130133
user_select();
131134
if( !dryRunFlag && !internalUpdate ){
132
- autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag);
135
+ if( autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag) ){
136
+ fossil_fatal("Cannot proceed with update");
137
+ }
133138
}
134139
135140
/* Create any empty directories now, as well as after the update,
136141
** so changes in settings are reflected now */
137142
if( !dryRunFlag ) ensure_empty_dirs_created();
@@ -203,11 +208,13 @@
203208
}
204209
205210
db_begin_transaction();
206211
vfile_check_signature(vid, CKSIG_ENOTFILE);
207212
if( !dryRunFlag && !internalUpdate ) undo_begin();
208
- load_vfile_from_rid(tid);
213
+ if( load_vfile_from_rid(tid) && !forceMissingFlag ){
214
+ fossil_fatal("missing content, unable to update");
215
+ };
209216
210217
/*
211218
** The record.fn field is used to match files against each other. The
212219
** FV table contains one row for each each unique filename in
213220
** in the current checkout, the pivot, and the version being merged.
214221
--- src/update.c
+++ src/update.c
@@ -88,10 +88,11 @@
88 **
89 ** Options:
90 ** --case-sensitive <BOOL> override case-sensitive setting
91 ** --debug print debug information on stdout
92 ** --latest acceptable in place of VERSION, update to latest version
 
93 ** -n|--dry-run If given, display instead of run actions
94 ** -v|--verbose print status information about all files
95 **
96 ** See also: revert
97 */
@@ -100,10 +101,11 @@
100 int tid=0; /* Target version - version we are changing to */
101 Stmt q;
102 int latestFlag; /* --latest. Pick the latest version if true */
103 int dryRunFlag; /* -n or --dry-run. Do a dry run */
104 int verboseFlag; /* -v or --verbose. Output extra information */
 
105 int debugFlag; /* --debug option */
106 int setmtimeFlag; /* --setmtime. Set mtimes on files */
107 int nChng; /* Number of file renames */
108 int *aChng; /* Array of file renames */
109 int i; /* Loop counter */
@@ -120,18 +122,21 @@
120 dryRunFlag = find_option("dry-run","n",0)!=0;
121 if( !dryRunFlag ){
122 dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
123 }
124 verboseFlag = find_option("verbose","v",0)!=0;
 
125 debugFlag = find_option("debug",0,0)!=0;
126 setmtimeFlag = find_option("setmtime",0,0)!=0;
127 capture_case_sensitive_option();
128 db_must_be_within_tree();
129 vid = db_lget_int("checkout", 0);
130 user_select();
131 if( !dryRunFlag && !internalUpdate ){
132 autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag);
 
 
133 }
134
135 /* Create any empty directories now, as well as after the update,
136 ** so changes in settings are reflected now */
137 if( !dryRunFlag ) ensure_empty_dirs_created();
@@ -203,11 +208,13 @@
203 }
204
205 db_begin_transaction();
206 vfile_check_signature(vid, CKSIG_ENOTFILE);
207 if( !dryRunFlag && !internalUpdate ) undo_begin();
208 load_vfile_from_rid(tid);
 
 
209
210 /*
211 ** The record.fn field is used to match files against each other. The
212 ** FV table contains one row for each each unique filename in
213 ** in the current checkout, the pivot, and the version being merged.
214
--- src/update.c
+++ src/update.c
@@ -88,10 +88,11 @@
88 **
89 ** Options:
90 ** --case-sensitive <BOOL> override case-sensitive setting
91 ** --debug print debug information on stdout
92 ** --latest acceptable in place of VERSION, update to latest version
93 ** --force-missing force update if missing content after sync
94 ** -n|--dry-run If given, display instead of run actions
95 ** -v|--verbose print status information about all files
96 **
97 ** See also: revert
98 */
@@ -100,10 +101,11 @@
101 int tid=0; /* Target version - version we are changing to */
102 Stmt q;
103 int latestFlag; /* --latest. Pick the latest version if true */
104 int dryRunFlag; /* -n or --dry-run. Do a dry run */
105 int verboseFlag; /* -v or --verbose. Output extra information */
106 int forceMissingFlag; /* --force-missing. Continue if missing content */
107 int debugFlag; /* --debug option */
108 int setmtimeFlag; /* --setmtime. Set mtimes on files */
109 int nChng; /* Number of file renames */
110 int *aChng; /* Array of file renames */
111 int i; /* Loop counter */
@@ -120,18 +122,21 @@
122 dryRunFlag = find_option("dry-run","n",0)!=0;
123 if( !dryRunFlag ){
124 dryRunFlag = find_option("nochange",0,0)!=0; /* deprecated */
125 }
126 verboseFlag = find_option("verbose","v",0)!=0;
127 forceMissingFlag = find_option("force-missing",0,0)!=0;
128 debugFlag = find_option("debug",0,0)!=0;
129 setmtimeFlag = find_option("setmtime",0,0)!=0;
130 capture_case_sensitive_option();
131 db_must_be_within_tree();
132 vid = db_lget_int("checkout", 0);
133 user_select();
134 if( !dryRunFlag && !internalUpdate ){
135 if( autosync(SYNC_PULL + SYNC_VERBOSE*verboseFlag) ){
136 fossil_fatal("Cannot proceed with update");
137 }
138 }
139
140 /* Create any empty directories now, as well as after the update,
141 ** so changes in settings are reflected now */
142 if( !dryRunFlag ) ensure_empty_dirs_created();
@@ -203,11 +208,13 @@
208 }
209
210 db_begin_transaction();
211 vfile_check_signature(vid, CKSIG_ENOTFILE);
212 if( !dryRunFlag && !internalUpdate ) undo_begin();
213 if( load_vfile_from_rid(tid) && !forceMissingFlag ){
214 fossil_fatal("missing content, unable to update");
215 };
216
217 /*
218 ** The record.fn field is used to match files against each other. The
219 ** FV table contains one row for each each unique filename in
220 ** in the current checkout, the pivot, and the version being merged.
221
+9 -5
--- src/vfile.c
+++ src/vfile.c
@@ -68,34 +68,36 @@
6868
return rid;
6969
}
7070
7171
7272
/*
73
-** Load a vfile from a record ID.
73
+** Load a vfile from a record ID. Return the number of files with
74
+** missing content.
7475
*/
75
-void load_vfile_from_rid(int vid){
76
- int rid, size;
76
+int load_vfile_from_rid(int vid){
77
+ int rid, size, nMissing;
7778
Stmt ins, ridq;
7879
Manifest *p;
7980
ManifestFile *pFile;
8081
8182
if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
82
- return;
83
+ return 0;
8384
}
8485
8586
db_begin_transaction();
8687
p = manifest_get(vid, CFTYPE_MANIFEST, 0);
8788
if( p==0 ) {
8889
db_end_transaction(1);
89
- return;
90
+ return 0;
9091
}
9192
db_prepare(&ins,
9293
"INSERT INTO vfile(vid,isexe,islink,rid,mrid,pathname) "
9394
" VALUES(:vid,:isexe,:islink,:id,:id,:name)");
9495
db_prepare(&ridq, "SELECT rid,size FROM blob WHERE uuid=:uuid");
9596
db_bind_int(&ins, ":vid", vid);
9697
manifest_file_rewind(p);
98
+ nMissing = 0;
9799
while( (pFile = manifest_file_next(p,0))!=0 ){
98100
if( pFile->zUuid==0 || uuid_is_shunned(pFile->zUuid) ) continue;
99101
db_bind_text(&ridq, ":uuid", pFile->zUuid);
100102
if( db_step(&ridq)==SQLITE_ROW ){
101103
rid = db_column_int(&ridq, 0);
@@ -105,10 +107,11 @@
105107
size = 0;
106108
}
107109
db_reset(&ridq);
108110
if( rid==0 || size<0 ){
109111
fossil_warning("content missing for %s", pFile->zName);
112
+ nMissing++;
110113
continue;
111114
}
112115
db_bind_int(&ins, ":isexe", ( manifest_file_mperm(pFile)==PERM_EXE ));
113116
db_bind_int(&ins, ":id", rid);
114117
db_bind_text(&ins, ":name", pFile->zName);
@@ -118,10 +121,11 @@
118121
}
119122
db_finalize(&ridq);
120123
db_finalize(&ins);
121124
manifest_destroy(p);
122125
db_end_transaction(0);
126
+ return nMissing;
123127
}
124128
125129
#if INTERFACE
126130
/*
127131
** The cksigFlags parameter to vfile_check_signature() is an OR-ed
128132
--- src/vfile.c
+++ src/vfile.c
@@ -68,34 +68,36 @@
68 return rid;
69 }
70
71
72 /*
73 ** Load a vfile from a record ID.
 
74 */
75 void load_vfile_from_rid(int vid){
76 int rid, size;
77 Stmt ins, ridq;
78 Manifest *p;
79 ManifestFile *pFile;
80
81 if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
82 return;
83 }
84
85 db_begin_transaction();
86 p = manifest_get(vid, CFTYPE_MANIFEST, 0);
87 if( p==0 ) {
88 db_end_transaction(1);
89 return;
90 }
91 db_prepare(&ins,
92 "INSERT INTO vfile(vid,isexe,islink,rid,mrid,pathname) "
93 " VALUES(:vid,:isexe,:islink,:id,:id,:name)");
94 db_prepare(&ridq, "SELECT rid,size FROM blob WHERE uuid=:uuid");
95 db_bind_int(&ins, ":vid", vid);
96 manifest_file_rewind(p);
 
97 while( (pFile = manifest_file_next(p,0))!=0 ){
98 if( pFile->zUuid==0 || uuid_is_shunned(pFile->zUuid) ) continue;
99 db_bind_text(&ridq, ":uuid", pFile->zUuid);
100 if( db_step(&ridq)==SQLITE_ROW ){
101 rid = db_column_int(&ridq, 0);
@@ -105,10 +107,11 @@
105 size = 0;
106 }
107 db_reset(&ridq);
108 if( rid==0 || size<0 ){
109 fossil_warning("content missing for %s", pFile->zName);
 
110 continue;
111 }
112 db_bind_int(&ins, ":isexe", ( manifest_file_mperm(pFile)==PERM_EXE ));
113 db_bind_int(&ins, ":id", rid);
114 db_bind_text(&ins, ":name", pFile->zName);
@@ -118,10 +121,11 @@
118 }
119 db_finalize(&ridq);
120 db_finalize(&ins);
121 manifest_destroy(p);
122 db_end_transaction(0);
 
123 }
124
125 #if INTERFACE
126 /*
127 ** The cksigFlags parameter to vfile_check_signature() is an OR-ed
128
--- src/vfile.c
+++ src/vfile.c
@@ -68,34 +68,36 @@
68 return rid;
69 }
70
71
72 /*
73 ** Load a vfile from a record ID. Return the number of files with
74 ** missing content.
75 */
76 int load_vfile_from_rid(int vid){
77 int rid, size, nMissing;
78 Stmt ins, ridq;
79 Manifest *p;
80 ManifestFile *pFile;
81
82 if( db_exists("SELECT 1 FROM vfile WHERE vid=%d", vid) ){
83 return 0;
84 }
85
86 db_begin_transaction();
87 p = manifest_get(vid, CFTYPE_MANIFEST, 0);
88 if( p==0 ) {
89 db_end_transaction(1);
90 return 0;
91 }
92 db_prepare(&ins,
93 "INSERT INTO vfile(vid,isexe,islink,rid,mrid,pathname) "
94 " VALUES(:vid,:isexe,:islink,:id,:id,:name)");
95 db_prepare(&ridq, "SELECT rid,size FROM blob WHERE uuid=:uuid");
96 db_bind_int(&ins, ":vid", vid);
97 manifest_file_rewind(p);
98 nMissing = 0;
99 while( (pFile = manifest_file_next(p,0))!=0 ){
100 if( pFile->zUuid==0 || uuid_is_shunned(pFile->zUuid) ) continue;
101 db_bind_text(&ridq, ":uuid", pFile->zUuid);
102 if( db_step(&ridq)==SQLITE_ROW ){
103 rid = db_column_int(&ridq, 0);
@@ -105,10 +107,11 @@
107 size = 0;
108 }
109 db_reset(&ridq);
110 if( rid==0 || size<0 ){
111 fossil_warning("content missing for %s", pFile->zName);
112 nMissing++;
113 continue;
114 }
115 db_bind_int(&ins, ":isexe", ( manifest_file_mperm(pFile)==PERM_EXE ));
116 db_bind_int(&ins, ":id", rid);
117 db_bind_text(&ins, ":name", pFile->zName);
@@ -118,10 +121,11 @@
121 }
122 db_finalize(&ridq);
123 db_finalize(&ins);
124 manifest_destroy(p);
125 db_end_transaction(0);
126 return nMissing;
127 }
128
129 #if INTERFACE
130 /*
131 ** The cksigFlags parameter to vfile_check_signature() is an OR-ed
132
+21 -10
--- src/xfer.c
+++ src/xfer.c
@@ -1429,15 +1429,10 @@
14291429
if( syncFlags & SYNC_PRIVATE ){
14301430
g.perm.Private = 1;
14311431
xfer.syncPrivate = 1;
14321432
}
14331433
1434
- db_begin_transaction();
1435
- db_record_repository_filename(0);
1436
- db_multi_exec(
1437
- "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
1438
- );
14391434
blobarray_zero(xfer.aToken, count(xfer.aToken));
14401435
blob_zero(&send);
14411436
blob_zero(&recv);
14421437
blob_zero(&xfer.err);
14431438
blob_zero(&xfer.line);
@@ -1472,18 +1467,23 @@
14721467
blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
14731468
nCardSent++;
14741469
if( (syncFlags & SYNC_PULL)==0 ) zOpType = "Push";
14751470
if( (syncFlags & SYNC_RESYNC)!=0 ) xfer.resync = 0x7fffffff;
14761471
}
1477
- manifest_crosslink_begin();
14781472
if( syncFlags & SYNC_VERBOSE ){
14791473
fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
14801474
}
14811475
14821476
while( go ){
14831477
int newPhantom = 0;
14841478
char *zRandomness;
1479
+ db_begin_transaction();
1480
+ db_record_repository_filename(0);
1481
+ db_multi_exec(
1482
+ "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
1483
+ );
1484
+ manifest_crosslink_begin();
14851485
14861486
/* Send make the most recently received cookie. Let the server
14871487
** figure out if this is a cookie that it cares about.
14881488
*/
14891489
zCookie = db_get("cookie", 0);
@@ -1559,10 +1559,11 @@
15591559
fflush(stdout);
15601560
/* Exchange messages with the server */
15611561
if( http_exchange(&send, &recv, (syncFlags & SYNC_CLONE)==0 || nCycle>0,
15621562
MAX_REDIRECTS) ){
15631563
nErr++;
1564
+ go = 2;
15641565
break;
15651566
}
15661567
15671568
/* Output current stats */
15681569
if( syncFlags & SYNC_VERBOSE ){
@@ -1910,10 +1911,18 @@
19101911
** we have gone at least two rounds. Always go at least two rounds
19111912
** on a clone in order to be sure to retrieve the configuration
19121913
** information which is only sent on the second round.
19131914
*/
19141915
if( cloneSeqno<=0 && nCycle>1 ) go = 0;
1916
+ db_multi_exec("DROP TABLE onremote");
1917
+ if( go ){
1918
+ manifest_crosslink_end(MC_PERMIT_HOOKS);
1919
+ }else{
1920
+ manifest_crosslink_end(MC_PERMIT_HOOKS);
1921
+ content_enable_dephantomize(1);
1922
+ }
1923
+ db_end_transaction(0);
19151924
};
19161925
transport_stats(&nSent, &nRcvd, 1);
19171926
if( (rSkew*24.0*3600.0) > 10.0 ){
19181927
fossil_warning("*** time skew *** server is fast by %s",
19191928
db_timespan_name(rSkew));
@@ -1928,11 +1937,13 @@
19281937
fossil_print(
19291938
"%s finished with %lld bytes sent, %lld bytes received\n",
19301939
zOpType, nSent, nRcvd);
19311940
transport_close(&g.url);
19321941
transport_global_shutdown(&g.url);
1933
- db_multi_exec("DROP TABLE onremote");
1934
- manifest_crosslink_end(MC_PERMIT_HOOKS);
1935
- content_enable_dephantomize(1);
1936
- db_end_transaction(0);
1942
+ if( nErr && go==2 ){
1943
+ db_multi_exec("DROP TABLE onremote");
1944
+ manifest_crosslink_end(MC_PERMIT_HOOKS);
1945
+ content_enable_dephantomize(1);
1946
+ db_end_transaction(0);
1947
+ }
19371948
return nErr;
19381949
}
19391950
--- src/xfer.c
+++ src/xfer.c
@@ -1429,15 +1429,10 @@
1429 if( syncFlags & SYNC_PRIVATE ){
1430 g.perm.Private = 1;
1431 xfer.syncPrivate = 1;
1432 }
1433
1434 db_begin_transaction();
1435 db_record_repository_filename(0);
1436 db_multi_exec(
1437 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
1438 );
1439 blobarray_zero(xfer.aToken, count(xfer.aToken));
1440 blob_zero(&send);
1441 blob_zero(&recv);
1442 blob_zero(&xfer.err);
1443 blob_zero(&xfer.line);
@@ -1472,18 +1467,23 @@
1472 blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
1473 nCardSent++;
1474 if( (syncFlags & SYNC_PULL)==0 ) zOpType = "Push";
1475 if( (syncFlags & SYNC_RESYNC)!=0 ) xfer.resync = 0x7fffffff;
1476 }
1477 manifest_crosslink_begin();
1478 if( syncFlags & SYNC_VERBOSE ){
1479 fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
1480 }
1481
1482 while( go ){
1483 int newPhantom = 0;
1484 char *zRandomness;
 
 
 
 
 
 
1485
1486 /* Send make the most recently received cookie. Let the server
1487 ** figure out if this is a cookie that it cares about.
1488 */
1489 zCookie = db_get("cookie", 0);
@@ -1559,10 +1559,11 @@
1559 fflush(stdout);
1560 /* Exchange messages with the server */
1561 if( http_exchange(&send, &recv, (syncFlags & SYNC_CLONE)==0 || nCycle>0,
1562 MAX_REDIRECTS) ){
1563 nErr++;
 
1564 break;
1565 }
1566
1567 /* Output current stats */
1568 if( syncFlags & SYNC_VERBOSE ){
@@ -1910,10 +1911,18 @@
1910 ** we have gone at least two rounds. Always go at least two rounds
1911 ** on a clone in order to be sure to retrieve the configuration
1912 ** information which is only sent on the second round.
1913 */
1914 if( cloneSeqno<=0 && nCycle>1 ) go = 0;
 
 
 
 
 
 
 
 
1915 };
1916 transport_stats(&nSent, &nRcvd, 1);
1917 if( (rSkew*24.0*3600.0) > 10.0 ){
1918 fossil_warning("*** time skew *** server is fast by %s",
1919 db_timespan_name(rSkew));
@@ -1928,11 +1937,13 @@
1928 fossil_print(
1929 "%s finished with %lld bytes sent, %lld bytes received\n",
1930 zOpType, nSent, nRcvd);
1931 transport_close(&g.url);
1932 transport_global_shutdown(&g.url);
1933 db_multi_exec("DROP TABLE onremote");
1934 manifest_crosslink_end(MC_PERMIT_HOOKS);
1935 content_enable_dephantomize(1);
1936 db_end_transaction(0);
 
 
1937 return nErr;
1938 }
1939
--- src/xfer.c
+++ src/xfer.c
@@ -1429,15 +1429,10 @@
1429 if( syncFlags & SYNC_PRIVATE ){
1430 g.perm.Private = 1;
1431 xfer.syncPrivate = 1;
1432 }
1433
 
 
 
 
 
1434 blobarray_zero(xfer.aToken, count(xfer.aToken));
1435 blob_zero(&send);
1436 blob_zero(&recv);
1437 blob_zero(&xfer.err);
1438 blob_zero(&xfer.line);
@@ -1472,18 +1467,23 @@
1467 blob_appendf(&send, "push %s %s\n", zSCode, zPCode);
1468 nCardSent++;
1469 if( (syncFlags & SYNC_PULL)==0 ) zOpType = "Push";
1470 if( (syncFlags & SYNC_RESYNC)!=0 ) xfer.resync = 0x7fffffff;
1471 }
 
1472 if( syncFlags & SYNC_VERBOSE ){
1473 fossil_print(zLabelFormat, "", "Bytes", "Cards", "Artifacts", "Deltas");
1474 }
1475
1476 while( go ){
1477 int newPhantom = 0;
1478 char *zRandomness;
1479 db_begin_transaction();
1480 db_record_repository_filename(0);
1481 db_multi_exec(
1482 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
1483 );
1484 manifest_crosslink_begin();
1485
1486 /* Send make the most recently received cookie. Let the server
1487 ** figure out if this is a cookie that it cares about.
1488 */
1489 zCookie = db_get("cookie", 0);
@@ -1559,10 +1559,11 @@
1559 fflush(stdout);
1560 /* Exchange messages with the server */
1561 if( http_exchange(&send, &recv, (syncFlags & SYNC_CLONE)==0 || nCycle>0,
1562 MAX_REDIRECTS) ){
1563 nErr++;
1564 go = 2;
1565 break;
1566 }
1567
1568 /* Output current stats */
1569 if( syncFlags & SYNC_VERBOSE ){
@@ -1910,10 +1911,18 @@
1911 ** we have gone at least two rounds. Always go at least two rounds
1912 ** on a clone in order to be sure to retrieve the configuration
1913 ** information which is only sent on the second round.
1914 */
1915 if( cloneSeqno<=0 && nCycle>1 ) go = 0;
1916 db_multi_exec("DROP TABLE onremote");
1917 if( go ){
1918 manifest_crosslink_end(MC_PERMIT_HOOKS);
1919 }else{
1920 manifest_crosslink_end(MC_PERMIT_HOOKS);
1921 content_enable_dephantomize(1);
1922 }
1923 db_end_transaction(0);
1924 };
1925 transport_stats(&nSent, &nRcvd, 1);
1926 if( (rSkew*24.0*3600.0) > 10.0 ){
1927 fossil_warning("*** time skew *** server is fast by %s",
1928 db_timespan_name(rSkew));
@@ -1928,11 +1937,13 @@
1937 fossil_print(
1938 "%s finished with %lld bytes sent, %lld bytes received\n",
1939 zOpType, nSent, nRcvd);
1940 transport_close(&g.url);
1941 transport_global_shutdown(&g.url);
1942 if( nErr && go==2 ){
1943 db_multi_exec("DROP TABLE onremote");
1944 manifest_crosslink_end(MC_PERMIT_HOOKS);
1945 content_enable_dephantomize(1);
1946 db_end_transaction(0);
1947 }
1948 return nErr;
1949 }
1950
--- www/changes.wiki
+++ www/changes.wiki
@@ -51,10 +51,14 @@
5151
and "[/help?cmd=leaves|fossil leaves]" commands.
5252
* Enhance support for running as the root user. Now works on Haiku.
5353
* [/help?cmd=new|fossil new] no longer creates an initial empty commit by
5454
default. The first commit after checking out a new empty repository will
5555
become the initial commit.
56
+ * Enhance sync operations by committing each round-trip to minimize number
57
+ of retransmits when autosync fails. Include option for
58
+ [/help?cmd=update| fossil update] and [/help?cmd=merge| fossil merge] to
59
+ continue even if missing content.
5660
5761
<h2>Changes For Version 1.28 (2014-01-27)</h2>
5862
* Enhance [/help?cmd=/reports | /reports] to support event type filtering.
5963
* When cloning a repository, the user name passed via the URL (if any)
6064
is now used as the default local admin user's name.
6165
--- www/changes.wiki
+++ www/changes.wiki
@@ -51,10 +51,14 @@
51 and "[/help?cmd=leaves|fossil leaves]" commands.
52 * Enhance support for running as the root user. Now works on Haiku.
53 * [/help?cmd=new|fossil new] no longer creates an initial empty commit by
54 default. The first commit after checking out a new empty repository will
55 become the initial commit.
 
 
 
 
56
57 <h2>Changes For Version 1.28 (2014-01-27)</h2>
58 * Enhance [/help?cmd=/reports | /reports] to support event type filtering.
59 * When cloning a repository, the user name passed via the URL (if any)
60 is now used as the default local admin user's name.
61
--- www/changes.wiki
+++ www/changes.wiki
@@ -51,10 +51,14 @@
51 and "[/help?cmd=leaves|fossil leaves]" commands.
52 * Enhance support for running as the root user. Now works on Haiku.
53 * [/help?cmd=new|fossil new] no longer creates an initial empty commit by
54 default. The first commit after checking out a new empty repository will
55 become the initial commit.
56 * Enhance sync operations by committing each round-trip to minimize number
57 of retransmits when autosync fails. Include option for
58 [/help?cmd=update| fossil update] and [/help?cmd=merge| fossil merge] to
59 continue even if missing content.
60
61 <h2>Changes For Version 1.28 (2014-01-27)</h2>
62 * Enhance [/help?cmd=/reports | /reports] to support event type filtering.
63 * When cloning a repository, the user name passed via the URL (if any)
64 is now used as the default local admin user's name.
65
--- www/changes.wiki
+++ www/changes.wiki
@@ -51,10 +51,14 @@
5151
and "[/help?cmd=leaves|fossil leaves]" commands.
5252
* Enhance support for running as the root user. Now works on Haiku.
5353
* [/help?cmd=new|fossil new] no longer creates an initial empty commit by
5454
default. The first commit after checking out a new empty repository will
5555
become the initial commit.
56
+ * Enhance sync operations by committing each round-trip to minimize number
57
+ of retransmits when autosync fails. Include option for
58
+ [/help?cmd=update| fossil update] and [/help?cmd=merge| fossil merge] to
59
+ continue even if missing content.
5660
5761
<h2>Changes For Version 1.28 (2014-01-27)</h2>
5862
* Enhance [/help?cmd=/reports | /reports] to support event type filtering.
5963
* When cloning a repository, the user name passed via the URL (if any)
6064
is now used as the default local admin user's name.
6165
--- www/changes.wiki
+++ www/changes.wiki
@@ -51,10 +51,14 @@
51 and "[/help?cmd=leaves|fossil leaves]" commands.
52 * Enhance support for running as the root user. Now works on Haiku.
53 * [/help?cmd=new|fossil new] no longer creates an initial empty commit by
54 default. The first commit after checking out a new empty repository will
55 become the initial commit.
 
 
 
 
56
57 <h2>Changes For Version 1.28 (2014-01-27)</h2>
58 * Enhance [/help?cmd=/reports | /reports] to support event type filtering.
59 * When cloning a repository, the user name passed via the URL (if any)
60 is now used as the default local admin user's name.
61
--- www/changes.wiki
+++ www/changes.wiki
@@ -51,10 +51,14 @@
51 and "[/help?cmd=leaves|fossil leaves]" commands.
52 * Enhance support for running as the root user. Now works on Haiku.
53 * [/help?cmd=new|fossil new] no longer creates an initial empty commit by
54 default. The first commit after checking out a new empty repository will
55 become the initial commit.
56 * Enhance sync operations by committing each round-trip to minimize number
57 of retransmits when autosync fails. Include option for
58 [/help?cmd=update| fossil update] and [/help?cmd=merge| fossil merge] to
59 continue even if missing content.
60
61 <h2>Changes For Version 1.28 (2014-01-27)</h2>
62 * Enhance [/help?cmd=/reports | /reports] to support event type filtering.
63 * When cloning a repository, the user name passed via the URL (if any)
64 is now used as the default local admin user's name.
65

Keyboard Shortcuts

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