Fossil SCM

Fix the server-side sync operation so that it will not generate a delta loop when a file changes from its original state through two or more intermediate states and back to its original state and all versions of the file attempt to sync in a single transaction.

drh 2012-11-17 19:16 UTC trunk merge
Commit e5b8eb12352f11fb0082c46818e25eaa7a674f13
1 file changed +9 -9
+9 -9
--- src/xfer.c
+++ src/xfer.c
@@ -273,19 +273,15 @@
273273
Blob *pUuid /* The UUID of the file to send */
274274
){
275275
static const char *const azQuery[] = {
276276
"SELECT pid FROM plink x"
277277
" WHERE cid=%d"
278
- " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
279
- " AND NOT EXISTS(SELECT 1 FROM plink y"
280
- " WHERE y.pid=x.cid AND y.cid=x.pid)",
281
-
282
- "SELECT pid FROM mlink x"
278
+ " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)",
279
+
280
+ "SELECT pid, min(mtime) FROM mlink, event ON mlink.mid=event.objid"
283281
" WHERE fid=%d"
284282
" AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
285
- " AND NOT EXISTS(SELECT 1 FROM mlink y"
286
- " WHERE y.pid=x.fid AND y.fid=x.pid)"
287283
};
288284
int i;
289285
Blob src, delta;
290286
int size = 0;
291287
int srcId = 0;
@@ -303,11 +299,11 @@
303299
if( size>=blob_size(pContent)-50 ){
304300
size = 0;
305301
}else if( uuid_is_shunned(zUuid) ){
306302
size = 0;
307303
}else{
308
- if( isPrivate ) blob_append(pXfer->pOut, "private\n", -1);
304
+ if( isPrivate ) blob_append(pXfer->pOut, "private\n", -1);
309305
blob_appendf(pXfer->pOut, "file %b %s %d\n", pUuid, zUuid, size);
310306
blob_append(pXfer->pOut, blob_buffer(&delta), size);
311307
}
312308
blob_reset(&delta);
313309
free(zUuid);
@@ -1659,11 +1655,15 @@
16591655
** to the next cycle.
16601656
*/
16611657
if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
16621658
char *zMsg = blob_terminate(&xfer.aToken[1]);
16631659
defossilize(zMsg);
1664
- if( zMsg ) fossil_print("\rServer says: %s\n", zMsg);
1660
+ if( pushFlag && zMsg && strglob("pull only *", zMsg) ){
1661
+ pushFlag = 0;
1662
+ zMsg = 0;
1663
+ }
1664
+ fossil_print("\rServer says: %s\n", zMsg);
16651665
}else
16661666
16671667
/* pragma NAME VALUE...
16681668
**
16691669
** The server can send pragmas to try to convey meta-information to
16701670
--- src/xfer.c
+++ src/xfer.c
@@ -273,19 +273,15 @@
273 Blob *pUuid /* The UUID of the file to send */
274 ){
275 static const char *const azQuery[] = {
276 "SELECT pid FROM plink x"
277 " WHERE cid=%d"
278 " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
279 " AND NOT EXISTS(SELECT 1 FROM plink y"
280 " WHERE y.pid=x.cid AND y.cid=x.pid)",
281
282 "SELECT pid FROM mlink x"
283 " WHERE fid=%d"
284 " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
285 " AND NOT EXISTS(SELECT 1 FROM mlink y"
286 " WHERE y.pid=x.fid AND y.fid=x.pid)"
287 };
288 int i;
289 Blob src, delta;
290 int size = 0;
291 int srcId = 0;
@@ -303,11 +299,11 @@
303 if( size>=blob_size(pContent)-50 ){
304 size = 0;
305 }else if( uuid_is_shunned(zUuid) ){
306 size = 0;
307 }else{
308 if( isPrivate ) blob_append(pXfer->pOut, "private\n", -1);
309 blob_appendf(pXfer->pOut, "file %b %s %d\n", pUuid, zUuid, size);
310 blob_append(pXfer->pOut, blob_buffer(&delta), size);
311 }
312 blob_reset(&delta);
313 free(zUuid);
@@ -1659,11 +1655,15 @@
1659 ** to the next cycle.
1660 */
1661 if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
1662 char *zMsg = blob_terminate(&xfer.aToken[1]);
1663 defossilize(zMsg);
1664 if( zMsg ) fossil_print("\rServer says: %s\n", zMsg);
 
 
 
 
1665 }else
1666
1667 /* pragma NAME VALUE...
1668 **
1669 ** The server can send pragmas to try to convey meta-information to
1670
--- src/xfer.c
+++ src/xfer.c
@@ -273,19 +273,15 @@
273 Blob *pUuid /* The UUID of the file to send */
274 ){
275 static const char *const azQuery[] = {
276 "SELECT pid FROM plink x"
277 " WHERE cid=%d"
278 " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)",
279
280 "SELECT pid, min(mtime) FROM mlink, event ON mlink.mid=event.objid"
 
 
281 " WHERE fid=%d"
282 " AND NOT EXISTS(SELECT 1 FROM phantom WHERE rid=pid)"
 
 
283 };
284 int i;
285 Blob src, delta;
286 int size = 0;
287 int srcId = 0;
@@ -303,11 +299,11 @@
299 if( size>=blob_size(pContent)-50 ){
300 size = 0;
301 }else if( uuid_is_shunned(zUuid) ){
302 size = 0;
303 }else{
304 if( isPrivate ) blob_append(pXfer->pOut, "private\n", -1);
305 blob_appendf(pXfer->pOut, "file %b %s %d\n", pUuid, zUuid, size);
306 blob_append(pXfer->pOut, blob_buffer(&delta), size);
307 }
308 blob_reset(&delta);
309 free(zUuid);
@@ -1659,11 +1655,15 @@
1655 ** to the next cycle.
1656 */
1657 if( blob_eq(&xfer.aToken[0],"message") && xfer.nToken==2 ){
1658 char *zMsg = blob_terminate(&xfer.aToken[1]);
1659 defossilize(zMsg);
1660 if( pushFlag && zMsg && strglob("pull only *", zMsg) ){
1661 pushFlag = 0;
1662 zMsg = 0;
1663 }
1664 fossil_print("\rServer says: %s\n", zMsg);
1665 }else
1666
1667 /* pragma NAME VALUE...
1668 **
1669 ** The server can send pragmas to try to convey meta-information to
1670

Keyboard Shortcuts

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