Fossil SCM
Warn that unversioned content cannot be pushed when the server has sent "uv-pull-only" and any file is still queued to send. The warning was given only for files the server already held, never for new ones, which were left unsent without a word.
Commit
deee1bf4ca24e301032634f0bb8189f66e6dca50941a8cc81b460275408d8dea
Parent
40b789d684676e1…
1 file changed
+24
-5
+24
-5
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -2143,10 +2143,22 @@ | ||
| 2143 | 2143 | ** Floating-point absolute value |
| 2144 | 2144 | */ |
| 2145 | 2145 | static double fossil_fabs(double x){ |
| 2146 | 2146 | return x>0.0 ? x : -x; |
| 2147 | 2147 | } |
| 2148 | + | |
| 2149 | +/* | |
| 2150 | +** Tell the user that unversioned content cannot be pushed because the | |
| 2151 | +** server has sent the "uv-pull-only" pragma. | |
| 2152 | +*/ | |
| 2153 | +static void uv_pull_only_warning(void){ | |
| 2154 | + fossil_warning( | |
| 2155 | + "Warning: uv-pull-only \n" | |
| 2156 | + " Unable to push unversioned content because you lack\n" | |
| 2157 | + " sufficient permission on the server\n" | |
| 2158 | + ); | |
| 2159 | +} | |
| 2148 | 2160 | |
| 2149 | 2161 | /* |
| 2150 | 2162 | ** Sync to the host identified in g.url.name and g.url.path. This |
| 2151 | 2163 | ** routine is called by the client. |
| 2152 | 2164 | ** |
| @@ -2776,15 +2788,11 @@ | ||
| 2776 | 2788 | "UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName |
| 2777 | 2789 | ); |
| 2778 | 2790 | db_unset("uv-hash", 0); |
| 2779 | 2791 | } |
| 2780 | 2792 | if( iStatus>=4 && uvPullOnly==1 ){ |
| 2781 | - fossil_warning( | |
| 2782 | - "Warning: uv-pull-only \n" | |
| 2783 | - " Unable to push unversioned content because you lack\n" | |
| 2784 | - " sufficient permission on the server\n" | |
| 2785 | - ); | |
| 2793 | + uv_pull_only_warning(); | |
| 2786 | 2794 | uvPullOnly = 2; |
| 2787 | 2795 | } |
| 2788 | 2796 | if( iStatus<=3 || uvPullOnly ){ |
| 2789 | 2797 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2790 | 2798 | }else if( iStatus==4 ){ |
| @@ -3084,10 +3092,21 @@ | ||
| 3084 | 3092 | } |
| 3085 | 3093 | } |
| 3086 | 3094 | nUncRcvd += blob_size(&recv); |
| 3087 | 3095 | blob_reset(&recv); |
| 3088 | 3096 | nCycle++; |
| 3097 | + | |
| 3098 | + /* A file that the server has never held is in no uvigot card, so the | |
| 3099 | + ** warning above is not given for it. Give it if anything is still | |
| 3100 | + ** queued to send to a server that takes no unversioned content. */ | |
| 3101 | + if( uvPullOnly==1 && (syncFlags & SYNC_UV_REVERT)==0 | |
| 3102 | + && db_exists("SELECT 1 FROM uv_tosend") | |
| 3103 | + ){ | |
| 3104 | + uv_pull_only_warning(); | |
| 3105 | + uvPullOnly = 2; | |
| 3106 | + db_multi_exec("DELETE FROM uv_tosend"); | |
| 3107 | + } | |
| 3089 | 3108 | |
| 3090 | 3109 | /* Set go to 1 if we need to continue the sync/push/pull/clone for |
| 3091 | 3110 | ** another round. Set go to 0 if it is time to quit. */ |
| 3092 | 3111 | nFileRecv = xfer.nFileRcvd + xfer.nDeltaRcvd + xfer.nDanglingFile; |
| 3093 | 3112 | if( (nFileRecv>0 || newPhantom) && db_exists("SELECT 1 FROM phantom") ){ |
| 3094 | 3113 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2143,10 +2143,22 @@ | |
| 2143 | ** Floating-point absolute value |
| 2144 | */ |
| 2145 | static double fossil_fabs(double x){ |
| 2146 | return x>0.0 ? x : -x; |
| 2147 | } |
| 2148 | |
| 2149 | /* |
| 2150 | ** Sync to the host identified in g.url.name and g.url.path. This |
| 2151 | ** routine is called by the client. |
| 2152 | ** |
| @@ -2776,15 +2788,11 @@ | |
| 2776 | "UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName |
| 2777 | ); |
| 2778 | db_unset("uv-hash", 0); |
| 2779 | } |
| 2780 | if( iStatus>=4 && uvPullOnly==1 ){ |
| 2781 | fossil_warning( |
| 2782 | "Warning: uv-pull-only \n" |
| 2783 | " Unable to push unversioned content because you lack\n" |
| 2784 | " sufficient permission on the server\n" |
| 2785 | ); |
| 2786 | uvPullOnly = 2; |
| 2787 | } |
| 2788 | if( iStatus<=3 || uvPullOnly ){ |
| 2789 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2790 | }else if( iStatus==4 ){ |
| @@ -3084,10 +3092,21 @@ | |
| 3084 | } |
| 3085 | } |
| 3086 | nUncRcvd += blob_size(&recv); |
| 3087 | blob_reset(&recv); |
| 3088 | nCycle++; |
| 3089 | |
| 3090 | /* Set go to 1 if we need to continue the sync/push/pull/clone for |
| 3091 | ** another round. Set go to 0 if it is time to quit. */ |
| 3092 | nFileRecv = xfer.nFileRcvd + xfer.nDeltaRcvd + xfer.nDanglingFile; |
| 3093 | if( (nFileRecv>0 || newPhantom) && db_exists("SELECT 1 FROM phantom") ){ |
| 3094 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2143,10 +2143,22 @@ | |
| 2143 | ** Floating-point absolute value |
| 2144 | */ |
| 2145 | static double fossil_fabs(double x){ |
| 2146 | return x>0.0 ? x : -x; |
| 2147 | } |
| 2148 | |
| 2149 | /* |
| 2150 | ** Tell the user that unversioned content cannot be pushed because the |
| 2151 | ** server has sent the "uv-pull-only" pragma. |
| 2152 | */ |
| 2153 | static void uv_pull_only_warning(void){ |
| 2154 | fossil_warning( |
| 2155 | "Warning: uv-pull-only \n" |
| 2156 | " Unable to push unversioned content because you lack\n" |
| 2157 | " sufficient permission on the server\n" |
| 2158 | ); |
| 2159 | } |
| 2160 | |
| 2161 | /* |
| 2162 | ** Sync to the host identified in g.url.name and g.url.path. This |
| 2163 | ** routine is called by the client. |
| 2164 | ** |
| @@ -2776,15 +2788,11 @@ | |
| 2788 | "UPDATE unversioned SET mtime=%lld WHERE name=%Q", mtime, zName |
| 2789 | ); |
| 2790 | db_unset("uv-hash", 0); |
| 2791 | } |
| 2792 | if( iStatus>=4 && uvPullOnly==1 ){ |
| 2793 | uv_pull_only_warning(); |
| 2794 | uvPullOnly = 2; |
| 2795 | } |
| 2796 | if( iStatus<=3 || uvPullOnly ){ |
| 2797 | db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName); |
| 2798 | }else if( iStatus==4 ){ |
| @@ -3084,10 +3092,21 @@ | |
| 3092 | } |
| 3093 | } |
| 3094 | nUncRcvd += blob_size(&recv); |
| 3095 | blob_reset(&recv); |
| 3096 | nCycle++; |
| 3097 | |
| 3098 | /* A file that the server has never held is in no uvigot card, so the |
| 3099 | ** warning above is not given for it. Give it if anything is still |
| 3100 | ** queued to send to a server that takes no unversioned content. */ |
| 3101 | if( uvPullOnly==1 && (syncFlags & SYNC_UV_REVERT)==0 |
| 3102 | && db_exists("SELECT 1 FROM uv_tosend") |
| 3103 | ){ |
| 3104 | uv_pull_only_warning(); |
| 3105 | uvPullOnly = 2; |
| 3106 | db_multi_exec("DELETE FROM uv_tosend"); |
| 3107 | } |
| 3108 | |
| 3109 | /* Set go to 1 if we need to continue the sync/push/pull/clone for |
| 3110 | ** another round. Set go to 0 if it is time to quit. */ |
| 3111 | nFileRecv = xfer.nFileRcvd + xfer.nDeltaRcvd + xfer.nDanglingFile; |
| 3112 | if( (nFileRecv>0 || newPhantom) && db_exists("SELECT 1 FROM phantom") ){ |
| 3113 |