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.

drh 2021-07-06 13:46 trunk
Commit 22005dfcf13df25114f1cca5ff6e674f2f6248fd0a1f5e75ca0084c9e1a47578
1 file changed +15 -11
+15 -11
--- src/xfer.c
+++ src/xfer.c
@@ -1813,12 +1813,11 @@
18131813
#define SYNC_PULL 0x0002 /* pull content server to client */
18141814
#define SYNC_CLONE 0x0004 /* clone the repository */
18151815
#define SYNC_PRIVATE 0x0008 /* Also transfer private content */
18161816
#define SYNC_VERBOSE 0x0010 /* Extra diagnostics */
18171817
#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 */
18201819
#define SYNC_UNVERSIONED 0x0100 /* Sync unversioned content */
18211820
#define SYNC_UV_REVERT 0x0200 /* Copy server unversioned to client */
18221821
#define SYNC_UV_TRACE 0x0400 /* Describe UV activities */
18231822
#define SYNC_UV_DRYRUN 0x0800 /* Do not actually exchange files */
18241823
#define SYNC_IFABLE 0x1000 /* Inability to sync is not fatal */
@@ -1871,21 +1870,21 @@
18711870
int nArtifactRcvd = 0; /* Total artifacts received */
18721871
const char *zOpType = 0;/* Push, Pull, Sync, Clone */
18731872
double rSkew = 0.0; /* Maximum time skew */
18741873
int uvHashSent = 0; /* The "pragma uv-hash" message has been sent */
18751874
int uvDoPush = 0; /* Generate uvfile messages to send to server */
1875
+ int uvPullOnly = 0; /* 1: pull-only. 2: pull-only warning issued */
18761876
int nUvGimmeSent = 0; /* Number of uvgimme cards sent on this cycle */
18771877
int nUvFileRcvd = 0; /* Number of uvfile cards received on this cycle */
18781878
sqlite3_int64 mtime; /* Modification time on a UV file */
18791879
int autopushFailed = 0; /* Autopush following commit failed if true */
18801880
const char *zCkinLock; /* Name of check-in to lock. NULL for none */
18811881
const char *zClientId; /* A unique identifier for this check-out */
18821882
unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
18831883
18841884
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
18871886
&& configRcvMask==0 && configSendMask==0 ) return 0;
18881887
if( syncFlags & SYNC_FROMPARENT ){
18891888
configRcvMask = 0;
18901889
configSendMask = 0;
18911890
syncFlags &= ~(SYNC_PUSH);
@@ -2038,11 +2037,11 @@
20382037
20392038
/* Client sends a request to sync unversioned files.
20402039
** On a clone, delay sending this until the second cycle since
20412040
** the login card might fail on the first cycle.
20422041
*/
2043
- if( (syncFlags & (SYNC_UNVERSIONED|SYNC_UVPULL))!=0
2042
+ if( (syncFlags & SYNC_UNVERSIONED)!=0
20442043
&& ((syncFlags & SYNC_CLONE)==0 || nCycle>0)
20452044
&& !uvHashSent
20462045
){
20472046
blob_appendf(&send, "pragma uv-hash %s\n", unversioned_content_hash(0));
20482047
nCardSent++;
@@ -2358,11 +2357,19 @@
23582357
db_multi_exec(
23592358
"UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName
23602359
);
23612360
db_unset("uv-hash", 0);
23622361
}
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 ){
23642371
db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName);
23652372
}else if( iStatus==4 ){
23662373
db_multi_exec("UPDATE uv_tosend SET mtimeOnly=1 WHERE name=%Q",zName);
23672374
}else if( iStatus==5 ){
23682375
db_multi_exec("REPLACE INTO uv_tosend(name,mtimeOnly) VALUES(%Q,0)",
@@ -2487,24 +2494,21 @@
24872494
xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
24882495
}
24892496
}
24902497
24912498
/* pragma uv-pull-only
2499
+ ** pragma uv-push-ok
24922500
**
24932501
** If the server is unwill to accept new unversioned content (because
24942502
** this client lacks the necessary permissions) then it sends a
24952503
** "uv-pull-only" pragma so that the client will know not to waste
24962504
** bandwidth trying to upload unversioned content. If the server
24972505
** does accept new unversioned content, it sends "uv-push-ok".
24982506
*/
24992507
if( syncFlags & SYNC_UNVERSIONED ){
25002508
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;
25062510
if( syncFlags & SYNC_UV_REVERT ) uvDoPush = 1;
25072511
}else if( blob_eq(&xfer.aToken[1], "uv-push-ok") ){
25082512
uvDoPush = 1;
25092513
}
25102514
}
25112515
--- 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

Keyboard Shortcuts

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