Fossil SCM
Provide method to obtain a plaintext hash of an artifact; can be used by build monitors to determine if a given branch hash new changes to consume.
Commit
4956789576c0578752aedbcb0ae619f1311cf0397798b92f8b2518419b5f9f28
Parent
ca8d6eee8a4d82b…
1 file changed
+10
+10
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2643,10 +2643,11 @@ | ||
| 2643 | 2643 | ** filename=NAME - alternative spelling for "name=" |
| 2644 | 2644 | ** fn=NAME - alternative spelling for "name=" |
| 2645 | 2645 | ** ci=VERSION - The specific check-in to use with "name=" to |
| 2646 | 2646 | ** identify the file. |
| 2647 | 2647 | ** txt - Force display of unformatted source text |
| 2648 | +** hash - Output only the hash of the artifact | |
| 2648 | 2649 | ** |
| 2649 | 2650 | ** The /artifact page show the complete content of a file |
| 2650 | 2651 | ** identified by HASH. The /whatis page shows only a description |
| 2651 | 2652 | ** of how the artifact is used. The /file page shows the most recent |
| 2652 | 2653 | ** version of the file or directory called NAME, or a list of the |
| @@ -2665,18 +2666,20 @@ | ||
| 2665 | 2666 | void artifact_page(void){ |
| 2666 | 2667 | int rid = 0; |
| 2667 | 2668 | Blob content; |
| 2668 | 2669 | const char *zMime; |
| 2669 | 2670 | Blob downloadName; |
| 2671 | + Blob uuid; | |
| 2670 | 2672 | int renderAsWiki = 0; |
| 2671 | 2673 | int renderAsHtml = 0; |
| 2672 | 2674 | int renderAsSvg = 0; |
| 2673 | 2675 | int objType; |
| 2674 | 2676 | int asText; |
| 2675 | 2677 | const char *zUuid = 0; |
| 2676 | 2678 | u32 objdescFlags = OBJDESC_BASE; |
| 2677 | 2679 | int descOnly = fossil_strcmp(g.zPath,"whatis")==0; |
| 2680 | + int hashOnly = P("hash")!=0; | |
| 2678 | 2681 | int isFile = fossil_strcmp(g.zPath,"file")==0; |
| 2679 | 2682 | const char *zLn = P("ln"); |
| 2680 | 2683 | const char *zName = P("name"); |
| 2681 | 2684 | const char *zCI = P("ci"); |
| 2682 | 2685 | HQuery url; |
| @@ -2789,10 +2792,17 @@ | ||
| 2789 | 2792 | url_add_parameter(&url, "verbose", "1"); |
| 2790 | 2793 | objdescFlags |= OBJDESC_DETAIL; |
| 2791 | 2794 | } |
| 2792 | 2795 | zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 2793 | 2796 | etag_check(ETAG_HASH, zUuid); |
| 2797 | + | |
| 2798 | + if( descOnly && hashOnly ){ | |
| 2799 | + blob_set(&uuid, zUuid); | |
| 2800 | + cgi_set_content_type("text/plain"); | |
| 2801 | + cgi_set_content(&uuid); | |
| 2802 | + return; | |
| 2803 | + } | |
| 2794 | 2804 | |
| 2795 | 2805 | asText = P("txt")!=0; |
| 2796 | 2806 | if( isFile ){ |
| 2797 | 2807 | if( zCI==0 || fossil_strcmp(zCI,"tip")==0 ){ |
| 2798 | 2808 | zCI = "tip"; |
| 2799 | 2809 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2643,10 +2643,11 @@ | |
| 2643 | ** filename=NAME - alternative spelling for "name=" |
| 2644 | ** fn=NAME - alternative spelling for "name=" |
| 2645 | ** ci=VERSION - The specific check-in to use with "name=" to |
| 2646 | ** identify the file. |
| 2647 | ** txt - Force display of unformatted source text |
| 2648 | ** |
| 2649 | ** The /artifact page show the complete content of a file |
| 2650 | ** identified by HASH. The /whatis page shows only a description |
| 2651 | ** of how the artifact is used. The /file page shows the most recent |
| 2652 | ** version of the file or directory called NAME, or a list of the |
| @@ -2665,18 +2666,20 @@ | |
| 2665 | void artifact_page(void){ |
| 2666 | int rid = 0; |
| 2667 | Blob content; |
| 2668 | const char *zMime; |
| 2669 | Blob downloadName; |
| 2670 | int renderAsWiki = 0; |
| 2671 | int renderAsHtml = 0; |
| 2672 | int renderAsSvg = 0; |
| 2673 | int objType; |
| 2674 | int asText; |
| 2675 | const char *zUuid = 0; |
| 2676 | u32 objdescFlags = OBJDESC_BASE; |
| 2677 | int descOnly = fossil_strcmp(g.zPath,"whatis")==0; |
| 2678 | int isFile = fossil_strcmp(g.zPath,"file")==0; |
| 2679 | const char *zLn = P("ln"); |
| 2680 | const char *zName = P("name"); |
| 2681 | const char *zCI = P("ci"); |
| 2682 | HQuery url; |
| @@ -2789,10 +2792,17 @@ | |
| 2789 | url_add_parameter(&url, "verbose", "1"); |
| 2790 | objdescFlags |= OBJDESC_DETAIL; |
| 2791 | } |
| 2792 | zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 2793 | etag_check(ETAG_HASH, zUuid); |
| 2794 | |
| 2795 | asText = P("txt")!=0; |
| 2796 | if( isFile ){ |
| 2797 | if( zCI==0 || fossil_strcmp(zCI,"tip")==0 ){ |
| 2798 | zCI = "tip"; |
| 2799 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2643,10 +2643,11 @@ | |
| 2643 | ** filename=NAME - alternative spelling for "name=" |
| 2644 | ** fn=NAME - alternative spelling for "name=" |
| 2645 | ** ci=VERSION - The specific check-in to use with "name=" to |
| 2646 | ** identify the file. |
| 2647 | ** txt - Force display of unformatted source text |
| 2648 | ** hash - Output only the hash of the artifact |
| 2649 | ** |
| 2650 | ** The /artifact page show the complete content of a file |
| 2651 | ** identified by HASH. The /whatis page shows only a description |
| 2652 | ** of how the artifact is used. The /file page shows the most recent |
| 2653 | ** version of the file or directory called NAME, or a list of the |
| @@ -2665,18 +2666,20 @@ | |
| 2666 | void artifact_page(void){ |
| 2667 | int rid = 0; |
| 2668 | Blob content; |
| 2669 | const char *zMime; |
| 2670 | Blob downloadName; |
| 2671 | Blob uuid; |
| 2672 | int renderAsWiki = 0; |
| 2673 | int renderAsHtml = 0; |
| 2674 | int renderAsSvg = 0; |
| 2675 | int objType; |
| 2676 | int asText; |
| 2677 | const char *zUuid = 0; |
| 2678 | u32 objdescFlags = OBJDESC_BASE; |
| 2679 | int descOnly = fossil_strcmp(g.zPath,"whatis")==0; |
| 2680 | int hashOnly = P("hash")!=0; |
| 2681 | int isFile = fossil_strcmp(g.zPath,"file")==0; |
| 2682 | const char *zLn = P("ln"); |
| 2683 | const char *zName = P("name"); |
| 2684 | const char *zCI = P("ci"); |
| 2685 | HQuery url; |
| @@ -2789,10 +2792,17 @@ | |
| 2792 | url_add_parameter(&url, "verbose", "1"); |
| 2793 | objdescFlags |= OBJDESC_DETAIL; |
| 2794 | } |
| 2795 | zUuid = db_text("?", "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 2796 | etag_check(ETAG_HASH, zUuid); |
| 2797 | |
| 2798 | if( descOnly && hashOnly ){ |
| 2799 | blob_set(&uuid, zUuid); |
| 2800 | cgi_set_content_type("text/plain"); |
| 2801 | cgi_set_content(&uuid); |
| 2802 | return; |
| 2803 | } |
| 2804 | |
| 2805 | asText = P("txt")!=0; |
| 2806 | if( isFile ){ |
| 2807 | if( zCI==0 || fossil_strcmp(zCI,"tip")==0 ){ |
| 2808 | zCI = "tip"; |
| 2809 |