Fossil SCM
Fixes to the sync algorithm.
Commit
0c102d06c3ba37128c3965acb718e086e7d462ff
Parent
8df950d14af2326…
1 file changed
+17
+17
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -445,10 +445,24 @@ | ||
| 445 | 445 | db_finalize(&q); |
| 446 | 446 | } |
| 447 | 447 | if( isPull ){ |
| 448 | 448 | send_all_pending(0); |
| 449 | 449 | } |
| 450 | + if( isPush || isPull ){ | |
| 451 | + /* Always send our leaves */ | |
| 452 | + Stmt q; | |
| 453 | + db_prepare(&q, | |
| 454 | + "SELECT uuid FROM blob WHERE rid IN" | |
| 455 | + " (SELECT cid FROM plink EXCEPT SELECT pid FROM plink)" | |
| 456 | + ); | |
| 457 | + while( db_step(&q)==SQLITE_ROW ){ | |
| 458 | + const char *zUuid = db_column_text(&q, 0); | |
| 459 | + @ leaf %s(zUuid) | |
| 460 | + } | |
| 461 | + db_finalize(&q); | |
| 462 | + } | |
| 463 | + | |
| 450 | 464 | db_end_transaction(0); |
| 451 | 465 | } |
| 452 | 466 | |
| 453 | 467 | /* |
| 454 | 468 | ** COMMAND: test-xfer |
| @@ -498,10 +512,11 @@ | ||
| 498 | 512 | const char *zSCode = db_get("server-code", "x"); |
| 499 | 513 | const char *zPCode = db_get("project-code", 0); |
| 500 | 514 | int nFile = 0; |
| 501 | 515 | int nMsg = 0; |
| 502 | 516 | int nReq = 0; |
| 517 | + int nFileSend; | |
| 503 | 518 | Blob send; /* Text we are sending to the server */ |
| 504 | 519 | Blob recv; /* Reply we got back from the server */ |
| 505 | 520 | Blob line; /* A single line of the reply */ |
| 506 | 521 | Blob aToken[5]; /* A tokenization of line */ |
| 507 | 522 | Blob errmsg; /* Error message */ |
| @@ -578,10 +593,11 @@ | ||
| 578 | 593 | } |
| 579 | 594 | |
| 580 | 595 | /* Exchange messages with the server */ |
| 581 | 596 | printf("Send: %d files, %d requests, %d other messages\n", |
| 582 | 597 | nFile, nReq, nMsg); |
| 598 | + nFileSend = nFile; | |
| 583 | 599 | nFile = nReq = nMsg = 0; |
| 584 | 600 | http_exchange(&send, &recv); |
| 585 | 601 | blob_reset(&send); |
| 586 | 602 | |
| 587 | 603 | /* Process the reply that came back from the server */ |
| @@ -688,14 +704,15 @@ | ||
| 688 | 704 | blobarray_reset(aToken, nToken); |
| 689 | 705 | } |
| 690 | 706 | blob_reset(&recv); |
| 691 | 707 | printf("Received: %d files, %d requests, %d other messages\n", |
| 692 | 708 | nFile, nReq, nMsg); |
| 709 | + if( nFileSend + nFile==0 ){ go = 0; } | |
| 693 | 710 | nFile = nReq = nMsg = 0; |
| 694 | 711 | }; |
| 695 | 712 | http_close(); |
| 696 | 713 | db_end_transaction(0); |
| 697 | 714 | db_multi_exec( |
| 698 | 715 | "DROP TABLE onremote;" |
| 699 | 716 | "DROP TABLE pending;" |
| 700 | 717 | ); |
| 701 | 718 | } |
| 702 | 719 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -445,10 +445,24 @@ | |
| 445 | db_finalize(&q); |
| 446 | } |
| 447 | if( isPull ){ |
| 448 | send_all_pending(0); |
| 449 | } |
| 450 | db_end_transaction(0); |
| 451 | } |
| 452 | |
| 453 | /* |
| 454 | ** COMMAND: test-xfer |
| @@ -498,10 +512,11 @@ | |
| 498 | const char *zSCode = db_get("server-code", "x"); |
| 499 | const char *zPCode = db_get("project-code", 0); |
| 500 | int nFile = 0; |
| 501 | int nMsg = 0; |
| 502 | int nReq = 0; |
| 503 | Blob send; /* Text we are sending to the server */ |
| 504 | Blob recv; /* Reply we got back from the server */ |
| 505 | Blob line; /* A single line of the reply */ |
| 506 | Blob aToken[5]; /* A tokenization of line */ |
| 507 | Blob errmsg; /* Error message */ |
| @@ -578,10 +593,11 @@ | |
| 578 | } |
| 579 | |
| 580 | /* Exchange messages with the server */ |
| 581 | printf("Send: %d files, %d requests, %d other messages\n", |
| 582 | nFile, nReq, nMsg); |
| 583 | nFile = nReq = nMsg = 0; |
| 584 | http_exchange(&send, &recv); |
| 585 | blob_reset(&send); |
| 586 | |
| 587 | /* Process the reply that came back from the server */ |
| @@ -688,14 +704,15 @@ | |
| 688 | blobarray_reset(aToken, nToken); |
| 689 | } |
| 690 | blob_reset(&recv); |
| 691 | printf("Received: %d files, %d requests, %d other messages\n", |
| 692 | nFile, nReq, nMsg); |
| 693 | nFile = nReq = nMsg = 0; |
| 694 | }; |
| 695 | http_close(); |
| 696 | db_end_transaction(0); |
| 697 | db_multi_exec( |
| 698 | "DROP TABLE onremote;" |
| 699 | "DROP TABLE pending;" |
| 700 | ); |
| 701 | } |
| 702 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -445,10 +445,24 @@ | |
| 445 | db_finalize(&q); |
| 446 | } |
| 447 | if( isPull ){ |
| 448 | send_all_pending(0); |
| 449 | } |
| 450 | if( isPush || isPull ){ |
| 451 | /* Always send our leaves */ |
| 452 | Stmt q; |
| 453 | db_prepare(&q, |
| 454 | "SELECT uuid FROM blob WHERE rid IN" |
| 455 | " (SELECT cid FROM plink EXCEPT SELECT pid FROM plink)" |
| 456 | ); |
| 457 | while( db_step(&q)==SQLITE_ROW ){ |
| 458 | const char *zUuid = db_column_text(&q, 0); |
| 459 | @ leaf %s(zUuid) |
| 460 | } |
| 461 | db_finalize(&q); |
| 462 | } |
| 463 | |
| 464 | db_end_transaction(0); |
| 465 | } |
| 466 | |
| 467 | /* |
| 468 | ** COMMAND: test-xfer |
| @@ -498,10 +512,11 @@ | |
| 512 | const char *zSCode = db_get("server-code", "x"); |
| 513 | const char *zPCode = db_get("project-code", 0); |
| 514 | int nFile = 0; |
| 515 | int nMsg = 0; |
| 516 | int nReq = 0; |
| 517 | int nFileSend; |
| 518 | Blob send; /* Text we are sending to the server */ |
| 519 | Blob recv; /* Reply we got back from the server */ |
| 520 | Blob line; /* A single line of the reply */ |
| 521 | Blob aToken[5]; /* A tokenization of line */ |
| 522 | Blob errmsg; /* Error message */ |
| @@ -578,10 +593,11 @@ | |
| 593 | } |
| 594 | |
| 595 | /* Exchange messages with the server */ |
| 596 | printf("Send: %d files, %d requests, %d other messages\n", |
| 597 | nFile, nReq, nMsg); |
| 598 | nFileSend = nFile; |
| 599 | nFile = nReq = nMsg = 0; |
| 600 | http_exchange(&send, &recv); |
| 601 | blob_reset(&send); |
| 602 | |
| 603 | /* Process the reply that came back from the server */ |
| @@ -688,14 +704,15 @@ | |
| 704 | blobarray_reset(aToken, nToken); |
| 705 | } |
| 706 | blob_reset(&recv); |
| 707 | printf("Received: %d files, %d requests, %d other messages\n", |
| 708 | nFile, nReq, nMsg); |
| 709 | if( nFileSend + nFile==0 ){ go = 0; } |
| 710 | nFile = nReq = nMsg = 0; |
| 711 | }; |
| 712 | http_close(); |
| 713 | db_end_transaction(0); |
| 714 | db_multi_exec( |
| 715 | "DROP TABLE onremote;" |
| 716 | "DROP TABLE pending;" |
| 717 | ); |
| 718 | } |
| 719 |