Fossil SCM
Fix "fossil sync" so that it returns non-zero if the sync fails. Add the --ping and --quiet options to "fossil sync".
Commit
8fa8fe8e1d150fb8bbb556e8b832d25f8d2d826619a26f89df1e17ad11d23c76
Parent
b9ecacf4a1623ba…
5 files changed
+2
+31
-8
+2
-1
+16
-4
+15
-3
+2
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -330,10 +330,12 @@ | ||
| 330 | 330 | zCmd = "sync -autourl -R"; |
| 331 | 331 | collect_argument(&extra, "share-links",0); |
| 332 | 332 | collect_argument(&extra, "verbose","v"); |
| 333 | 333 | collect_argument(&extra, "unversioned","u"); |
| 334 | 334 | collect_argument(&extra, "all",0); |
| 335 | + collect_argument(&extra, "quiet","q"); | |
| 336 | + collect_argument(&extra, "ping",0); | |
| 335 | 337 | }else if( fossil_strcmp(zCmd, "test-integrity")==0 ){ |
| 336 | 338 | collect_argument(&extra, "db-only", "d"); |
| 337 | 339 | collect_argument(&extra, "parse", 0); |
| 338 | 340 | collect_argument(&extra, "quick", "q"); |
| 339 | 341 | zCmd = "test-integrity"; |
| 340 | 342 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -330,10 +330,12 @@ | |
| 330 | zCmd = "sync -autourl -R"; |
| 331 | collect_argument(&extra, "share-links",0); |
| 332 | collect_argument(&extra, "verbose","v"); |
| 333 | collect_argument(&extra, "unversioned","u"); |
| 334 | collect_argument(&extra, "all",0); |
| 335 | }else if( fossil_strcmp(zCmd, "test-integrity")==0 ){ |
| 336 | collect_argument(&extra, "db-only", "d"); |
| 337 | collect_argument(&extra, "parse", 0); |
| 338 | collect_argument(&extra, "quick", "q"); |
| 339 | zCmd = "test-integrity"; |
| 340 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -330,10 +330,12 @@ | |
| 330 | zCmd = "sync -autourl -R"; |
| 331 | collect_argument(&extra, "share-links",0); |
| 332 | collect_argument(&extra, "verbose","v"); |
| 333 | collect_argument(&extra, "unversioned","u"); |
| 334 | collect_argument(&extra, "all",0); |
| 335 | collect_argument(&extra, "quiet","q"); |
| 336 | collect_argument(&extra, "ping",0); |
| 337 | }else if( fossil_strcmp(zCmd, "test-integrity")==0 ){ |
| 338 | collect_argument(&extra, "db-only", "d"); |
| 339 | collect_argument(&extra, "parse", 0); |
| 340 | collect_argument(&extra, "quick", "q"); |
| 341 | zCmd = "test-integrity"; |
| 342 |
+31
-8
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -581,11 +581,13 @@ | ||
| 581 | 581 | } |
| 582 | 582 | if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){ |
| 583 | 583 | int ii; |
| 584 | 584 | for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} |
| 585 | 585 | while( zLine[ii]==' ' ) ii++; |
| 586 | - fossil_warning("server says: %s", &zLine[ii]); | |
| 586 | + if( (mHttpFlags & HTTP_QUIET)==0 ){ | |
| 587 | + fossil_warning("server says: %s", &zLine[ii]); | |
| 588 | + } | |
| 587 | 589 | goto write_err; |
| 588 | 590 | } |
| 589 | 591 | if( iHttpVersion==0 ){ |
| 590 | 592 | closeConnection = 1; |
| 591 | 593 | }else{ |
| @@ -616,11 +618,13 @@ | ||
| 616 | 618 | int i, j; |
| 617 | 619 | int wasHttps; |
| 618 | 620 | int priorUrlFlags; |
| 619 | 621 | |
| 620 | 622 | if ( --maxRedirect == 0){ |
| 621 | - fossil_warning("redirect limit exceeded"); | |
| 623 | + if( (mHttpFlags & HTTP_QUIET)==0 ){ | |
| 624 | + fossil_warning("redirect limit exceeded"); | |
| 625 | + } | |
| 622 | 626 | goto write_err; |
| 623 | 627 | } |
| 624 | 628 | for(i=9; zLine[i] && zLine[i]==' '; i++){} |
| 625 | 629 | if( zLine[i]==0 ){ |
| 626 | 630 | fossil_warning("malformed redirect: %s", zLine); |
| @@ -633,23 +637,29 @@ | ||
| 633 | 637 | } |
| 634 | 638 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 635 | 639 | fossil_print("redirect with status %d to %s\n", rc, &zLine[i]); |
| 636 | 640 | } |
| 637 | 641 | if( g.url.isFile || g.url.isSsh ){ |
| 638 | - fossil_warning("cannot redirect from %s to %s", g.url.canonical, | |
| 639 | - &zLine[i]); | |
| 642 | + if( (mHttpFlags & HTTP_QUIET)==0 ){ | |
| 643 | + fossil_warning("cannot redirect from %s to %s", g.url.canonical, | |
| 644 | + &zLine[i]); | |
| 645 | + } | |
| 640 | 646 | goto write_err; |
| 641 | 647 | } |
| 642 | 648 | wasHttps = g.url.isHttps; |
| 643 | 649 | priorUrlFlags = g.url.flags; |
| 644 | 650 | url_parse(&zLine[i], 0); |
| 645 | 651 | if( wasHttps && !g.url.isHttps ){ |
| 646 | - fossil_warning("cannot redirect from HTTPS to HTTP"); | |
| 652 | + if( (mHttpFlags & HTTP_QUIET)==0 ){ | |
| 653 | + fossil_warning("cannot redirect from HTTPS to HTTP"); | |
| 654 | + } | |
| 647 | 655 | goto write_err; |
| 648 | 656 | } |
| 649 | 657 | if( g.url.isSsh || g.url.isFile ){ |
| 650 | - fossil_warning("cannot redirect to %s", &zLine[i]); | |
| 658 | + if( (mHttpFlags & HTTP_QUIET)==0 ){ | |
| 659 | + fossil_warning("cannot redirect to %s", &zLine[i]); | |
| 660 | + } | |
| 651 | 661 | goto write_err; |
| 652 | 662 | } |
| 653 | 663 | transport_close(&g.url); |
| 654 | 664 | transport_global_shutdown(&g.url); |
| 655 | 665 | fSeenHttpAuth = 0; |
| @@ -704,20 +714,23 @@ | ||
| 704 | 714 | } |
| 705 | 715 | return rc; |
| 706 | 716 | }else{ |
| 707 | 717 | /* The problem could not be corrected by retrying. Report the |
| 708 | 718 | ** the error. */ |
| 709 | - if( g.url.isSsh && !g.fSshTrace ){ | |
| 719 | + if( mHttpFlags & HTTP_QUIET ){ | |
| 720 | + /* no-op */ | |
| 721 | + }else if( g.url.isSsh && !g.fSshTrace ){ | |
| 710 | 722 | fossil_warning("server did not reply: " |
| 711 | 723 | " rerun with --sshtrace for diagnostics"); |
| 712 | 724 | }else{ |
| 713 | 725 | fossil_warning("server did not reply"); |
| 714 | 726 | } |
| 715 | 727 | goto write_err; |
| 716 | 728 | } |
| 717 | 729 | } |
| 718 | 730 | if( rc!=200 ){ |
| 731 | + if( mHttpFlags & HTTP_QUIET ) goto write_err; | |
| 719 | 732 | fossil_warning("\"location:\" missing from %d redirect reply", rc); |
| 720 | 733 | goto write_err; |
| 721 | 734 | } |
| 722 | 735 | |
| 723 | 736 | /* |
| @@ -733,10 +746,11 @@ | ||
| 733 | 746 | iRecvLen = transport_receive(&g.url, blob_buffer(pReply), iLength); |
| 734 | 747 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 735 | 748 | fossil_print("Reply received: %d of %d bytes\n", iRecvLen, iLength); |
| 736 | 749 | } |
| 737 | 750 | if( iRecvLen != iLength ){ |
| 751 | + if( mHttpFlags & HTTP_QUIET ) goto write_err; | |
| 738 | 752 | fossil_warning("response truncated: got %d bytes of %d", |
| 739 | 753 | iRecvLen, iLength); |
| 740 | 754 | goto write_err; |
| 741 | 755 | } |
| 742 | 756 | }else if( closeConnection ){ |
| @@ -754,11 +768,13 @@ | ||
| 754 | 768 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 755 | 769 | fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior); |
| 756 | 770 | } |
| 757 | 771 | }else{ |
| 758 | 772 | assert( iLength<0 && !closeConnection ); |
| 773 | + if( mHttpFlags & HTTP_QUIET ) goto write_err; | |
| 759 | 774 | fossil_warning("\"content-length\" missing from %d keep-alive reply", rc); |
| 775 | + goto write_err; | |
| 760 | 776 | } |
| 761 | 777 | if( isError ){ |
| 762 | 778 | char *z; |
| 763 | 779 | int i, j; |
| 764 | 780 | z = blob_str(pReply); |
| @@ -768,11 +784,17 @@ | ||
| 768 | 784 | if( z[i]==0 ) break; |
| 769 | 785 | } |
| 770 | 786 | z[j] = z[i]; |
| 771 | 787 | } |
| 772 | 788 | z[j] = 0; |
| 773 | - fossil_warning("server sends error: %s", z); | |
| 789 | + if( mHttpFlags & HTTP_QUIET ){ | |
| 790 | + /* no-op */ | |
| 791 | + }else if( mHttpFlags & HTTP_VERBOSE ){ | |
| 792 | + fossil_warning("server sends error: %s", z); | |
| 793 | + }else{ | |
| 794 | + fossil_warning("server sends error"); | |
| 795 | + } | |
| 774 | 796 | goto write_err; |
| 775 | 797 | } |
| 776 | 798 | if( isCompressed ) blob_uncompress(pReply, pReply); |
| 777 | 799 | |
| 778 | 800 | /* |
| @@ -794,10 +816,11 @@ | ||
| 794 | 816 | |
| 795 | 817 | /* |
| 796 | 818 | ** Jump to here if an error is seen. |
| 797 | 819 | */ |
| 798 | 820 | write_err: |
| 821 | + g.iResultCode = 1; | |
| 799 | 822 | transport_close(&g.url); |
| 800 | 823 | return 1; |
| 801 | 824 | } |
| 802 | 825 | |
| 803 | 826 | /* |
| 804 | 827 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -581,11 +581,13 @@ | |
| 581 | } |
| 582 | if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){ |
| 583 | int ii; |
| 584 | for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} |
| 585 | while( zLine[ii]==' ' ) ii++; |
| 586 | fossil_warning("server says: %s", &zLine[ii]); |
| 587 | goto write_err; |
| 588 | } |
| 589 | if( iHttpVersion==0 ){ |
| 590 | closeConnection = 1; |
| 591 | }else{ |
| @@ -616,11 +618,13 @@ | |
| 616 | int i, j; |
| 617 | int wasHttps; |
| 618 | int priorUrlFlags; |
| 619 | |
| 620 | if ( --maxRedirect == 0){ |
| 621 | fossil_warning("redirect limit exceeded"); |
| 622 | goto write_err; |
| 623 | } |
| 624 | for(i=9; zLine[i] && zLine[i]==' '; i++){} |
| 625 | if( zLine[i]==0 ){ |
| 626 | fossil_warning("malformed redirect: %s", zLine); |
| @@ -633,23 +637,29 @@ | |
| 633 | } |
| 634 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 635 | fossil_print("redirect with status %d to %s\n", rc, &zLine[i]); |
| 636 | } |
| 637 | if( g.url.isFile || g.url.isSsh ){ |
| 638 | fossil_warning("cannot redirect from %s to %s", g.url.canonical, |
| 639 | &zLine[i]); |
| 640 | goto write_err; |
| 641 | } |
| 642 | wasHttps = g.url.isHttps; |
| 643 | priorUrlFlags = g.url.flags; |
| 644 | url_parse(&zLine[i], 0); |
| 645 | if( wasHttps && !g.url.isHttps ){ |
| 646 | fossil_warning("cannot redirect from HTTPS to HTTP"); |
| 647 | goto write_err; |
| 648 | } |
| 649 | if( g.url.isSsh || g.url.isFile ){ |
| 650 | fossil_warning("cannot redirect to %s", &zLine[i]); |
| 651 | goto write_err; |
| 652 | } |
| 653 | transport_close(&g.url); |
| 654 | transport_global_shutdown(&g.url); |
| 655 | fSeenHttpAuth = 0; |
| @@ -704,20 +714,23 @@ | |
| 704 | } |
| 705 | return rc; |
| 706 | }else{ |
| 707 | /* The problem could not be corrected by retrying. Report the |
| 708 | ** the error. */ |
| 709 | if( g.url.isSsh && !g.fSshTrace ){ |
| 710 | fossil_warning("server did not reply: " |
| 711 | " rerun with --sshtrace for diagnostics"); |
| 712 | }else{ |
| 713 | fossil_warning("server did not reply"); |
| 714 | } |
| 715 | goto write_err; |
| 716 | } |
| 717 | } |
| 718 | if( rc!=200 ){ |
| 719 | fossil_warning("\"location:\" missing from %d redirect reply", rc); |
| 720 | goto write_err; |
| 721 | } |
| 722 | |
| 723 | /* |
| @@ -733,10 +746,11 @@ | |
| 733 | iRecvLen = transport_receive(&g.url, blob_buffer(pReply), iLength); |
| 734 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 735 | fossil_print("Reply received: %d of %d bytes\n", iRecvLen, iLength); |
| 736 | } |
| 737 | if( iRecvLen != iLength ){ |
| 738 | fossil_warning("response truncated: got %d bytes of %d", |
| 739 | iRecvLen, iLength); |
| 740 | goto write_err; |
| 741 | } |
| 742 | }else if( closeConnection ){ |
| @@ -754,11 +768,13 @@ | |
| 754 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 755 | fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior); |
| 756 | } |
| 757 | }else{ |
| 758 | assert( iLength<0 && !closeConnection ); |
| 759 | fossil_warning("\"content-length\" missing from %d keep-alive reply", rc); |
| 760 | } |
| 761 | if( isError ){ |
| 762 | char *z; |
| 763 | int i, j; |
| 764 | z = blob_str(pReply); |
| @@ -768,11 +784,17 @@ | |
| 768 | if( z[i]==0 ) break; |
| 769 | } |
| 770 | z[j] = z[i]; |
| 771 | } |
| 772 | z[j] = 0; |
| 773 | fossil_warning("server sends error: %s", z); |
| 774 | goto write_err; |
| 775 | } |
| 776 | if( isCompressed ) blob_uncompress(pReply, pReply); |
| 777 | |
| 778 | /* |
| @@ -794,10 +816,11 @@ | |
| 794 | |
| 795 | /* |
| 796 | ** Jump to here if an error is seen. |
| 797 | */ |
| 798 | write_err: |
| 799 | transport_close(&g.url); |
| 800 | return 1; |
| 801 | } |
| 802 | |
| 803 | /* |
| 804 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -581,11 +581,13 @@ | |
| 581 | } |
| 582 | if( rc!=200 && rc!=301 && rc!=302 && rc!=307 && rc!=308 ){ |
| 583 | int ii; |
| 584 | for(ii=7; zLine[ii] && zLine[ii]!=' '; ii++){} |
| 585 | while( zLine[ii]==' ' ) ii++; |
| 586 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 587 | fossil_warning("server says: %s", &zLine[ii]); |
| 588 | } |
| 589 | goto write_err; |
| 590 | } |
| 591 | if( iHttpVersion==0 ){ |
| 592 | closeConnection = 1; |
| 593 | }else{ |
| @@ -616,11 +618,13 @@ | |
| 618 | int i, j; |
| 619 | int wasHttps; |
| 620 | int priorUrlFlags; |
| 621 | |
| 622 | if ( --maxRedirect == 0){ |
| 623 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 624 | fossil_warning("redirect limit exceeded"); |
| 625 | } |
| 626 | goto write_err; |
| 627 | } |
| 628 | for(i=9; zLine[i] && zLine[i]==' '; i++){} |
| 629 | if( zLine[i]==0 ){ |
| 630 | fossil_warning("malformed redirect: %s", zLine); |
| @@ -633,23 +637,29 @@ | |
| 637 | } |
| 638 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 639 | fossil_print("redirect with status %d to %s\n", rc, &zLine[i]); |
| 640 | } |
| 641 | if( g.url.isFile || g.url.isSsh ){ |
| 642 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 643 | fossil_warning("cannot redirect from %s to %s", g.url.canonical, |
| 644 | &zLine[i]); |
| 645 | } |
| 646 | goto write_err; |
| 647 | } |
| 648 | wasHttps = g.url.isHttps; |
| 649 | priorUrlFlags = g.url.flags; |
| 650 | url_parse(&zLine[i], 0); |
| 651 | if( wasHttps && !g.url.isHttps ){ |
| 652 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 653 | fossil_warning("cannot redirect from HTTPS to HTTP"); |
| 654 | } |
| 655 | goto write_err; |
| 656 | } |
| 657 | if( g.url.isSsh || g.url.isFile ){ |
| 658 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 659 | fossil_warning("cannot redirect to %s", &zLine[i]); |
| 660 | } |
| 661 | goto write_err; |
| 662 | } |
| 663 | transport_close(&g.url); |
| 664 | transport_global_shutdown(&g.url); |
| 665 | fSeenHttpAuth = 0; |
| @@ -704,20 +714,23 @@ | |
| 714 | } |
| 715 | return rc; |
| 716 | }else{ |
| 717 | /* The problem could not be corrected by retrying. Report the |
| 718 | ** the error. */ |
| 719 | if( mHttpFlags & HTTP_QUIET ){ |
| 720 | /* no-op */ |
| 721 | }else if( g.url.isSsh && !g.fSshTrace ){ |
| 722 | fossil_warning("server did not reply: " |
| 723 | " rerun with --sshtrace for diagnostics"); |
| 724 | }else{ |
| 725 | fossil_warning("server did not reply"); |
| 726 | } |
| 727 | goto write_err; |
| 728 | } |
| 729 | } |
| 730 | if( rc!=200 ){ |
| 731 | if( mHttpFlags & HTTP_QUIET ) goto write_err; |
| 732 | fossil_warning("\"location:\" missing from %d redirect reply", rc); |
| 733 | goto write_err; |
| 734 | } |
| 735 | |
| 736 | /* |
| @@ -733,10 +746,11 @@ | |
| 746 | iRecvLen = transport_receive(&g.url, blob_buffer(pReply), iLength); |
| 747 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 748 | fossil_print("Reply received: %d of %d bytes\n", iRecvLen, iLength); |
| 749 | } |
| 750 | if( iRecvLen != iLength ){ |
| 751 | if( mHttpFlags & HTTP_QUIET ) goto write_err; |
| 752 | fossil_warning("response truncated: got %d bytes of %d", |
| 753 | iRecvLen, iLength); |
| 754 | goto write_err; |
| 755 | } |
| 756 | }else if( closeConnection ){ |
| @@ -754,11 +768,13 @@ | |
| 768 | if( mHttpFlags & HTTP_VERBOSE ){ |
| 769 | fossil_print("Reply received: %u bytes (w/o content-length)\n", nPrior); |
| 770 | } |
| 771 | }else{ |
| 772 | assert( iLength<0 && !closeConnection ); |
| 773 | if( mHttpFlags & HTTP_QUIET ) goto write_err; |
| 774 | fossil_warning("\"content-length\" missing from %d keep-alive reply", rc); |
| 775 | goto write_err; |
| 776 | } |
| 777 | if( isError ){ |
| 778 | char *z; |
| 779 | int i, j; |
| 780 | z = blob_str(pReply); |
| @@ -768,11 +784,17 @@ | |
| 784 | if( z[i]==0 ) break; |
| 785 | } |
| 786 | z[j] = z[i]; |
| 787 | } |
| 788 | z[j] = 0; |
| 789 | if( mHttpFlags & HTTP_QUIET ){ |
| 790 | /* no-op */ |
| 791 | }else if( mHttpFlags & HTTP_VERBOSE ){ |
| 792 | fossil_warning("server sends error: %s", z); |
| 793 | }else{ |
| 794 | fossil_warning("server sends error"); |
| 795 | } |
| 796 | goto write_err; |
| 797 | } |
| 798 | if( isCompressed ) blob_uncompress(pReply, pReply); |
| 799 | |
| 800 | /* |
| @@ -794,10 +816,11 @@ | |
| 816 | |
| 817 | /* |
| 818 | ** Jump to here if an error is seen. |
| 819 | */ |
| 820 | write_err: |
| 821 | g.iResultCode = 1; |
| 822 | transport_close(&g.url); |
| 823 | return 1; |
| 824 | } |
| 825 | |
| 826 | /* |
| 827 |
+2
-1
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -153,10 +153,11 @@ | ||
| 153 | 153 | char *nameOfExe; /* Full path of executable. */ |
| 154 | 154 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 155 | 155 | const char *zPhase; /* Phase of operation, for use by the error log |
| 156 | 156 | ** and for deriving $canonical_page TH1 variable */ |
| 157 | 157 | int isConst; /* True if the output is unchanging & cacheable */ |
| 158 | + int iResultCode; /* Process reply code for commands */ | |
| 158 | 159 | const char *zVfsName; /* The VFS to use for database connections */ |
| 159 | 160 | sqlite3 *db; /* The connection to the databases */ |
| 160 | 161 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 161 | 162 | char *zAuxSchema; /* Main repository aux-schema */ |
| 162 | 163 | int dbIgnoreErrors; /* Ignore database errors if true */ |
| @@ -1016,11 +1017,11 @@ | ||
| 1016 | 1017 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1017 | 1018 | Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags); |
| 1018 | 1019 | } |
| 1019 | 1020 | } |
| 1020 | 1021 | #endif |
| 1021 | - fossil_exit(0); | |
| 1022 | + fossil_exit(g.iResultCode); | |
| 1022 | 1023 | /*NOT_REACHED*/ |
| 1023 | 1024 | return 0; |
| 1024 | 1025 | } |
| 1025 | 1026 | |
| 1026 | 1027 | /* |
| 1027 | 1028 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -153,10 +153,11 @@ | |
| 153 | char *nameOfExe; /* Full path of executable. */ |
| 154 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 155 | const char *zPhase; /* Phase of operation, for use by the error log |
| 156 | ** and for deriving $canonical_page TH1 variable */ |
| 157 | int isConst; /* True if the output is unchanging & cacheable */ |
| 158 | const char *zVfsName; /* The VFS to use for database connections */ |
| 159 | sqlite3 *db; /* The connection to the databases */ |
| 160 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 161 | char *zAuxSchema; /* Main repository aux-schema */ |
| 162 | int dbIgnoreErrors; /* Ignore database errors if true */ |
| @@ -1016,11 +1017,11 @@ | |
| 1016 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1017 | Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags); |
| 1018 | } |
| 1019 | } |
| 1020 | #endif |
| 1021 | fossil_exit(0); |
| 1022 | /*NOT_REACHED*/ |
| 1023 | return 0; |
| 1024 | } |
| 1025 | |
| 1026 | /* |
| 1027 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -153,10 +153,11 @@ | |
| 153 | char *nameOfExe; /* Full path of executable. */ |
| 154 | const char *zErrlog; /* Log errors to this file, if not NULL */ |
| 155 | const char *zPhase; /* Phase of operation, for use by the error log |
| 156 | ** and for deriving $canonical_page TH1 variable */ |
| 157 | int isConst; /* True if the output is unchanging & cacheable */ |
| 158 | int iResultCode; /* Process reply code for commands */ |
| 159 | const char *zVfsName; /* The VFS to use for database connections */ |
| 160 | sqlite3 *db; /* The connection to the databases */ |
| 161 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 162 | char *zAuxSchema; /* Main repository aux-schema */ |
| 163 | int dbIgnoreErrors; /* Ignore database errors if true */ |
| @@ -1016,11 +1017,11 @@ | |
| 1017 | if( !g.isHTTP && !g.fNoThHook && (rc==TH_OK || rc==TH_CONTINUE) ){ |
| 1018 | Th_CommandNotify(pCmd->zName, pCmd->eCmdFlags); |
| 1019 | } |
| 1020 | } |
| 1021 | #endif |
| 1022 | fossil_exit(g.iResultCode); |
| 1023 | /*NOT_REACHED*/ |
| 1024 | return 0; |
| 1025 | } |
| 1026 | |
| 1027 | /* |
| 1028 |
+16
-4
| --- src/sync.c | ||
| +++ src/sync.c | ||
| @@ -23,11 +23,11 @@ | ||
| 23 | 23 | |
| 24 | 24 | /* |
| 25 | 25 | ** Explain what type of sync operation is about to occur |
| 26 | 26 | */ |
| 27 | 27 | static void sync_explain(unsigned syncFlags){ |
| 28 | - if( g.url.isAlias ){ | |
| 28 | + if( g.url.isAlias && (syncFlags & SYNC_QUIET)==0 ){ | |
| 29 | 29 | const char *url; |
| 30 | 30 | if( g.url.useProxy ){ |
| 31 | 31 | url = g.url.proxyUrlCanonical; |
| 32 | 32 | }else{ |
| 33 | 33 | url = g.url.canonical; |
| @@ -36,10 +36,12 @@ | ||
| 36 | 36 | fossil_print("Sync with %s\n", url); |
| 37 | 37 | }else if( syncFlags & SYNC_PUSH ){ |
| 38 | 38 | fossil_print("Push to %s\n", url); |
| 39 | 39 | }else if( syncFlags & SYNC_PULL ){ |
| 40 | 40 | fossil_print("Pull from %s\n", url); |
| 41 | + }else if( syncFlags & SYNC_PING ){ | |
| 42 | + fossil_print("Ping %s\n", url); | |
| 41 | 43 | } |
| 42 | 44 | } |
| 43 | 45 | } |
| 44 | 46 | |
| 45 | 47 | |
| @@ -482,12 +484,14 @@ | ||
| 482 | 484 | ** -B|--httpauth USER:PASS Credentials for the simple HTTP auth protocol, |
| 483 | 485 | ** if required by the remote website |
| 484 | 486 | ** --ipv4 Use only IPv4, not IPv6 |
| 485 | 487 | ** --no-http-compression Do not compress HTTP traffic |
| 486 | 488 | ** --once Do not remember URL for subsequent syncs |
| 489 | +** --ping Just verify that the server is alive | |
| 487 | 490 | ** --proxy PROXY Use the specified HTTP proxy |
| 488 | 491 | ** --private Sync private branches too |
| 492 | +** -q|--quiet Omit all output | |
| 489 | 493 | ** -R|--repository REPO Local repository to sync with |
| 490 | 494 | ** --ssl-identity FILE Local SSL credentials, if requested by remote |
| 491 | 495 | ** --ssh-command SSH Use SSH as the "ssh" command |
| 492 | 496 | ** --transport-command CMD Use external command CMD to move message |
| 493 | 497 | ** between the client and the server |
| @@ -502,19 +506,27 @@ | ||
| 502 | 506 | void sync_cmd(void){ |
| 503 | 507 | unsigned configFlags = 0; |
| 504 | 508 | unsigned syncFlags = SYNC_PUSH|SYNC_PULL; |
| 505 | 509 | if( find_option("unversioned","u",0)!=0 ){ |
| 506 | 510 | syncFlags |= SYNC_UNVERSIONED; |
| 511 | + } | |
| 512 | + if( find_option("ping",0,0)!=0 ){ | |
| 513 | + syncFlags = SYNC_PING; | |
| 514 | + } | |
| 515 | + if( find_option("quiet","q",0)!=0 ){ | |
| 516 | + syncFlags |= SYNC_QUIET; | |
| 507 | 517 | } |
| 508 | 518 | process_sync_args(&configFlags, &syncFlags, 0, 0); |
| 509 | 519 | |
| 510 | 520 | /* We should be done with options.. */ |
| 511 | 521 | verify_all_options(); |
| 512 | 522 | |
| 513 | - if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH; | |
| 514 | - if( (syncFlags & SYNC_PUSH)==0 ){ | |
| 515 | - fossil_warning("pull only: the 'dont-push' option is set"); | |
| 523 | + if( (syncFlags & SYNC_PING)==0 ){ | |
| 524 | + if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH; | |
| 525 | + if( (syncFlags & SYNC_PUSH)==0 ){ | |
| 526 | + fossil_warning("pull only: the 'dont-push' option is set"); | |
| 527 | + } | |
| 516 | 528 | } |
| 517 | 529 | client_sync_all_urls(syncFlags, configFlags, 0, 0); |
| 518 | 530 | } |
| 519 | 531 | |
| 520 | 532 | /* |
| 521 | 533 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -23,11 +23,11 @@ | |
| 23 | |
| 24 | /* |
| 25 | ** Explain what type of sync operation is about to occur |
| 26 | */ |
| 27 | static void sync_explain(unsigned syncFlags){ |
| 28 | if( g.url.isAlias ){ |
| 29 | const char *url; |
| 30 | if( g.url.useProxy ){ |
| 31 | url = g.url.proxyUrlCanonical; |
| 32 | }else{ |
| 33 | url = g.url.canonical; |
| @@ -36,10 +36,12 @@ | |
| 36 | fossil_print("Sync with %s\n", url); |
| 37 | }else if( syncFlags & SYNC_PUSH ){ |
| 38 | fossil_print("Push to %s\n", url); |
| 39 | }else if( syncFlags & SYNC_PULL ){ |
| 40 | fossil_print("Pull from %s\n", url); |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | |
| @@ -482,12 +484,14 @@ | |
| 482 | ** -B|--httpauth USER:PASS Credentials for the simple HTTP auth protocol, |
| 483 | ** if required by the remote website |
| 484 | ** --ipv4 Use only IPv4, not IPv6 |
| 485 | ** --no-http-compression Do not compress HTTP traffic |
| 486 | ** --once Do not remember URL for subsequent syncs |
| 487 | ** --proxy PROXY Use the specified HTTP proxy |
| 488 | ** --private Sync private branches too |
| 489 | ** -R|--repository REPO Local repository to sync with |
| 490 | ** --ssl-identity FILE Local SSL credentials, if requested by remote |
| 491 | ** --ssh-command SSH Use SSH as the "ssh" command |
| 492 | ** --transport-command CMD Use external command CMD to move message |
| 493 | ** between the client and the server |
| @@ -502,19 +506,27 @@ | |
| 502 | void sync_cmd(void){ |
| 503 | unsigned configFlags = 0; |
| 504 | unsigned syncFlags = SYNC_PUSH|SYNC_PULL; |
| 505 | if( find_option("unversioned","u",0)!=0 ){ |
| 506 | syncFlags |= SYNC_UNVERSIONED; |
| 507 | } |
| 508 | process_sync_args(&configFlags, &syncFlags, 0, 0); |
| 509 | |
| 510 | /* We should be done with options.. */ |
| 511 | verify_all_options(); |
| 512 | |
| 513 | if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH; |
| 514 | if( (syncFlags & SYNC_PUSH)==0 ){ |
| 515 | fossil_warning("pull only: the 'dont-push' option is set"); |
| 516 | } |
| 517 | client_sync_all_urls(syncFlags, configFlags, 0, 0); |
| 518 | } |
| 519 | |
| 520 | /* |
| 521 |
| --- src/sync.c | |
| +++ src/sync.c | |
| @@ -23,11 +23,11 @@ | |
| 23 | |
| 24 | /* |
| 25 | ** Explain what type of sync operation is about to occur |
| 26 | */ |
| 27 | static void sync_explain(unsigned syncFlags){ |
| 28 | if( g.url.isAlias && (syncFlags & SYNC_QUIET)==0 ){ |
| 29 | const char *url; |
| 30 | if( g.url.useProxy ){ |
| 31 | url = g.url.proxyUrlCanonical; |
| 32 | }else{ |
| 33 | url = g.url.canonical; |
| @@ -36,10 +36,12 @@ | |
| 36 | fossil_print("Sync with %s\n", url); |
| 37 | }else if( syncFlags & SYNC_PUSH ){ |
| 38 | fossil_print("Push to %s\n", url); |
| 39 | }else if( syncFlags & SYNC_PULL ){ |
| 40 | fossil_print("Pull from %s\n", url); |
| 41 | }else if( syncFlags & SYNC_PING ){ |
| 42 | fossil_print("Ping %s\n", url); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | |
| @@ -482,12 +484,14 @@ | |
| 484 | ** -B|--httpauth USER:PASS Credentials for the simple HTTP auth protocol, |
| 485 | ** if required by the remote website |
| 486 | ** --ipv4 Use only IPv4, not IPv6 |
| 487 | ** --no-http-compression Do not compress HTTP traffic |
| 488 | ** --once Do not remember URL for subsequent syncs |
| 489 | ** --ping Just verify that the server is alive |
| 490 | ** --proxy PROXY Use the specified HTTP proxy |
| 491 | ** --private Sync private branches too |
| 492 | ** -q|--quiet Omit all output |
| 493 | ** -R|--repository REPO Local repository to sync with |
| 494 | ** --ssl-identity FILE Local SSL credentials, if requested by remote |
| 495 | ** --ssh-command SSH Use SSH as the "ssh" command |
| 496 | ** --transport-command CMD Use external command CMD to move message |
| 497 | ** between the client and the server |
| @@ -502,19 +506,27 @@ | |
| 506 | void sync_cmd(void){ |
| 507 | unsigned configFlags = 0; |
| 508 | unsigned syncFlags = SYNC_PUSH|SYNC_PULL; |
| 509 | if( find_option("unversioned","u",0)!=0 ){ |
| 510 | syncFlags |= SYNC_UNVERSIONED; |
| 511 | } |
| 512 | if( find_option("ping",0,0)!=0 ){ |
| 513 | syncFlags = SYNC_PING; |
| 514 | } |
| 515 | if( find_option("quiet","q",0)!=0 ){ |
| 516 | syncFlags |= SYNC_QUIET; |
| 517 | } |
| 518 | process_sync_args(&configFlags, &syncFlags, 0, 0); |
| 519 | |
| 520 | /* We should be done with options.. */ |
| 521 | verify_all_options(); |
| 522 | |
| 523 | if( (syncFlags & SYNC_PING)==0 ){ |
| 524 | if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH; |
| 525 | if( (syncFlags & SYNC_PUSH)==0 ){ |
| 526 | fossil_warning("pull only: the 'dont-push' option is set"); |
| 527 | } |
| 528 | } |
| 529 | client_sync_all_urls(syncFlags, configFlags, 0, 0); |
| 530 | } |
| 531 | |
| 532 | /* |
| 533 |
+15
-3
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -2049,10 +2049,12 @@ | ||
| 2049 | 2049 | #define SYNC_CKIN_LOCK 0x02000 /* Lock the current check-in */ |
| 2050 | 2050 | #define SYNC_NOHTTPCOMPRESS 0x04000 /* Do not compression HTTP messages */ |
| 2051 | 2051 | #define SYNC_ALLURL 0x08000 /* The --all flag - sync to all URLs */ |
| 2052 | 2052 | #define SYNC_SHARE_LINKS 0x10000 /* Request alternate repo links */ |
| 2053 | 2053 | #define SYNC_XVERBOSE 0x20000 /* Extra verbose. Network traffic */ |
| 2054 | +#define SYNC_PING 0x40000 /* Verify server is alive */ | |
| 2055 | +#define SYNC_QUIET 0x80000 /* No output */ | |
| 2054 | 2056 | #endif |
| 2055 | 2057 | |
| 2056 | 2058 | /* |
| 2057 | 2059 | ** Floating-point absolute value |
| 2058 | 2060 | */ |
| @@ -2115,11 +2117,12 @@ | ||
| 2115 | 2117 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 2116 | 2118 | const int bOutIsTty = fossil_isatty(fossil_fileno(stdout)); |
| 2117 | 2119 | |
| 2118 | 2120 | if( pnRcvd ) *pnRcvd = 0; |
| 2119 | 2121 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 2120 | - if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 | |
| 2122 | + if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED|SYNC_PING)) | |
| 2123 | + ==0 | |
| 2121 | 2124 | && configRcvMask==0 |
| 2122 | 2125 | && configSendMask==0 |
| 2123 | 2126 | ){ |
| 2124 | 2127 | return 0; /* Nothing to do */ |
| 2125 | 2128 | } |
| @@ -2410,10 +2413,13 @@ | ||
| 2410 | 2413 | mHttpFlags |= HTTP_NOCOMPRESS; |
| 2411 | 2414 | } |
| 2412 | 2415 | if( syncFlags & SYNC_XVERBOSE ){ |
| 2413 | 2416 | mHttpFlags |= HTTP_VERBOSE; |
| 2414 | 2417 | } |
| 2418 | + if( syncFlags & SYNC_QUIET ){ | |
| 2419 | + mHttpFlags |= HTTP_QUIET; | |
| 2420 | + } | |
| 2415 | 2421 | |
| 2416 | 2422 | /* Do the round-trip to the server */ |
| 2417 | 2423 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2418 | 2424 | nErr++; |
| 2419 | 2425 | go = 2; |
| @@ -2431,10 +2437,12 @@ | ||
| 2431 | 2437 | nArtifactSent += xfer.nFileSent + xfer.nDeltaSent; |
| 2432 | 2438 | if( syncFlags & SYNC_VERBOSE ){ |
| 2433 | 2439 | fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Sent:", |
| 2434 | 2440 | blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent, |
| 2435 | 2441 | xfer.nFileSent, xfer.nDeltaSent); |
| 2442 | + }else if( syncFlags & SYNC_QUIET ){ | |
| 2443 | + /* No-op */ | |
| 2436 | 2444 | }else{ |
| 2437 | 2445 | if( bOutIsTty!=0 ){ |
| 2438 | 2446 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 2439 | 2447 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 2440 | 2448 | } |
| @@ -2954,10 +2962,12 @@ | ||
| 2954 | 2962 | origConfigRcvMask = 0; |
| 2955 | 2963 | if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){ |
| 2956 | 2964 | fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:", |
| 2957 | 2965 | blob_size(&recv), nCardRcvd, |
| 2958 | 2966 | xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile); |
| 2967 | + }else if( syncFlags && SYNC_QUIET ){ | |
| 2968 | + /* No-op */ | |
| 2959 | 2969 | }else{ |
| 2960 | 2970 | if( bOutIsTty!=0 ){ |
| 2961 | 2971 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 2962 | 2972 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 2963 | 2973 | } |
| @@ -3016,18 +3026,20 @@ | ||
| 3016 | 3026 | }else if( rSkew*24.0*3600.0 < -10.0 ){ |
| 3017 | 3027 | fossil_warning("*** time skew *** server is slow by %s", |
| 3018 | 3028 | db_timespan_name(-rSkew)); |
| 3019 | 3029 | g.clockSkewSeen = 1; |
| 3020 | 3030 | } |
| 3021 | - if( bOutIsTty==0 ){ | |
| 3031 | + if( bOutIsTty==0 && (syncFlags & SYNC_QUIET)==0 ){ | |
| 3022 | 3032 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 3023 | 3033 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 3024 | 3034 | fossil_force_newline(); |
| 3025 | 3035 | } |
| 3026 | 3036 | fossil_force_newline(); |
| 3027 | 3037 | if( g.zHttpCmd==0 ){ |
| 3028 | - if( syncFlags & SYNC_VERBOSE ){ | |
| 3038 | + if( syncFlags & SYNC_QUIET ){ | |
| 3039 | + /* no-op */ | |
| 3040 | + }else if( syncFlags & SYNC_VERBOSE ){ | |
| 3029 | 3041 | fossil_print( |
| 3030 | 3042 | "%s done, wire bytes sent: %lld received: %lld remote: %s%s\n", |
| 3031 | 3043 | zOpType, nSent, nRcvd, |
| 3032 | 3044 | (g.url.name && g.url.name[0]!='\0') ? g.url.name : "", |
| 3033 | 3045 | (g.zIpAddr && g.zIpAddr[0]!='\0' |
| 3034 | 3046 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2049,10 +2049,12 @@ | |
| 2049 | #define SYNC_CKIN_LOCK 0x02000 /* Lock the current check-in */ |
| 2050 | #define SYNC_NOHTTPCOMPRESS 0x04000 /* Do not compression HTTP messages */ |
| 2051 | #define SYNC_ALLURL 0x08000 /* The --all flag - sync to all URLs */ |
| 2052 | #define SYNC_SHARE_LINKS 0x10000 /* Request alternate repo links */ |
| 2053 | #define SYNC_XVERBOSE 0x20000 /* Extra verbose. Network traffic */ |
| 2054 | #endif |
| 2055 | |
| 2056 | /* |
| 2057 | ** Floating-point absolute value |
| 2058 | */ |
| @@ -2115,11 +2117,12 @@ | |
| 2115 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 2116 | const int bOutIsTty = fossil_isatty(fossil_fileno(stdout)); |
| 2117 | |
| 2118 | if( pnRcvd ) *pnRcvd = 0; |
| 2119 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 2120 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 |
| 2121 | && configRcvMask==0 |
| 2122 | && configSendMask==0 |
| 2123 | ){ |
| 2124 | return 0; /* Nothing to do */ |
| 2125 | } |
| @@ -2410,10 +2413,13 @@ | |
| 2410 | mHttpFlags |= HTTP_NOCOMPRESS; |
| 2411 | } |
| 2412 | if( syncFlags & SYNC_XVERBOSE ){ |
| 2413 | mHttpFlags |= HTTP_VERBOSE; |
| 2414 | } |
| 2415 | |
| 2416 | /* Do the round-trip to the server */ |
| 2417 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2418 | nErr++; |
| 2419 | go = 2; |
| @@ -2431,10 +2437,12 @@ | |
| 2431 | nArtifactSent += xfer.nFileSent + xfer.nDeltaSent; |
| 2432 | if( syncFlags & SYNC_VERBOSE ){ |
| 2433 | fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Sent:", |
| 2434 | blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent, |
| 2435 | xfer.nFileSent, xfer.nDeltaSent); |
| 2436 | }else{ |
| 2437 | if( bOutIsTty!=0 ){ |
| 2438 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 2439 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 2440 | } |
| @@ -2954,10 +2962,12 @@ | |
| 2954 | origConfigRcvMask = 0; |
| 2955 | if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){ |
| 2956 | fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:", |
| 2957 | blob_size(&recv), nCardRcvd, |
| 2958 | xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile); |
| 2959 | }else{ |
| 2960 | if( bOutIsTty!=0 ){ |
| 2961 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 2962 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 2963 | } |
| @@ -3016,18 +3026,20 @@ | |
| 3016 | }else if( rSkew*24.0*3600.0 < -10.0 ){ |
| 3017 | fossil_warning("*** time skew *** server is slow by %s", |
| 3018 | db_timespan_name(-rSkew)); |
| 3019 | g.clockSkewSeen = 1; |
| 3020 | } |
| 3021 | if( bOutIsTty==0 ){ |
| 3022 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 3023 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 3024 | fossil_force_newline(); |
| 3025 | } |
| 3026 | fossil_force_newline(); |
| 3027 | if( g.zHttpCmd==0 ){ |
| 3028 | if( syncFlags & SYNC_VERBOSE ){ |
| 3029 | fossil_print( |
| 3030 | "%s done, wire bytes sent: %lld received: %lld remote: %s%s\n", |
| 3031 | zOpType, nSent, nRcvd, |
| 3032 | (g.url.name && g.url.name[0]!='\0') ? g.url.name : "", |
| 3033 | (g.zIpAddr && g.zIpAddr[0]!='\0' |
| 3034 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2049,10 +2049,12 @@ | |
| 2049 | #define SYNC_CKIN_LOCK 0x02000 /* Lock the current check-in */ |
| 2050 | #define SYNC_NOHTTPCOMPRESS 0x04000 /* Do not compression HTTP messages */ |
| 2051 | #define SYNC_ALLURL 0x08000 /* The --all flag - sync to all URLs */ |
| 2052 | #define SYNC_SHARE_LINKS 0x10000 /* Request alternate repo links */ |
| 2053 | #define SYNC_XVERBOSE 0x20000 /* Extra verbose. Network traffic */ |
| 2054 | #define SYNC_PING 0x40000 /* Verify server is alive */ |
| 2055 | #define SYNC_QUIET 0x80000 /* No output */ |
| 2056 | #endif |
| 2057 | |
| 2058 | /* |
| 2059 | ** Floating-point absolute value |
| 2060 | */ |
| @@ -2115,11 +2117,12 @@ | |
| 2117 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 2118 | const int bOutIsTty = fossil_isatty(fossil_fileno(stdout)); |
| 2119 | |
| 2120 | if( pnRcvd ) *pnRcvd = 0; |
| 2121 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 2122 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED|SYNC_PING)) |
| 2123 | ==0 |
| 2124 | && configRcvMask==0 |
| 2125 | && configSendMask==0 |
| 2126 | ){ |
| 2127 | return 0; /* Nothing to do */ |
| 2128 | } |
| @@ -2410,10 +2413,13 @@ | |
| 2413 | mHttpFlags |= HTTP_NOCOMPRESS; |
| 2414 | } |
| 2415 | if( syncFlags & SYNC_XVERBOSE ){ |
| 2416 | mHttpFlags |= HTTP_VERBOSE; |
| 2417 | } |
| 2418 | if( syncFlags & SYNC_QUIET ){ |
| 2419 | mHttpFlags |= HTTP_QUIET; |
| 2420 | } |
| 2421 | |
| 2422 | /* Do the round-trip to the server */ |
| 2423 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2424 | nErr++; |
| 2425 | go = 2; |
| @@ -2431,10 +2437,12 @@ | |
| 2437 | nArtifactSent += xfer.nFileSent + xfer.nDeltaSent; |
| 2438 | if( syncFlags & SYNC_VERBOSE ){ |
| 2439 | fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Sent:", |
| 2440 | blob_size(&send), nCardSent+xfer.nGimmeSent+xfer.nIGotSent, |
| 2441 | xfer.nFileSent, xfer.nDeltaSent); |
| 2442 | }else if( syncFlags & SYNC_QUIET ){ |
| 2443 | /* No-op */ |
| 2444 | }else{ |
| 2445 | if( bOutIsTty!=0 ){ |
| 2446 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 2447 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 2448 | } |
| @@ -2954,10 +2962,12 @@ | |
| 2962 | origConfigRcvMask = 0; |
| 2963 | if( nCardRcvd>0 && (syncFlags & SYNC_VERBOSE) ){ |
| 2964 | fossil_print(zValueFormat /*works-like:"%s%d%d%d%d"*/, "Received:", |
| 2965 | blob_size(&recv), nCardRcvd, |
| 2966 | xfer.nFileRcvd, xfer.nDeltaRcvd + xfer.nDanglingFile); |
| 2967 | }else if( syncFlags && SYNC_QUIET ){ |
| 2968 | /* No-op */ |
| 2969 | }else{ |
| 2970 | if( bOutIsTty!=0 ){ |
| 2971 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 2972 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 2973 | } |
| @@ -3016,18 +3026,20 @@ | |
| 3026 | }else if( rSkew*24.0*3600.0 < -10.0 ){ |
| 3027 | fossil_warning("*** time skew *** server is slow by %s", |
| 3028 | db_timespan_name(-rSkew)); |
| 3029 | g.clockSkewSeen = 1; |
| 3030 | } |
| 3031 | if( bOutIsTty==0 && (syncFlags & SYNC_QUIET)==0 ){ |
| 3032 | fossil_print(zBriefFormat /*works-like:"%d%d%d"*/, |
| 3033 | nRoundtrip, nArtifactSent, nArtifactRcvd); |
| 3034 | fossil_force_newline(); |
| 3035 | } |
| 3036 | fossil_force_newline(); |
| 3037 | if( g.zHttpCmd==0 ){ |
| 3038 | if( syncFlags & SYNC_QUIET ){ |
| 3039 | /* no-op */ |
| 3040 | }else if( syncFlags & SYNC_VERBOSE ){ |
| 3041 | fossil_print( |
| 3042 | "%s done, wire bytes sent: %lld received: %lld remote: %s%s\n", |
| 3043 | zOpType, nSent, nRcvd, |
| 3044 | (g.url.name && g.url.name[0]!='\0') ? g.url.name : "", |
| 3045 | (g.zIpAddr && g.zIpAddr[0]!='\0' |
| 3046 |