Fossil SCM
Only issue the warning about unable to push UV content due to insufficient privilege if the client has new UV content that otherwise might push.
Commit
22005dfcf13df25114f1cca5ff6e674f2f6248fd0a1f5e75ca0084c9e1a47578
Parent
d015a269e63fe4c…
1 file changed
+15
-11
+15
-11
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1813,12 +1813,11 @@ | ||
| 1813 | 1813 | #define SYNC_PULL 0x0002 /* pull content server to client */ |
| 1814 | 1814 | #define SYNC_CLONE 0x0004 /* clone the repository */ |
| 1815 | 1815 | #define SYNC_PRIVATE 0x0008 /* Also transfer private content */ |
| 1816 | 1816 | #define SYNC_VERBOSE 0x0010 /* Extra diagnostics */ |
| 1817 | 1817 | #define SYNC_RESYNC 0x0020 /* --verily */ |
| 1818 | -#define SYNC_UVPULL 0x0040 /* Unversioned pull */ | |
| 1819 | -#define SYNC_FROMPARENT 0x0080 /* Pull from the parent project */ | |
| 1818 | +#define SYNC_FROMPARENT 0x0040 /* Pull from the parent project */ | |
| 1820 | 1819 | #define SYNC_UNVERSIONED 0x0100 /* Sync unversioned content */ |
| 1821 | 1820 | #define SYNC_UV_REVERT 0x0200 /* Copy server unversioned to client */ |
| 1822 | 1821 | #define SYNC_UV_TRACE 0x0400 /* Describe UV activities */ |
| 1823 | 1822 | #define SYNC_UV_DRYRUN 0x0800 /* Do not actually exchange files */ |
| 1824 | 1823 | #define SYNC_IFABLE 0x1000 /* Inability to sync is not fatal */ |
| @@ -1871,21 +1870,21 @@ | ||
| 1871 | 1870 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1872 | 1871 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1873 | 1872 | double rSkew = 0.0; /* Maximum time skew */ |
| 1874 | 1873 | int uvHashSent = 0; /* The "pragma uv-hash" message has been sent */ |
| 1875 | 1874 | int uvDoPush = 0; /* Generate uvfile messages to send to server */ |
| 1875 | + int uvPullOnly = 0; /* 1: pull-only. 2: pull-only warning issued */ | |
| 1876 | 1876 | int nUvGimmeSent = 0; /* Number of uvgimme cards sent on this cycle */ |
| 1877 | 1877 | int nUvFileRcvd = 0; /* Number of uvfile cards received on this cycle */ |
| 1878 | 1878 | sqlite3_int64 mtime; /* Modification time on a UV file */ |
| 1879 | 1879 | int autopushFailed = 0; /* Autopush following commit failed if true */ |
| 1880 | 1880 | const char *zCkinLock; /* Name of check-in to lock. NULL for none */ |
| 1881 | 1881 | const char *zClientId; /* A unique identifier for this check-out */ |
| 1882 | 1882 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 1883 | 1883 | |
| 1884 | 1884 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1885 | - if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE| | |
| 1886 | - SYNC_UNVERSIONED|SYNC_UVPULL))==0 | |
| 1885 | + if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 | |
| 1887 | 1886 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1888 | 1887 | if( syncFlags & SYNC_FROMPARENT ){ |
| 1889 | 1888 | configRcvMask = 0; |
| 1890 | 1889 | configSendMask = 0; |
| 1891 | 1890 | syncFlags &= ~(SYNC_PUSH); |
| @@ -2038,11 +2037,11 @@ | ||
| 2038 | 2037 | |
| 2039 | 2038 | /* Client sends a request to sync unversioned files. |
| 2040 | 2039 | ** On a clone, delay sending this until the second cycle since |
| 2041 | 2040 | ** the login card might fail on the first cycle. |
| 2042 | 2041 | */ |
| 2043 | - if( (syncFlags & (SYNC_UNVERSIONED|SYNC_UVPULL))!=0 | |
| 2042 | + if( (syncFlags & SYNC_UNVERSIONED)!=0 | |
| 2044 | 2043 | && ((syncFlags & SYNC_CLONE)==0 || nCycle>0) |
| 2045 | 2044 | && !uvHashSent |
| 2046 | 2045 | ){ |
| 2047 | 2046 | blob_appendf(&send, "pragma uv-hash %s\n", unversioned_content_hash(0)); |
| 2048 | 2047 | nCardSent++; |
| @@ -2358,11 +2357,19 @@ | ||
| 2358 | 2357 | db_multi_exec( |
| 2359 | 2358 | "UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName |
| 2360 | 2359 | ); |
| 2361 | 2360 | db_unset("uv-hash", 0); |
| 2362 | 2361 | } |
| 2363 | - if( iStatus<=3 ){ | |
| 2362 | + if( iStatus>=4 && uvPullOnly==1 ){ | |
| 2363 | + fossil_warning( | |
| 2364 | + "Warning: uv-pull-only \n" | |
| 2365 | + " Unable to push unversioned content because you lack\n" | |
| 2366 | + " sufficient permission on the server\n" | |
| 2367 | + ); | |
| 2368 | + uvPullOnly = 2; | |
| 2369 | + } | |
| 2370 | + if( iStatus<=3 || uvPullOnly ){ | |
| 2364 | 2371 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2365 | 2372 | }else if( iStatus==4 ){ |
| 2366 | 2373 | db_multi_exec("UPDATE uv_tosend SET mtimeOnly=1 WHERE name=%Q",zName); |
| 2367 | 2374 | }else if( iStatus==5 ){ |
| 2368 | 2375 | db_multi_exec("REPLACE INTO uv_tosend(name,mtimeOnly) VALUES(%Q,0)", |
| @@ -2487,24 +2494,21 @@ | ||
| 2487 | 2494 | xfer.remoteTime = atoi(blob_str(&xfer.aToken[4])); |
| 2488 | 2495 | } |
| 2489 | 2496 | } |
| 2490 | 2497 | |
| 2491 | 2498 | /* pragma uv-pull-only |
| 2499 | + ** pragma uv-push-ok | |
| 2492 | 2500 | ** |
| 2493 | 2501 | ** If the server is unwill to accept new unversioned content (because |
| 2494 | 2502 | ** this client lacks the necessary permissions) then it sends a |
| 2495 | 2503 | ** "uv-pull-only" pragma so that the client will know not to waste |
| 2496 | 2504 | ** bandwidth trying to upload unversioned content. If the server |
| 2497 | 2505 | ** does accept new unversioned content, it sends "uv-push-ok". |
| 2498 | 2506 | */ |
| 2499 | 2507 | if( syncFlags & SYNC_UNVERSIONED ){ |
| 2500 | 2508 | if( blob_eq(&xfer.aToken[1], "uv-pull-only") ){ |
| 2501 | - fossil_print( | |
| 2502 | - "Warning: uv-pull-only \n" | |
| 2503 | - " Unable to push unversioned content because you lack\n" | |
| 2504 | - " sufficient permission on the server\n" | |
| 2505 | - ); | |
| 2509 | + uvPullOnly = 1; | |
| 2506 | 2510 | if( syncFlags & SYNC_UV_REVERT ) uvDoPush = 1; |
| 2507 | 2511 | }else if( blob_eq(&xfer.aToken[1], "uv-push-ok") ){ |
| 2508 | 2512 | uvDoPush = 1; |
| 2509 | 2513 | } |
| 2510 | 2514 | } |
| 2511 | 2515 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1813,12 +1813,11 @@ | |
| 1813 | #define SYNC_PULL 0x0002 /* pull content server to client */ |
| 1814 | #define SYNC_CLONE 0x0004 /* clone the repository */ |
| 1815 | #define SYNC_PRIVATE 0x0008 /* Also transfer private content */ |
| 1816 | #define SYNC_VERBOSE 0x0010 /* Extra diagnostics */ |
| 1817 | #define SYNC_RESYNC 0x0020 /* --verily */ |
| 1818 | #define SYNC_UVPULL 0x0040 /* Unversioned pull */ |
| 1819 | #define SYNC_FROMPARENT 0x0080 /* Pull from the parent project */ |
| 1820 | #define SYNC_UNVERSIONED 0x0100 /* Sync unversioned content */ |
| 1821 | #define SYNC_UV_REVERT 0x0200 /* Copy server unversioned to client */ |
| 1822 | #define SYNC_UV_TRACE 0x0400 /* Describe UV activities */ |
| 1823 | #define SYNC_UV_DRYRUN 0x0800 /* Do not actually exchange files */ |
| 1824 | #define SYNC_IFABLE 0x1000 /* Inability to sync is not fatal */ |
| @@ -1871,21 +1870,21 @@ | |
| 1871 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1872 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1873 | double rSkew = 0.0; /* Maximum time skew */ |
| 1874 | int uvHashSent = 0; /* The "pragma uv-hash" message has been sent */ |
| 1875 | int uvDoPush = 0; /* Generate uvfile messages to send to server */ |
| 1876 | int nUvGimmeSent = 0; /* Number of uvgimme cards sent on this cycle */ |
| 1877 | int nUvFileRcvd = 0; /* Number of uvfile cards received on this cycle */ |
| 1878 | sqlite3_int64 mtime; /* Modification time on a UV file */ |
| 1879 | int autopushFailed = 0; /* Autopush following commit failed if true */ |
| 1880 | const char *zCkinLock; /* Name of check-in to lock. NULL for none */ |
| 1881 | const char *zClientId; /* A unique identifier for this check-out */ |
| 1882 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 1883 | |
| 1884 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1885 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE| |
| 1886 | SYNC_UNVERSIONED|SYNC_UVPULL))==0 |
| 1887 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1888 | if( syncFlags & SYNC_FROMPARENT ){ |
| 1889 | configRcvMask = 0; |
| 1890 | configSendMask = 0; |
| 1891 | syncFlags &= ~(SYNC_PUSH); |
| @@ -2038,11 +2037,11 @@ | |
| 2038 | |
| 2039 | /* Client sends a request to sync unversioned files. |
| 2040 | ** On a clone, delay sending this until the second cycle since |
| 2041 | ** the login card might fail on the first cycle. |
| 2042 | */ |
| 2043 | if( (syncFlags & (SYNC_UNVERSIONED|SYNC_UVPULL))!=0 |
| 2044 | && ((syncFlags & SYNC_CLONE)==0 || nCycle>0) |
| 2045 | && !uvHashSent |
| 2046 | ){ |
| 2047 | blob_appendf(&send, "pragma uv-hash %s\n", unversioned_content_hash(0)); |
| 2048 | nCardSent++; |
| @@ -2358,11 +2357,19 @@ | |
| 2358 | db_multi_exec( |
| 2359 | "UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName |
| 2360 | ); |
| 2361 | db_unset("uv-hash", 0); |
| 2362 | } |
| 2363 | if( iStatus<=3 ){ |
| 2364 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2365 | }else if( iStatus==4 ){ |
| 2366 | db_multi_exec("UPDATE uv_tosend SET mtimeOnly=1 WHERE name=%Q",zName); |
| 2367 | }else if( iStatus==5 ){ |
| 2368 | db_multi_exec("REPLACE INTO uv_tosend(name,mtimeOnly) VALUES(%Q,0)", |
| @@ -2487,24 +2494,21 @@ | |
| 2487 | xfer.remoteTime = atoi(blob_str(&xfer.aToken[4])); |
| 2488 | } |
| 2489 | } |
| 2490 | |
| 2491 | /* pragma uv-pull-only |
| 2492 | ** |
| 2493 | ** If the server is unwill to accept new unversioned content (because |
| 2494 | ** this client lacks the necessary permissions) then it sends a |
| 2495 | ** "uv-pull-only" pragma so that the client will know not to waste |
| 2496 | ** bandwidth trying to upload unversioned content. If the server |
| 2497 | ** does accept new unversioned content, it sends "uv-push-ok". |
| 2498 | */ |
| 2499 | if( syncFlags & SYNC_UNVERSIONED ){ |
| 2500 | if( blob_eq(&xfer.aToken[1], "uv-pull-only") ){ |
| 2501 | fossil_print( |
| 2502 | "Warning: uv-pull-only \n" |
| 2503 | " Unable to push unversioned content because you lack\n" |
| 2504 | " sufficient permission on the server\n" |
| 2505 | ); |
| 2506 | if( syncFlags & SYNC_UV_REVERT ) uvDoPush = 1; |
| 2507 | }else if( blob_eq(&xfer.aToken[1], "uv-push-ok") ){ |
| 2508 | uvDoPush = 1; |
| 2509 | } |
| 2510 | } |
| 2511 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1813,12 +1813,11 @@ | |
| 1813 | #define SYNC_PULL 0x0002 /* pull content server to client */ |
| 1814 | #define SYNC_CLONE 0x0004 /* clone the repository */ |
| 1815 | #define SYNC_PRIVATE 0x0008 /* Also transfer private content */ |
| 1816 | #define SYNC_VERBOSE 0x0010 /* Extra diagnostics */ |
| 1817 | #define SYNC_RESYNC 0x0020 /* --verily */ |
| 1818 | #define SYNC_FROMPARENT 0x0040 /* Pull from the parent project */ |
| 1819 | #define SYNC_UNVERSIONED 0x0100 /* Sync unversioned content */ |
| 1820 | #define SYNC_UV_REVERT 0x0200 /* Copy server unversioned to client */ |
| 1821 | #define SYNC_UV_TRACE 0x0400 /* Describe UV activities */ |
| 1822 | #define SYNC_UV_DRYRUN 0x0800 /* Do not actually exchange files */ |
| 1823 | #define SYNC_IFABLE 0x1000 /* Inability to sync is not fatal */ |
| @@ -1871,21 +1870,21 @@ | |
| 1870 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1871 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1872 | double rSkew = 0.0; /* Maximum time skew */ |
| 1873 | int uvHashSent = 0; /* The "pragma uv-hash" message has been sent */ |
| 1874 | int uvDoPush = 0; /* Generate uvfile messages to send to server */ |
| 1875 | int uvPullOnly = 0; /* 1: pull-only. 2: pull-only warning issued */ |
| 1876 | int nUvGimmeSent = 0; /* Number of uvgimme cards sent on this cycle */ |
| 1877 | int nUvFileRcvd = 0; /* Number of uvfile cards received on this cycle */ |
| 1878 | sqlite3_int64 mtime; /* Modification time on a UV file */ |
| 1879 | int autopushFailed = 0; /* Autopush following commit failed if true */ |
| 1880 | const char *zCkinLock; /* Name of check-in to lock. NULL for none */ |
| 1881 | const char *zClientId; /* A unique identifier for this check-out */ |
| 1882 | unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */ |
| 1883 | |
| 1884 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1885 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0 |
| 1886 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1887 | if( syncFlags & SYNC_FROMPARENT ){ |
| 1888 | configRcvMask = 0; |
| 1889 | configSendMask = 0; |
| 1890 | syncFlags &= ~(SYNC_PUSH); |
| @@ -2038,11 +2037,11 @@ | |
| 2037 | |
| 2038 | /* Client sends a request to sync unversioned files. |
| 2039 | ** On a clone, delay sending this until the second cycle since |
| 2040 | ** the login card might fail on the first cycle. |
| 2041 | */ |
| 2042 | if( (syncFlags & SYNC_UNVERSIONED)!=0 |
| 2043 | && ((syncFlags & SYNC_CLONE)==0 || nCycle>0) |
| 2044 | && !uvHashSent |
| 2045 | ){ |
| 2046 | blob_appendf(&send, "pragma uv-hash %s\n", unversioned_content_hash(0)); |
| 2047 | nCardSent++; |
| @@ -2358,11 +2357,19 @@ | |
| 2357 | db_multi_exec( |
| 2358 | "UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName |
| 2359 | ); |
| 2360 | db_unset("uv-hash", 0); |
| 2361 | } |
| 2362 | if( iStatus>=4 && uvPullOnly==1 ){ |
| 2363 | fossil_warning( |
| 2364 | "Warning: uv-pull-only \n" |
| 2365 | " Unable to push unversioned content because you lack\n" |
| 2366 | " sufficient permission on the server\n" |
| 2367 | ); |
| 2368 | uvPullOnly = 2; |
| 2369 | } |
| 2370 | if( iStatus<=3 || uvPullOnly ){ |
| 2371 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2372 | }else if( iStatus==4 ){ |
| 2373 | db_multi_exec("UPDATE uv_tosend SET mtimeOnly=1 WHERE name=%Q",zName); |
| 2374 | }else if( iStatus==5 ){ |
| 2375 | db_multi_exec("REPLACE INTO uv_tosend(name,mtimeOnly) VALUES(%Q,0)", |
| @@ -2487,24 +2494,21 @@ | |
| 2494 | xfer.remoteTime = atoi(blob_str(&xfer.aToken[4])); |
| 2495 | } |
| 2496 | } |
| 2497 | |
| 2498 | /* pragma uv-pull-only |
| 2499 | ** pragma uv-push-ok |
| 2500 | ** |
| 2501 | ** If the server is unwill to accept new unversioned content (because |
| 2502 | ** this client lacks the necessary permissions) then it sends a |
| 2503 | ** "uv-pull-only" pragma so that the client will know not to waste |
| 2504 | ** bandwidth trying to upload unversioned content. If the server |
| 2505 | ** does accept new unversioned content, it sends "uv-push-ok". |
| 2506 | */ |
| 2507 | if( syncFlags & SYNC_UNVERSIONED ){ |
| 2508 | if( blob_eq(&xfer.aToken[1], "uv-pull-only") ){ |
| 2509 | uvPullOnly = 1; |
| 2510 | if( syncFlags & SYNC_UV_REVERT ) uvDoPush = 1; |
| 2511 | }else if( blob_eq(&xfer.aToken[1], "uv-push-ok") ){ |
| 2512 | uvDoPush = 1; |
| 2513 | } |
| 2514 | } |
| 2515 |