Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | 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. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
22005dfcf13df25114f1cca5ff6e674f |
| User & Date: | drh 2021-07-06 13:46:40.017 |
Context
|
2021-07-06
| ||
| 15:46 | Enhance the blob_eq() macro to help ensure that its second argument is a string literal, not a pointer. check-in: d6477def97 user: drh tags: trunk | |
| 13:46 | 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. check-in: 22005dfcf1 user: drh tags: trunk | |
| 13:15 | Fix an inefficiency in uv-sync in which the uv-catalog is always sent even if the uv-hash matches. Also add preliminary change to support uv-push. check-in: d015a269e6 user: drh tags: trunk | |
Changes
Changes to src/xfer.c.
| ︙ | ︙ | |||
1811 1812 1813 1814 1815 1816 1817 | */ #define SYNC_PUSH 0x0001 /* push content client to server */ #define SYNC_PULL 0x0002 /* pull content server to client */ #define SYNC_CLONE 0x0004 /* clone the repository */ #define SYNC_PRIVATE 0x0008 /* Also transfer private content */ #define SYNC_VERBOSE 0x0010 /* Extra diagnostics */ #define SYNC_RESYNC 0x0020 /* --verily */ | < | | 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 | */ #define SYNC_PUSH 0x0001 /* push content client to server */ #define SYNC_PULL 0x0002 /* pull content server to client */ #define SYNC_CLONE 0x0004 /* clone the repository */ #define SYNC_PRIVATE 0x0008 /* Also transfer private content */ #define SYNC_VERBOSE 0x0010 /* Extra diagnostics */ #define SYNC_RESYNC 0x0020 /* --verily */ #define SYNC_FROMPARENT 0x0040 /* Pull from the parent project */ #define SYNC_UNVERSIONED 0x0100 /* Sync unversioned content */ #define SYNC_UV_REVERT 0x0200 /* Copy server unversioned to client */ #define SYNC_UV_TRACE 0x0400 /* Describe UV activities */ #define SYNC_UV_DRYRUN 0x0800 /* Do not actually exchange files */ #define SYNC_IFABLE 0x1000 /* Inability to sync is not fatal */ #define SYNC_CKIN_LOCK 0x2000 /* Lock the current check-in */ #endif |
| ︙ | ︙ | |||
1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 |
int nRoundtrip= 0; /* Number of HTTP requests */
int nArtifactSent = 0; /* Total artifacts sent */
int nArtifactRcvd = 0; /* Total artifacts received */
const char *zOpType = 0;/* Push, Pull, Sync, Clone */
double rSkew = 0.0; /* Maximum time skew */
int uvHashSent = 0; /* The "pragma uv-hash" message has been sent */
int uvDoPush = 0; /* Generate uvfile messages to send to server */
int nUvGimmeSent = 0; /* Number of uvgimme cards sent on this cycle */
int nUvFileRcvd = 0; /* Number of uvfile cards received on this cycle */
sqlite3_int64 mtime; /* Modification time on a UV file */
int autopushFailed = 0; /* Autopush following commit failed if true */
const char *zCkinLock; /* Name of check-in to lock. NULL for none */
const char *zClientId; /* A unique identifier for this check-out */
unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH;
| > | < | 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 |
int nRoundtrip= 0; /* Number of HTTP requests */
int nArtifactSent = 0; /* Total artifacts sent */
int nArtifactRcvd = 0; /* Total artifacts received */
const char *zOpType = 0;/* Push, Pull, Sync, Clone */
double rSkew = 0.0; /* Maximum time skew */
int uvHashSent = 0; /* The "pragma uv-hash" message has been sent */
int uvDoPush = 0; /* Generate uvfile messages to send to server */
int uvPullOnly = 0; /* 1: pull-only. 2: pull-only warning issued */
int nUvGimmeSent = 0; /* Number of uvgimme cards sent on this cycle */
int nUvFileRcvd = 0; /* Number of uvfile cards received on this cycle */
sqlite3_int64 mtime; /* Modification time on a UV file */
int autopushFailed = 0; /* Autopush following commit failed if true */
const char *zCkinLock; /* Name of check-in to lock. NULL for none */
const char *zClientId; /* A unique identifier for this check-out */
unsigned int mHttpFlags;/* Flags for the http_exchange() subsystem */
if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH;
if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE|SYNC_UNVERSIONED))==0
&& configRcvMask==0 && configSendMask==0 ) return 0;
if( syncFlags & SYNC_FROMPARENT ){
configRcvMask = 0;
configSendMask = 0;
syncFlags &= ~(SYNC_PUSH);
zPCode = db_get("parent-project-code", 0);
if( zPCode==0 || db_get("parent-project-name",0)==0 ){
|
| ︙ | ︙ | |||
2036 2037 2038 2039 2040 2041 2042 |
configRcvMask = 0;
}
/* Client sends a request to sync unversioned files.
** On a clone, delay sending this until the second cycle since
** the login card might fail on the first cycle.
*/
| | | 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 |
configRcvMask = 0;
}
/* Client sends a request to sync unversioned files.
** On a clone, delay sending this until the second cycle since
** the login card might fail on the first cycle.
*/
if( (syncFlags & SYNC_UNVERSIONED)!=0
&& ((syncFlags & SYNC_CLONE)==0 || nCycle>0)
&& !uvHashSent
){
blob_appendf(&send, "pragma uv-hash %s\n", unversioned_content_hash(0));
nCardSent++;
uvHashSent = 1;
}
|
| ︙ | ︙ | |||
2356 2357 2358 2359 2360 2361 2362 |
}
}else if( iStatus==2 ){
db_multi_exec(
"UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName
);
db_unset("uv-hash", 0);
}
| > > > > > > > > | | 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 |
}
}else if( iStatus==2 ){
db_multi_exec(
"UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName
);
db_unset("uv-hash", 0);
}
if( iStatus>=4 && uvPullOnly==1 ){
fossil_warning(
"Warning: uv-pull-only \n"
" Unable to push unversioned content because you lack\n"
" sufficient permission on the server\n"
);
uvPullOnly = 2;
}
if( iStatus<=3 || uvPullOnly ){
db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName);
}else if( iStatus==4 ){
db_multi_exec("UPDATE uv_tosend SET mtimeOnly=1 WHERE name=%Q",zName);
}else if( iStatus==5 ){
db_multi_exec("REPLACE INTO uv_tosend(name,mtimeOnly) VALUES(%Q,0)",
zName);
}
|
| ︙ | ︙ | |||
2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 |
if( xfer.nToken>=5 ){
xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
}
}
/* pragma uv-pull-only
**
** If the server is unwill to accept new unversioned content (because
** this client lacks the necessary permissions) then it sends a
** "uv-pull-only" pragma so that the client will know not to waste
** bandwidth trying to upload unversioned content. If the server
** does accept new unversioned content, it sends "uv-push-ok".
*/
if( syncFlags & SYNC_UNVERSIONED ){
if( blob_eq(&xfer.aToken[1], "uv-pull-only") ){
| > < | < < < | 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 |
if( xfer.nToken>=5 ){
xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
}
}
/* pragma uv-pull-only
** pragma uv-push-ok
**
** If the server is unwill to accept new unversioned content (because
** this client lacks the necessary permissions) then it sends a
** "uv-pull-only" pragma so that the client will know not to waste
** bandwidth trying to upload unversioned content. If the server
** does accept new unversioned content, it sends "uv-push-ok".
*/
if( syncFlags & SYNC_UNVERSIONED ){
if( blob_eq(&xfer.aToken[1], "uv-pull-only") ){
uvPullOnly = 1;
if( syncFlags & SYNC_UV_REVERT ) uvDoPush = 1;
}else if( blob_eq(&xfer.aToken[1], "uv-push-ok") ){
uvDoPush = 1;
}
}
/* pragma ci-lock-fail USER-HOLDING-LOCK LOCK-TIME
|
| ︙ | ︙ |