Fossil SCM
Send the "pragma client-version" command from the client and parse it on the server.
Commit
a5f4579d4db4485e76640cae83d74b678d156be9
Parent
c88662873f2a3a5…
1 file changed
+12
-2
+12
-2
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1147,10 +1147,11 @@ | ||
| 1147 | 1147 | char *zUuidList = 0; |
| 1148 | 1148 | int nUuidList = 0; |
| 1149 | 1149 | char **pzUuidList = 0; |
| 1150 | 1150 | int *pnUuidList = 0; |
| 1151 | 1151 | int uvCatalogSent = 0; |
| 1152 | + int clientVersion = 0; /* Version number of the client */ | |
| 1152 | 1153 | |
| 1153 | 1154 | if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){ |
| 1154 | 1155 | fossil_redirect_home(); |
| 1155 | 1156 | } |
| 1156 | 1157 | g.zLogin = "anonymous"; |
| @@ -1301,15 +1302,14 @@ | ||
| 1301 | 1302 | |
| 1302 | 1303 | /* pull SERVERCODE PROJECTCODE |
| 1303 | 1304 | ** push SERVERCODE PROJECTCODE |
| 1304 | 1305 | ** |
| 1305 | 1306 | ** The client wants either send or receive. The server should |
| 1306 | - ** verify that the project code matches. | |
| 1307 | + ** verify that the project code matches. The server code is ignored. | |
| 1307 | 1308 | */ |
| 1308 | 1309 | if( xfer.nToken==3 |
| 1309 | 1310 | && (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push")) |
| 1310 | - && blob_is_hname(&xfer.aToken[1]) | |
| 1311 | 1311 | && blob_is_hname(&xfer.aToken[2]) |
| 1312 | 1312 | ){ |
| 1313 | 1313 | const char *zPCode; |
| 1314 | 1314 | zPCode = db_get("project-code", 0); |
| 1315 | 1315 | if( zPCode==0 ){ |
| @@ -1528,10 +1528,18 @@ | ||
| 1528 | 1528 | ** Send igot cards for all known artifacts. |
| 1529 | 1529 | */ |
| 1530 | 1530 | if( blob_eq(&xfer.aToken[1], "send-catalog") ){ |
| 1531 | 1531 | xfer.resync = 0x7fffffff; |
| 1532 | 1532 | } |
| 1533 | + | |
| 1534 | + /* pragma client-version VERSION | |
| 1535 | + ** | |
| 1536 | + ** Let the server know what version of Fossil is running on the client. | |
| 1537 | + */ | |
| 1538 | + if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){ | |
| 1539 | + clientVersion = atoi(blob_str(&xfer.aToken[2])); | |
| 1540 | + } | |
| 1533 | 1541 | |
| 1534 | 1542 | /* pragma uv-hash HASH |
| 1535 | 1543 | ** |
| 1536 | 1544 | ** The client wants to make sure that unversioned files are all synced. |
| 1537 | 1545 | ** If the HASH does not match, send a complete catalog of |
| @@ -1777,10 +1785,11 @@ | ||
| 1777 | 1785 | } |
| 1778 | 1786 | |
| 1779 | 1787 | /* |
| 1780 | 1788 | ** Always begin with a clone, pull, or push message |
| 1781 | 1789 | */ |
| 1790 | + blob_appendf(&send, "pragma client-version %d\n", RELEASE_VERSION_NUMBER); | |
| 1782 | 1791 | if( syncFlags & SYNC_CLONE ){ |
| 1783 | 1792 | blob_appendf(&send, "clone 3 %d\n", cloneSeqno); |
| 1784 | 1793 | syncFlags &= ~(SYNC_PUSH|SYNC_PULL); |
| 1785 | 1794 | nCardSent++; |
| 1786 | 1795 | /* TBD: Request all transferable configuration values */ |
| @@ -1813,10 +1822,11 @@ | ||
| 1813 | 1822 | db_record_repository_filename(0); |
| 1814 | 1823 | db_multi_exec( |
| 1815 | 1824 | "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" |
| 1816 | 1825 | ); |
| 1817 | 1826 | manifest_crosslink_begin(); |
| 1827 | + | |
| 1818 | 1828 | |
| 1819 | 1829 | /* Send back the most recently received cookie. Let the server |
| 1820 | 1830 | ** figure out if this is a cookie that it cares about. |
| 1821 | 1831 | */ |
| 1822 | 1832 | zCookie = db_get("cookie", 0); |
| 1823 | 1833 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1147,10 +1147,11 @@ | |
| 1147 | char *zUuidList = 0; |
| 1148 | int nUuidList = 0; |
| 1149 | char **pzUuidList = 0; |
| 1150 | int *pnUuidList = 0; |
| 1151 | int uvCatalogSent = 0; |
| 1152 | |
| 1153 | if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){ |
| 1154 | fossil_redirect_home(); |
| 1155 | } |
| 1156 | g.zLogin = "anonymous"; |
| @@ -1301,15 +1302,14 @@ | |
| 1301 | |
| 1302 | /* pull SERVERCODE PROJECTCODE |
| 1303 | ** push SERVERCODE PROJECTCODE |
| 1304 | ** |
| 1305 | ** The client wants either send or receive. The server should |
| 1306 | ** verify that the project code matches. |
| 1307 | */ |
| 1308 | if( xfer.nToken==3 |
| 1309 | && (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push")) |
| 1310 | && blob_is_hname(&xfer.aToken[1]) |
| 1311 | && blob_is_hname(&xfer.aToken[2]) |
| 1312 | ){ |
| 1313 | const char *zPCode; |
| 1314 | zPCode = db_get("project-code", 0); |
| 1315 | if( zPCode==0 ){ |
| @@ -1528,10 +1528,18 @@ | |
| 1528 | ** Send igot cards for all known artifacts. |
| 1529 | */ |
| 1530 | if( blob_eq(&xfer.aToken[1], "send-catalog") ){ |
| 1531 | xfer.resync = 0x7fffffff; |
| 1532 | } |
| 1533 | |
| 1534 | /* pragma uv-hash HASH |
| 1535 | ** |
| 1536 | ** The client wants to make sure that unversioned files are all synced. |
| 1537 | ** If the HASH does not match, send a complete catalog of |
| @@ -1777,10 +1785,11 @@ | |
| 1777 | } |
| 1778 | |
| 1779 | /* |
| 1780 | ** Always begin with a clone, pull, or push message |
| 1781 | */ |
| 1782 | if( syncFlags & SYNC_CLONE ){ |
| 1783 | blob_appendf(&send, "clone 3 %d\n", cloneSeqno); |
| 1784 | syncFlags &= ~(SYNC_PUSH|SYNC_PULL); |
| 1785 | nCardSent++; |
| 1786 | /* TBD: Request all transferable configuration values */ |
| @@ -1813,10 +1822,11 @@ | |
| 1813 | db_record_repository_filename(0); |
| 1814 | db_multi_exec( |
| 1815 | "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" |
| 1816 | ); |
| 1817 | manifest_crosslink_begin(); |
| 1818 | |
| 1819 | /* Send back the most recently received cookie. Let the server |
| 1820 | ** figure out if this is a cookie that it cares about. |
| 1821 | */ |
| 1822 | zCookie = db_get("cookie", 0); |
| 1823 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1147,10 +1147,11 @@ | |
| 1147 | char *zUuidList = 0; |
| 1148 | int nUuidList = 0; |
| 1149 | char **pzUuidList = 0; |
| 1150 | int *pnUuidList = 0; |
| 1151 | int uvCatalogSent = 0; |
| 1152 | int clientVersion = 0; /* Version number of the client */ |
| 1153 | |
| 1154 | if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){ |
| 1155 | fossil_redirect_home(); |
| 1156 | } |
| 1157 | g.zLogin = "anonymous"; |
| @@ -1301,15 +1302,14 @@ | |
| 1302 | |
| 1303 | /* pull SERVERCODE PROJECTCODE |
| 1304 | ** push SERVERCODE PROJECTCODE |
| 1305 | ** |
| 1306 | ** The client wants either send or receive. The server should |
| 1307 | ** verify that the project code matches. The server code is ignored. |
| 1308 | */ |
| 1309 | if( xfer.nToken==3 |
| 1310 | && (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push")) |
| 1311 | && blob_is_hname(&xfer.aToken[2]) |
| 1312 | ){ |
| 1313 | const char *zPCode; |
| 1314 | zPCode = db_get("project-code", 0); |
| 1315 | if( zPCode==0 ){ |
| @@ -1528,10 +1528,18 @@ | |
| 1528 | ** Send igot cards for all known artifacts. |
| 1529 | */ |
| 1530 | if( blob_eq(&xfer.aToken[1], "send-catalog") ){ |
| 1531 | xfer.resync = 0x7fffffff; |
| 1532 | } |
| 1533 | |
| 1534 | /* pragma client-version VERSION |
| 1535 | ** |
| 1536 | ** Let the server know what version of Fossil is running on the client. |
| 1537 | */ |
| 1538 | if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){ |
| 1539 | clientVersion = atoi(blob_str(&xfer.aToken[2])); |
| 1540 | } |
| 1541 | |
| 1542 | /* pragma uv-hash HASH |
| 1543 | ** |
| 1544 | ** The client wants to make sure that unversioned files are all synced. |
| 1545 | ** If the HASH does not match, send a complete catalog of |
| @@ -1777,10 +1785,11 @@ | |
| 1785 | } |
| 1786 | |
| 1787 | /* |
| 1788 | ** Always begin with a clone, pull, or push message |
| 1789 | */ |
| 1790 | blob_appendf(&send, "pragma client-version %d\n", RELEASE_VERSION_NUMBER); |
| 1791 | if( syncFlags & SYNC_CLONE ){ |
| 1792 | blob_appendf(&send, "clone 3 %d\n", cloneSeqno); |
| 1793 | syncFlags &= ~(SYNC_PUSH|SYNC_PULL); |
| 1794 | nCardSent++; |
| 1795 | /* TBD: Request all transferable configuration values */ |
| @@ -1813,10 +1822,11 @@ | |
| 1822 | db_record_repository_filename(0); |
| 1823 | db_multi_exec( |
| 1824 | "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);" |
| 1825 | ); |
| 1826 | manifest_crosslink_begin(); |
| 1827 | |
| 1828 | |
| 1829 | /* Send back the most recently received cookie. Let the server |
| 1830 | ** figure out if this is a cookie that it cares about. |
| 1831 | */ |
| 1832 | zCookie = db_get("cookie", 0); |
| 1833 |