Fossil SCM
Trunkify support for generating manifest.tags file.
Commit
189bfc28e7a3a166417aabfb77bf898b3b26c4df
Parent
e7c2454da9fc386…
8 files changed
+21
-8
+13
-3
+65
-7
+43
-4
+1
+51
-15
+54
-16
+113
+21
-8
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -71,29 +71,42 @@ | ||
| 71 | 71 | ".fos-journal", |
| 72 | 72 | ".fos-wal", |
| 73 | 73 | ".fos-shm", |
| 74 | 74 | }; |
| 75 | 75 | |
| 76 | - /* Names of auxiliary files generated by SQLite when the "manifest" | |
| 77 | - ** property is enabled | |
| 76 | + /* Possible names of auxiliary files generated when the "manifest" property | |
| 77 | + ** is used | |
| 78 | 78 | */ |
| 79 | - static const char *const azManifest[] = { | |
| 80 | - "manifest", | |
| 81 | - "manifest.uuid", | |
| 79 | + static const struct { | |
| 80 | + const char *fname; | |
| 81 | + int flg; | |
| 82 | + }aManifestflags[] = { | |
| 83 | + { "manifest", MFESTFLG_RAW }, | |
| 84 | + { "manifest.uuid", MFESTFLG_UUID }, | |
| 85 | + { "manifest.tags", MFESTFLG_TAGS } | |
| 82 | 86 | }; |
| 87 | + static const char *azManifests[3]; | |
| 83 | 88 | |
| 84 | 89 | /* |
| 85 | 90 | ** Names of repository files, if they exist in the checkout. |
| 86 | 91 | */ |
| 87 | 92 | static const char *azRepo[4] = { 0, 0, 0, 0 }; |
| 88 | 93 | |
| 89 | 94 | /* Cached setting "manifest" */ |
| 90 | 95 | static int cachedManifest = -1; |
| 96 | + static int numManifests; | |
| 91 | 97 | |
| 92 | 98 | if( cachedManifest == -1 ){ |
| 99 | + int i; | |
| 93 | 100 | Blob repo; |
| 94 | - cachedManifest = db_get_boolean("manifest",0); | |
| 101 | + cachedManifest = db_get_manifest_setting(); | |
| 102 | + numManifests = 0; | |
| 103 | + for(i=0; i<count(aManifestflags); i++){ | |
| 104 | + if( cachedManifest&aManifestflags[i].flg ) { | |
| 105 | + azManifests[numManifests++] = aManifestflags[i].fname; | |
| 106 | + } | |
| 107 | + } | |
| 95 | 108 | blob_zero(&repo); |
| 96 | 109 | if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ |
| 97 | 110 | const char *zRepo = blob_str(&repo); |
| 98 | 111 | azRepo[0] = zRepo; |
| 99 | 112 | azRepo[1] = mprintf("%s-journal", zRepo); |
| @@ -104,12 +117,12 @@ | ||
| 104 | 117 | |
| 105 | 118 | if( N<0 ) return 0; |
| 106 | 119 | if( N<count(azName) ) return azName[N]; |
| 107 | 120 | N -= count(azName); |
| 108 | 121 | if( cachedManifest ){ |
| 109 | - if( N<count(azManifest) ) return azManifest[N]; | |
| 110 | - N -= count(azManifest); | |
| 122 | + if( N<numManifests ) return azManifests[N]; | |
| 123 | + N -= numManifests; | |
| 111 | 124 | } |
| 112 | 125 | if( !omitRepo && N<count(azRepo) ) return azRepo[N]; |
| 113 | 126 | return 0; |
| 114 | 127 | } |
| 115 | 128 | |
| 116 | 129 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -71,29 +71,42 @@ | |
| 71 | ".fos-journal", |
| 72 | ".fos-wal", |
| 73 | ".fos-shm", |
| 74 | }; |
| 75 | |
| 76 | /* Names of auxiliary files generated by SQLite when the "manifest" |
| 77 | ** property is enabled |
| 78 | */ |
| 79 | static const char *const azManifest[] = { |
| 80 | "manifest", |
| 81 | "manifest.uuid", |
| 82 | }; |
| 83 | |
| 84 | /* |
| 85 | ** Names of repository files, if they exist in the checkout. |
| 86 | */ |
| 87 | static const char *azRepo[4] = { 0, 0, 0, 0 }; |
| 88 | |
| 89 | /* Cached setting "manifest" */ |
| 90 | static int cachedManifest = -1; |
| 91 | |
| 92 | if( cachedManifest == -1 ){ |
| 93 | Blob repo; |
| 94 | cachedManifest = db_get_boolean("manifest",0); |
| 95 | blob_zero(&repo); |
| 96 | if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ |
| 97 | const char *zRepo = blob_str(&repo); |
| 98 | azRepo[0] = zRepo; |
| 99 | azRepo[1] = mprintf("%s-journal", zRepo); |
| @@ -104,12 +117,12 @@ | |
| 104 | |
| 105 | if( N<0 ) return 0; |
| 106 | if( N<count(azName) ) return azName[N]; |
| 107 | N -= count(azName); |
| 108 | if( cachedManifest ){ |
| 109 | if( N<count(azManifest) ) return azManifest[N]; |
| 110 | N -= count(azManifest); |
| 111 | } |
| 112 | if( !omitRepo && N<count(azRepo) ) return azRepo[N]; |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -71,29 +71,42 @@ | |
| 71 | ".fos-journal", |
| 72 | ".fos-wal", |
| 73 | ".fos-shm", |
| 74 | }; |
| 75 | |
| 76 | /* Possible names of auxiliary files generated when the "manifest" property |
| 77 | ** is used |
| 78 | */ |
| 79 | static const struct { |
| 80 | const char *fname; |
| 81 | int flg; |
| 82 | }aManifestflags[] = { |
| 83 | { "manifest", MFESTFLG_RAW }, |
| 84 | { "manifest.uuid", MFESTFLG_UUID }, |
| 85 | { "manifest.tags", MFESTFLG_TAGS } |
| 86 | }; |
| 87 | static const char *azManifests[3]; |
| 88 | |
| 89 | /* |
| 90 | ** Names of repository files, if they exist in the checkout. |
| 91 | */ |
| 92 | static const char *azRepo[4] = { 0, 0, 0, 0 }; |
| 93 | |
| 94 | /* Cached setting "manifest" */ |
| 95 | static int cachedManifest = -1; |
| 96 | static int numManifests; |
| 97 | |
| 98 | if( cachedManifest == -1 ){ |
| 99 | int i; |
| 100 | Blob repo; |
| 101 | cachedManifest = db_get_manifest_setting(); |
| 102 | numManifests = 0; |
| 103 | for(i=0; i<count(aManifestflags); i++){ |
| 104 | if( cachedManifest&aManifestflags[i].flg ) { |
| 105 | azManifests[numManifests++] = aManifestflags[i].fname; |
| 106 | } |
| 107 | } |
| 108 | blob_zero(&repo); |
| 109 | if( file_tree_name(g.zRepositoryName, &repo, 0, 0) ){ |
| 110 | const char *zRepo = blob_str(&repo); |
| 111 | azRepo[0] = zRepo; |
| 112 | azRepo[1] = mprintf("%s-journal", zRepo); |
| @@ -104,12 +117,12 @@ | |
| 117 | |
| 118 | if( N<0 ) return 0; |
| 119 | if( N<count(azName) ) return azName[N]; |
| 120 | N -= count(azName); |
| 121 | if( cachedManifest ){ |
| 122 | if( N<numManifests ) return azManifests[N]; |
| 123 | N -= numManifests; |
| 124 | } |
| 125 | if( !omitRepo && N<count(azRepo) ) return azRepo[N]; |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 |
+13
-3
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1869,11 +1869,11 @@ | ||
| 1869 | 1869 | sCiInfo.zUserOvrd = find_option("user-override",0,1); |
| 1870 | 1870 | db_must_be_within_tree(); |
| 1871 | 1871 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1872 | 1872 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1873 | 1873 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1874 | - outputManifest = db_get_boolean("manifest", 0); | |
| 1874 | + outputManifest = db_get_manifest_setting(); | |
| 1875 | 1875 | verify_all_options(); |
| 1876 | 1876 | |
| 1877 | 1877 | /* Escape special characters in tags and put all tags in sorted order */ |
| 1878 | 1878 | if( nTag ){ |
| 1879 | 1879 | int i; |
| @@ -2230,11 +2230,11 @@ | ||
| 2230 | 2230 | ** and rollback the transaction. |
| 2231 | 2231 | */ |
| 2232 | 2232 | if( dryRunFlag ){ |
| 2233 | 2233 | blob_write_to_file(&manifest, ""); |
| 2234 | 2234 | } |
| 2235 | - if( outputManifest ){ | |
| 2235 | + if( outputManifest & MFESTFLG_RAW ){ | |
| 2236 | 2236 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| 2237 | 2237 | blob_write_to_file(&manifest, zManifestFile); |
| 2238 | 2238 | blob_reset(&manifest); |
| 2239 | 2239 | blob_read_from_file(&manifest, zManifestFile); |
| 2240 | 2240 | free(zManifestFile); |
| @@ -2264,11 +2264,11 @@ | ||
| 2264 | 2264 | } |
| 2265 | 2265 | } |
| 2266 | 2266 | db_finalize(&q); |
| 2267 | 2267 | |
| 2268 | 2268 | fossil_print("New_Version: %s\n", zUuid); |
| 2269 | - if( outputManifest ){ | |
| 2269 | + if( outputManifest & MFESTFLG_UUID ){ | |
| 2270 | 2270 | zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 2271 | 2271 | blob_zero(&muuid); |
| 2272 | 2272 | blob_appendf(&muuid, "%s\n", zUuid); |
| 2273 | 2273 | blob_write_to_file(&muuid, zManifestFile); |
| 2274 | 2274 | free(zManifestFile); |
| @@ -2346,13 +2346,23 @@ | ||
| 2346 | 2346 | if( dryRunFlag ){ |
| 2347 | 2347 | db_end_transaction(1); |
| 2348 | 2348 | exit(1); |
| 2349 | 2349 | } |
| 2350 | 2350 | db_end_transaction(0); |
| 2351 | + | |
| 2352 | + if( outputManifest & MFESTFLG_TAGS ){ | |
| 2353 | + Blob tagslist; | |
| 2354 | + zManifestFile = mprintf("%smanifest.tags", g.zLocalRoot); | |
| 2355 | + blob_zero(&tagslist); | |
| 2356 | + get_checkin_taglist(nvid, &tagslist); | |
| 2357 | + blob_write_to_file(&tagslist, zManifestFile); | |
| 2358 | + blob_reset(&tagslist); | |
| 2359 | + free(zManifestFile); | |
| 2360 | + } | |
| 2351 | 2361 | |
| 2352 | 2362 | if( !g.markPrivate ){ |
| 2353 | 2363 | autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0); |
| 2354 | 2364 | } |
| 2355 | 2365 | if( count_nonbranch_children(vid)>1 ){ |
| 2356 | 2366 | fossil_print("**** warning: a fork has occurred *****\n"); |
| 2357 | 2367 | } |
| 2358 | 2368 | } |
| 2359 | 2369 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1869,11 +1869,11 @@ | |
| 1869 | sCiInfo.zUserOvrd = find_option("user-override",0,1); |
| 1870 | db_must_be_within_tree(); |
| 1871 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1872 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1873 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1874 | outputManifest = db_get_boolean("manifest", 0); |
| 1875 | verify_all_options(); |
| 1876 | |
| 1877 | /* Escape special characters in tags and put all tags in sorted order */ |
| 1878 | if( nTag ){ |
| 1879 | int i; |
| @@ -2230,11 +2230,11 @@ | |
| 2230 | ** and rollback the transaction. |
| 2231 | */ |
| 2232 | if( dryRunFlag ){ |
| 2233 | blob_write_to_file(&manifest, ""); |
| 2234 | } |
| 2235 | if( outputManifest ){ |
| 2236 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| 2237 | blob_write_to_file(&manifest, zManifestFile); |
| 2238 | blob_reset(&manifest); |
| 2239 | blob_read_from_file(&manifest, zManifestFile); |
| 2240 | free(zManifestFile); |
| @@ -2264,11 +2264,11 @@ | |
| 2264 | } |
| 2265 | } |
| 2266 | db_finalize(&q); |
| 2267 | |
| 2268 | fossil_print("New_Version: %s\n", zUuid); |
| 2269 | if( outputManifest ){ |
| 2270 | zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 2271 | blob_zero(&muuid); |
| 2272 | blob_appendf(&muuid, "%s\n", zUuid); |
| 2273 | blob_write_to_file(&muuid, zManifestFile); |
| 2274 | free(zManifestFile); |
| @@ -2346,13 +2346,23 @@ | |
| 2346 | if( dryRunFlag ){ |
| 2347 | db_end_transaction(1); |
| 2348 | exit(1); |
| 2349 | } |
| 2350 | db_end_transaction(0); |
| 2351 | |
| 2352 | if( !g.markPrivate ){ |
| 2353 | autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0); |
| 2354 | } |
| 2355 | if( count_nonbranch_children(vid)>1 ){ |
| 2356 | fossil_print("**** warning: a fork has occurred *****\n"); |
| 2357 | } |
| 2358 | } |
| 2359 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1869,11 +1869,11 @@ | |
| 1869 | sCiInfo.zUserOvrd = find_option("user-override",0,1); |
| 1870 | db_must_be_within_tree(); |
| 1871 | noSign = db_get_boolean("omitsign", 0)|noSign; |
| 1872 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 1873 | useCksum = db_get_boolean("repo-cksum", 1); |
| 1874 | outputManifest = db_get_manifest_setting(); |
| 1875 | verify_all_options(); |
| 1876 | |
| 1877 | /* Escape special characters in tags and put all tags in sorted order */ |
| 1878 | if( nTag ){ |
| 1879 | int i; |
| @@ -2230,11 +2230,11 @@ | |
| 2230 | ** and rollback the transaction. |
| 2231 | */ |
| 2232 | if( dryRunFlag ){ |
| 2233 | blob_write_to_file(&manifest, ""); |
| 2234 | } |
| 2235 | if( outputManifest & MFESTFLG_RAW ){ |
| 2236 | zManifestFile = mprintf("%smanifest", g.zLocalRoot); |
| 2237 | blob_write_to_file(&manifest, zManifestFile); |
| 2238 | blob_reset(&manifest); |
| 2239 | blob_read_from_file(&manifest, zManifestFile); |
| 2240 | free(zManifestFile); |
| @@ -2264,11 +2264,11 @@ | |
| 2264 | } |
| 2265 | } |
| 2266 | db_finalize(&q); |
| 2267 | |
| 2268 | fossil_print("New_Version: %s\n", zUuid); |
| 2269 | if( outputManifest & MFESTFLG_UUID ){ |
| 2270 | zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 2271 | blob_zero(&muuid); |
| 2272 | blob_appendf(&muuid, "%s\n", zUuid); |
| 2273 | blob_write_to_file(&muuid, zManifestFile); |
| 2274 | free(zManifestFile); |
| @@ -2346,13 +2346,23 @@ | |
| 2346 | if( dryRunFlag ){ |
| 2347 | db_end_transaction(1); |
| 2348 | exit(1); |
| 2349 | } |
| 2350 | db_end_transaction(0); |
| 2351 | |
| 2352 | if( outputManifest & MFESTFLG_TAGS ){ |
| 2353 | Blob tagslist; |
| 2354 | zManifestFile = mprintf("%smanifest.tags", g.zLocalRoot); |
| 2355 | blob_zero(&tagslist); |
| 2356 | get_checkin_taglist(nvid, &tagslist); |
| 2357 | blob_write_to_file(&tagslist, zManifestFile); |
| 2358 | blob_reset(&tagslist); |
| 2359 | free(zManifestFile); |
| 2360 | } |
| 2361 | |
| 2362 | if( !g.markPrivate ){ |
| 2363 | autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0); |
| 2364 | } |
| 2365 | if( count_nonbranch_children(vid)>1 ){ |
| 2366 | fossil_print("**** warning: a fork has occurred *****\n"); |
| 2367 | } |
| 2368 | } |
| 2369 |
+65
-7
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -127,44 +127,102 @@ | ||
| 127 | 127 | |
| 128 | 128 | /* |
| 129 | 129 | ** If the "manifest" setting is true, then automatically generate |
| 130 | 130 | ** files named "manifest" and "manifest.uuid" containing, respectively, |
| 131 | 131 | ** the text of the manifest and the artifact ID of the manifest. |
| 132 | +** If the manifest setting is set, but is not a boolean value, then treat | |
| 133 | +** each character as a flag to enable writing "manifest", "manifest.uuid" or | |
| 134 | +** "manifest.tags". | |
| 132 | 135 | */ |
| 133 | 136 | void manifest_to_disk(int vid){ |
| 134 | 137 | char *zManFile; |
| 135 | 138 | Blob manifest; |
| 136 | 139 | Blob hash; |
| 140 | + Blob taglist; | |
| 141 | + int flg; | |
| 142 | + | |
| 143 | + flg = db_get_manifest_setting(); | |
| 137 | 144 | |
| 138 | - if( db_get_boolean("manifest",0) ){ | |
| 145 | + if( flg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ | |
| 139 | 146 | blob_zero(&manifest); |
| 140 | 147 | content_get(vid, &manifest); |
| 141 | - zManFile = mprintf("%smanifest", g.zLocalRoot); | |
| 142 | 148 | blob_zero(&hash); |
| 143 | 149 | sha1sum_blob(&manifest, &hash); |
| 144 | 150 | sterilize_manifest(&manifest); |
| 151 | + } | |
| 152 | + if( flg & MFESTFLG_RAW ){ | |
| 153 | + zManFile = mprintf("%smanifest", g.zLocalRoot); | |
| 145 | 154 | blob_write_to_file(&manifest, zManFile); |
| 146 | 155 | free(zManFile); |
| 147 | - zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); | |
| 148 | - blob_append(&hash, "\n", 1); | |
| 149 | - blob_write_to_file(&hash, zManFile); | |
| 150 | - free(zManFile); | |
| 151 | - blob_reset(&hash); | |
| 152 | 156 | }else{ |
| 153 | 157 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ |
| 154 | 158 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 155 | 159 | file_delete(zManFile); |
| 156 | 160 | free(zManFile); |
| 157 | 161 | } |
| 162 | + } | |
| 163 | + if( flg & MFESTFLG_UUID ){ | |
| 164 | + zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); | |
| 165 | + blob_append(&hash, "\n", 1); | |
| 166 | + blob_write_to_file(&hash, zManFile); | |
| 167 | + free(zManFile); | |
| 168 | + blob_reset(&hash); | |
| 169 | + }else{ | |
| 158 | 170 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){ |
| 159 | 171 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 160 | 172 | file_delete(zManFile); |
| 161 | 173 | free(zManFile); |
| 162 | 174 | } |
| 163 | 175 | } |
| 176 | + if( flg & MFESTFLG_TAGS ){ | |
| 177 | + blob_zero(&taglist); | |
| 178 | + zManFile = mprintf("%smanifest.tags", g.zLocalRoot); | |
| 179 | + get_checkin_taglist(vid, &taglist); | |
| 180 | + blob_write_to_file(&taglist, zManFile); | |
| 181 | + free(zManFile); | |
| 182 | + blob_reset(&taglist); | |
| 183 | + }else{ | |
| 184 | + if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.tags'") ){ | |
| 185 | + zManFile = mprintf("%smanifest.tags", g.zLocalRoot); | |
| 186 | + file_delete(zManFile); | |
| 187 | + free(zManFile); | |
| 188 | + } | |
| 189 | + } | |
| 190 | +} | |
| 164 | 191 | |
| 192 | +/* | |
| 193 | +** Find the branch name and all symbolic tags for a particular check-in | |
| 194 | +** identified by "rid". | |
| 195 | +** | |
| 196 | +** The branch name is actually only extracted if this procedure is run | |
| 197 | +** from within a local check-out. And the branch name is not the branch | |
| 198 | +** name for "rid" but rather the branch name for the current check-out. | |
| 199 | +** It is unclear if the rid parameter is always the same as the current | |
| 200 | +** check-out. | |
| 201 | +*/ | |
| 202 | +void get_checkin_taglist(int rid, Blob *pOut){ | |
| 203 | + Stmt stmt; | |
| 204 | + char *zCurrent; | |
| 205 | + blob_reset(pOut); | |
| 206 | + zCurrent = db_text(0, "SELECT value FROM tagxref" | |
| 207 | + " WHERE rid=%d AND tagid=%d", rid, TAG_BRANCH); | |
| 208 | + blob_appendf(pOut, "branch %s\n", zCurrent); | |
| 209 | + db_prepare(&stmt, "SELECT substr(tagname, 5)" | |
| 210 | + " FROM tagxref, tag" | |
| 211 | + " WHERE tagxref.rid=%d" | |
| 212 | + " AND tagxref.tagtype>0" | |
| 213 | + " AND tag.tagid=tagxref.tagid" | |
| 214 | + " AND tag.tagname GLOB 'sym-*'", rid); | |
| 215 | + while( db_step(&stmt)==SQLITE_ROW ){ | |
| 216 | + const char *zName; | |
| 217 | + zName = db_column_text(&stmt, 0); | |
| 218 | + blob_appendf(pOut, "tag %s\n", zName); | |
| 219 | + } | |
| 220 | + db_reset(&stmt); | |
| 221 | + db_finalize(&stmt); | |
| 165 | 222 | } |
| 223 | + | |
| 166 | 224 | |
| 167 | 225 | /* |
| 168 | 226 | ** COMMAND: checkout* |
| 169 | 227 | ** COMMAND: co* |
| 170 | 228 | ** |
| 171 | 229 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -127,44 +127,102 @@ | |
| 127 | |
| 128 | /* |
| 129 | ** If the "manifest" setting is true, then automatically generate |
| 130 | ** files named "manifest" and "manifest.uuid" containing, respectively, |
| 131 | ** the text of the manifest and the artifact ID of the manifest. |
| 132 | */ |
| 133 | void manifest_to_disk(int vid){ |
| 134 | char *zManFile; |
| 135 | Blob manifest; |
| 136 | Blob hash; |
| 137 | |
| 138 | if( db_get_boolean("manifest",0) ){ |
| 139 | blob_zero(&manifest); |
| 140 | content_get(vid, &manifest); |
| 141 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 142 | blob_zero(&hash); |
| 143 | sha1sum_blob(&manifest, &hash); |
| 144 | sterilize_manifest(&manifest); |
| 145 | blob_write_to_file(&manifest, zManFile); |
| 146 | free(zManFile); |
| 147 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 148 | blob_append(&hash, "\n", 1); |
| 149 | blob_write_to_file(&hash, zManFile); |
| 150 | free(zManFile); |
| 151 | blob_reset(&hash); |
| 152 | }else{ |
| 153 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ |
| 154 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 155 | file_delete(zManFile); |
| 156 | free(zManFile); |
| 157 | } |
| 158 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){ |
| 159 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 160 | file_delete(zManFile); |
| 161 | free(zManFile); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | } |
| 166 | |
| 167 | /* |
| 168 | ** COMMAND: checkout* |
| 169 | ** COMMAND: co* |
| 170 | ** |
| 171 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -127,44 +127,102 @@ | |
| 127 | |
| 128 | /* |
| 129 | ** If the "manifest" setting is true, then automatically generate |
| 130 | ** files named "manifest" and "manifest.uuid" containing, respectively, |
| 131 | ** the text of the manifest and the artifact ID of the manifest. |
| 132 | ** If the manifest setting is set, but is not a boolean value, then treat |
| 133 | ** each character as a flag to enable writing "manifest", "manifest.uuid" or |
| 134 | ** "manifest.tags". |
| 135 | */ |
| 136 | void manifest_to_disk(int vid){ |
| 137 | char *zManFile; |
| 138 | Blob manifest; |
| 139 | Blob hash; |
| 140 | Blob taglist; |
| 141 | int flg; |
| 142 | |
| 143 | flg = db_get_manifest_setting(); |
| 144 | |
| 145 | if( flg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ |
| 146 | blob_zero(&manifest); |
| 147 | content_get(vid, &manifest); |
| 148 | blob_zero(&hash); |
| 149 | sha1sum_blob(&manifest, &hash); |
| 150 | sterilize_manifest(&manifest); |
| 151 | } |
| 152 | if( flg & MFESTFLG_RAW ){ |
| 153 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 154 | blob_write_to_file(&manifest, zManFile); |
| 155 | free(zManFile); |
| 156 | }else{ |
| 157 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){ |
| 158 | zManFile = mprintf("%smanifest", g.zLocalRoot); |
| 159 | file_delete(zManFile); |
| 160 | free(zManFile); |
| 161 | } |
| 162 | } |
| 163 | if( flg & MFESTFLG_UUID ){ |
| 164 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 165 | blob_append(&hash, "\n", 1); |
| 166 | blob_write_to_file(&hash, zManFile); |
| 167 | free(zManFile); |
| 168 | blob_reset(&hash); |
| 169 | }else{ |
| 170 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){ |
| 171 | zManFile = mprintf("%smanifest.uuid", g.zLocalRoot); |
| 172 | file_delete(zManFile); |
| 173 | free(zManFile); |
| 174 | } |
| 175 | } |
| 176 | if( flg & MFESTFLG_TAGS ){ |
| 177 | blob_zero(&taglist); |
| 178 | zManFile = mprintf("%smanifest.tags", g.zLocalRoot); |
| 179 | get_checkin_taglist(vid, &taglist); |
| 180 | blob_write_to_file(&taglist, zManFile); |
| 181 | free(zManFile); |
| 182 | blob_reset(&taglist); |
| 183 | }else{ |
| 184 | if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.tags'") ){ |
| 185 | zManFile = mprintf("%smanifest.tags", g.zLocalRoot); |
| 186 | file_delete(zManFile); |
| 187 | free(zManFile); |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | /* |
| 193 | ** Find the branch name and all symbolic tags for a particular check-in |
| 194 | ** identified by "rid". |
| 195 | ** |
| 196 | ** The branch name is actually only extracted if this procedure is run |
| 197 | ** from within a local check-out. And the branch name is not the branch |
| 198 | ** name for "rid" but rather the branch name for the current check-out. |
| 199 | ** It is unclear if the rid parameter is always the same as the current |
| 200 | ** check-out. |
| 201 | */ |
| 202 | void get_checkin_taglist(int rid, Blob *pOut){ |
| 203 | Stmt stmt; |
| 204 | char *zCurrent; |
| 205 | blob_reset(pOut); |
| 206 | zCurrent = db_text(0, "SELECT value FROM tagxref" |
| 207 | " WHERE rid=%d AND tagid=%d", rid, TAG_BRANCH); |
| 208 | blob_appendf(pOut, "branch %s\n", zCurrent); |
| 209 | db_prepare(&stmt, "SELECT substr(tagname, 5)" |
| 210 | " FROM tagxref, tag" |
| 211 | " WHERE tagxref.rid=%d" |
| 212 | " AND tagxref.tagtype>0" |
| 213 | " AND tag.tagid=tagxref.tagid" |
| 214 | " AND tag.tagname GLOB 'sym-*'", rid); |
| 215 | while( db_step(&stmt)==SQLITE_ROW ){ |
| 216 | const char *zName; |
| 217 | zName = db_column_text(&stmt, 0); |
| 218 | blob_appendf(pOut, "tag %s\n", zName); |
| 219 | } |
| 220 | db_reset(&stmt); |
| 221 | db_finalize(&stmt); |
| 222 | } |
| 223 | |
| 224 | |
| 225 | /* |
| 226 | ** COMMAND: checkout* |
| 227 | ** COMMAND: co* |
| 228 | ** |
| 229 |
M
src/db.c
+43
-4
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -2270,10 +2270,46 @@ | ||
| 2270 | 2270 | return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName); |
| 2271 | 2271 | } |
| 2272 | 2272 | void db_lset_int(const char *zName, int value){ |
| 2273 | 2273 | db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value); |
| 2274 | 2274 | } |
| 2275 | + | |
| 2276 | +#if INTERFACE | |
| 2277 | +/* Manifest generation flags */ | |
| 2278 | +#define MFESTFLG_RAW 0x01 | |
| 2279 | +#define MFESTFLG_UUID 0x02 | |
| 2280 | +#define MFESTFLG_TAGS 0x04 | |
| 2281 | +#endif /* INTERFACE */ | |
| 2282 | + | |
| 2283 | +/* | |
| 2284 | +** Get the manifest setting. For backwards compatibility first check if the | |
| 2285 | +** value is a boolean. If it's not a boolean, treat each character as a flag | |
| 2286 | +** to enable a manifest type. This system puts certain boundary conditions on | |
| 2287 | +** which letters can be used to represent flags (any permutation of flags must | |
| 2288 | +** not be able to fully form one of the boolean values). | |
| 2289 | +*/ | |
| 2290 | +int db_get_manifest_setting(void){ | |
| 2291 | + int flg; | |
| 2292 | + char *zNVVal = db_get("manifest", "off"); | |
| 2293 | + char *zVal = db_get_versioned("manifest", zNVVal); | |
| 2294 | + if( is_false(zVal) ){ | |
| 2295 | + return 0; | |
| 2296 | + }else if( is_truth(zVal) ) { | |
| 2297 | + return MFESTFLG_RAW|MFESTFLG_UUID; | |
| 2298 | + } | |
| 2299 | + flg = 0; | |
| 2300 | + while( *zVal ){ | |
| 2301 | + switch( *zVal ){ | |
| 2302 | + case 'r': flg |= MFESTFLG_RAW; break; | |
| 2303 | + case 'u': flg |= MFESTFLG_UUID; break; | |
| 2304 | + case 't': flg |= MFESTFLG_TAGS; break; | |
| 2305 | + } | |
| 2306 | + zVal++; | |
| 2307 | + } | |
| 2308 | + return flg; | |
| 2309 | +} | |
| 2310 | + | |
| 2275 | 2311 | |
| 2276 | 2312 | /* |
| 2277 | 2313 | ** Record the name of a local repository in the global_config() database. |
| 2278 | 2314 | ** The repository filename %s is recorded as an entry with a "name" field |
| 2279 | 2315 | ** of the following form: |
| @@ -2570,11 +2606,11 @@ | ||
| 2570 | 2606 | { "https-login", 0, 0, 0, 0, "off" }, |
| 2571 | 2607 | { "ignore-glob", 0, 40, 1, 0, "" }, |
| 2572 | 2608 | { "keep-glob", 0, 40, 1, 0, "" }, |
| 2573 | 2609 | { "localauth", 0, 0, 0, 0, "off" }, |
| 2574 | 2610 | { "main-branch", 0, 40, 0, 0, "trunk" }, |
| 2575 | - { "manifest", 0, 0, 1, 0, "off" }, | |
| 2611 | + { "manifest", 0, 5, 0, 0, "off" }, | |
| 2576 | 2612 | { "max-loadavg", 0, 25, 0, 0, "0.0" }, |
| 2577 | 2613 | { "max-upload", 0, 25, 0, 0, "250000" }, |
| 2578 | 2614 | { "mtime-changes", 0, 0, 0, 0, "on" }, |
| 2579 | 2615 | #if FOSSIL_ENABLE_LEGACY_MV_RM |
| 2580 | 2616 | { "mv-rm-files", 0, 0, 0, 0, "off" }, |
| @@ -2775,13 +2811,16 @@ | ||
| 2775 | 2811 | ** false, all HTTP requests from localhost have |
| 2776 | 2812 | ** unrestricted access to the repository. |
| 2777 | 2813 | ** |
| 2778 | 2814 | ** main-branch The primary branch for the project. Default: trunk |
| 2779 | 2815 | ** |
| 2780 | -** manifest If enabled, automatically create files "manifest" and | |
| 2781 | -** (versionable) "manifest.uuid" in every checkout. The SQLite and | |
| 2782 | -** Fossil repositories both require this. Default: off. | |
| 2816 | +** manifest If set to a true boolean value, automatically create | |
| 2817 | +** (versionable) files "manifest" and "manifest.uuid" in every checkout. | |
| 2818 | +** Optionally use combinations of characters 'r' | |
| 2819 | +** for "manifest", 'u' for "manifest.uuid" and 't' for | |
| 2820 | +** "manifest.tags". The SQLite and Fossil repositories | |
| 2821 | +** both require manifests. Default: off. | |
| 2783 | 2822 | ** |
| 2784 | 2823 | ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame) |
| 2785 | 2824 | ** are disallowed if the system load average goes above this |
| 2786 | 2825 | ** value. "0.0" means no limit. This only works on unix. |
| 2787 | 2826 | ** Only local settings of this value make a difference since |
| 2788 | 2827 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2270,10 +2270,46 @@ | |
| 2270 | return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName); |
| 2271 | } |
| 2272 | void db_lset_int(const char *zName, int value){ |
| 2273 | db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value); |
| 2274 | } |
| 2275 | |
| 2276 | /* |
| 2277 | ** Record the name of a local repository in the global_config() database. |
| 2278 | ** The repository filename %s is recorded as an entry with a "name" field |
| 2279 | ** of the following form: |
| @@ -2570,11 +2606,11 @@ | |
| 2570 | { "https-login", 0, 0, 0, 0, "off" }, |
| 2571 | { "ignore-glob", 0, 40, 1, 0, "" }, |
| 2572 | { "keep-glob", 0, 40, 1, 0, "" }, |
| 2573 | { "localauth", 0, 0, 0, 0, "off" }, |
| 2574 | { "main-branch", 0, 40, 0, 0, "trunk" }, |
| 2575 | { "manifest", 0, 0, 1, 0, "off" }, |
| 2576 | { "max-loadavg", 0, 25, 0, 0, "0.0" }, |
| 2577 | { "max-upload", 0, 25, 0, 0, "250000" }, |
| 2578 | { "mtime-changes", 0, 0, 0, 0, "on" }, |
| 2579 | #if FOSSIL_ENABLE_LEGACY_MV_RM |
| 2580 | { "mv-rm-files", 0, 0, 0, 0, "off" }, |
| @@ -2775,13 +2811,16 @@ | |
| 2775 | ** false, all HTTP requests from localhost have |
| 2776 | ** unrestricted access to the repository. |
| 2777 | ** |
| 2778 | ** main-branch The primary branch for the project. Default: trunk |
| 2779 | ** |
| 2780 | ** manifest If enabled, automatically create files "manifest" and |
| 2781 | ** (versionable) "manifest.uuid" in every checkout. The SQLite and |
| 2782 | ** Fossil repositories both require this. Default: off. |
| 2783 | ** |
| 2784 | ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame) |
| 2785 | ** are disallowed if the system load average goes above this |
| 2786 | ** value. "0.0" means no limit. This only works on unix. |
| 2787 | ** Only local settings of this value make a difference since |
| 2788 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -2270,10 +2270,46 @@ | |
| 2270 | return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName); |
| 2271 | } |
| 2272 | void db_lset_int(const char *zName, int value){ |
| 2273 | db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value); |
| 2274 | } |
| 2275 | |
| 2276 | #if INTERFACE |
| 2277 | /* Manifest generation flags */ |
| 2278 | #define MFESTFLG_RAW 0x01 |
| 2279 | #define MFESTFLG_UUID 0x02 |
| 2280 | #define MFESTFLG_TAGS 0x04 |
| 2281 | #endif /* INTERFACE */ |
| 2282 | |
| 2283 | /* |
| 2284 | ** Get the manifest setting. For backwards compatibility first check if the |
| 2285 | ** value is a boolean. If it's not a boolean, treat each character as a flag |
| 2286 | ** to enable a manifest type. This system puts certain boundary conditions on |
| 2287 | ** which letters can be used to represent flags (any permutation of flags must |
| 2288 | ** not be able to fully form one of the boolean values). |
| 2289 | */ |
| 2290 | int db_get_manifest_setting(void){ |
| 2291 | int flg; |
| 2292 | char *zNVVal = db_get("manifest", "off"); |
| 2293 | char *zVal = db_get_versioned("manifest", zNVVal); |
| 2294 | if( is_false(zVal) ){ |
| 2295 | return 0; |
| 2296 | }else if( is_truth(zVal) ) { |
| 2297 | return MFESTFLG_RAW|MFESTFLG_UUID; |
| 2298 | } |
| 2299 | flg = 0; |
| 2300 | while( *zVal ){ |
| 2301 | switch( *zVal ){ |
| 2302 | case 'r': flg |= MFESTFLG_RAW; break; |
| 2303 | case 'u': flg |= MFESTFLG_UUID; break; |
| 2304 | case 't': flg |= MFESTFLG_TAGS; break; |
| 2305 | } |
| 2306 | zVal++; |
| 2307 | } |
| 2308 | return flg; |
| 2309 | } |
| 2310 | |
| 2311 | |
| 2312 | /* |
| 2313 | ** Record the name of a local repository in the global_config() database. |
| 2314 | ** The repository filename %s is recorded as an entry with a "name" field |
| 2315 | ** of the following form: |
| @@ -2570,11 +2606,11 @@ | |
| 2606 | { "https-login", 0, 0, 0, 0, "off" }, |
| 2607 | { "ignore-glob", 0, 40, 1, 0, "" }, |
| 2608 | { "keep-glob", 0, 40, 1, 0, "" }, |
| 2609 | { "localauth", 0, 0, 0, 0, "off" }, |
| 2610 | { "main-branch", 0, 40, 0, 0, "trunk" }, |
| 2611 | { "manifest", 0, 5, 0, 0, "off" }, |
| 2612 | { "max-loadavg", 0, 25, 0, 0, "0.0" }, |
| 2613 | { "max-upload", 0, 25, 0, 0, "250000" }, |
| 2614 | { "mtime-changes", 0, 0, 0, 0, "on" }, |
| 2615 | #if FOSSIL_ENABLE_LEGACY_MV_RM |
| 2616 | { "mv-rm-files", 0, 0, 0, 0, "off" }, |
| @@ -2775,13 +2811,16 @@ | |
| 2811 | ** false, all HTTP requests from localhost have |
| 2812 | ** unrestricted access to the repository. |
| 2813 | ** |
| 2814 | ** main-branch The primary branch for the project. Default: trunk |
| 2815 | ** |
| 2816 | ** manifest If set to a true boolean value, automatically create |
| 2817 | ** (versionable) files "manifest" and "manifest.uuid" in every checkout. |
| 2818 | ** Optionally use combinations of characters 'r' |
| 2819 | ** for "manifest", 'u' for "manifest.uuid" and 't' for |
| 2820 | ** "manifest.tags". The SQLite and Fossil repositories |
| 2821 | ** both require manifests. Default: off. |
| 2822 | ** |
| 2823 | ** max-loadavg Some CPU-intensive web pages (ex: /zip, /tarball, /blame) |
| 2824 | ** are disallowed if the system load average goes above this |
| 2825 | ** value. "0.0" means no limit. This only works on unix. |
| 2826 | ** Only local settings of this value make a difference since |
| 2827 |
+1
| --- src/tag.c | ||
| +++ src/tag.c | ||
| @@ -359,10 +359,11 @@ | ||
| 359 | 359 | }else{ |
| 360 | 360 | nrid = content_put(&ctrl); |
| 361 | 361 | manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); |
| 362 | 362 | } |
| 363 | 363 | assert( blob_is_reset(&ctrl) ); |
| 364 | + manifest_to_disk(rid); | |
| 364 | 365 | } |
| 365 | 366 | |
| 366 | 367 | /* |
| 367 | 368 | ** COMMAND: tag |
| 368 | 369 | ** |
| 369 | 370 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -359,10 +359,11 @@ | |
| 359 | }else{ |
| 360 | nrid = content_put(&ctrl); |
| 361 | manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); |
| 362 | } |
| 363 | assert( blob_is_reset(&ctrl) ); |
| 364 | } |
| 365 | |
| 366 | /* |
| 367 | ** COMMAND: tag |
| 368 | ** |
| 369 |
| --- src/tag.c | |
| +++ src/tag.c | |
| @@ -359,10 +359,11 @@ | |
| 359 | }else{ |
| 360 | nrid = content_put(&ctrl); |
| 361 | manifest_crosslink(nrid, &ctrl, MC_PERMIT_HOOKS); |
| 362 | } |
| 363 | assert( blob_is_reset(&ctrl) ); |
| 364 | manifest_to_disk(rid); |
| 365 | } |
| 366 | |
| 367 | /* |
| 368 | ** COMMAND: tag |
| 369 | ** |
| 370 |
+51
-15
| --- src/tar.c | ||
| +++ src/tar.c | ||
| @@ -493,28 +493,64 @@ | ||
| 493 | 493 | } |
| 494 | 494 | nPrefix = blob_size(&filename); |
| 495 | 495 | |
| 496 | 496 | pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 497 | 497 | if( pManifest ){ |
| 498 | + int flg, eflg = 0; | |
| 498 | 499 | mTime = (pManifest->rDate - 2440587.5)*86400.0; |
| 499 | 500 | tar_begin(mTime); |
| 500 | - if( (pInclude==0 || glob_match(pInclude, "manifest")) | |
| 501 | - && !glob_match(pExclude, "manifest") | |
| 502 | - && db_get_boolean("manifest", 0) | |
| 503 | - ){ | |
| 504 | - blob_append(&filename, "manifest", -1); | |
| 505 | - zName = blob_str(&filename); | |
| 506 | - sha1sum_blob(&mfile, &hash); | |
| 507 | - sterilize_manifest(&mfile); | |
| 508 | - tar_add_file(zName, &mfile, 0, mTime); | |
| 501 | + flg = db_get_manifest_setting(); | |
| 502 | + if( flg ){ | |
| 503 | + /* eflg is the effective flags, taking include/exclude into account */ | |
| 504 | + if( (pInclude==0 || glob_match(pInclude, "manifest")) | |
| 505 | + && !glob_match(pExclude, "manifest") | |
| 506 | + && (flg & MFESTFLG_RAW) ){ | |
| 507 | + eflg |= MFESTFLG_RAW; | |
| 508 | + } | |
| 509 | + if( (pInclude==0 || glob_match(pInclude, "manifest.uuid")) | |
| 510 | + && !glob_match(pExclude, "manifest.uuid") | |
| 511 | + && (flg & MFESTFLG_UUID) ){ | |
| 512 | + eflg |= MFESTFLG_UUID; | |
| 513 | + } | |
| 514 | + if( (pInclude==0 || glob_match(pInclude, "manifest.tags")) | |
| 515 | + && !glob_match(pExclude, "manifest.tags") | |
| 516 | + && (flg & MFESTFLG_TAGS) ){ | |
| 517 | + eflg |= MFESTFLG_TAGS; | |
| 518 | + } | |
| 519 | + | |
| 520 | + if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ | |
| 521 | + if( eflg & MFESTFLG_RAW ){ | |
| 522 | + blob_append(&filename, "manifest", -1); | |
| 523 | + zName = blob_str(&filename); | |
| 524 | + } | |
| 525 | + if( eflg & MFESTFLG_UUID ){ | |
| 526 | + sha1sum_blob(&mfile, &hash); | |
| 527 | + } | |
| 528 | + if( eflg & MFESTFLG_RAW ) { | |
| 529 | + sterilize_manifest(&mfile); | |
| 530 | + tar_add_file(zName, &mfile, 0, mTime); | |
| 531 | + } | |
| 532 | + } | |
| 509 | 533 | blob_reset(&mfile); |
| 510 | - blob_append(&hash, "\n", 1); | |
| 511 | - blob_resize(&filename, nPrefix); | |
| 512 | - blob_append(&filename, "manifest.uuid", -1); | |
| 513 | - zName = blob_str(&filename); | |
| 514 | - tar_add_file(zName, &hash, 0, mTime); | |
| 515 | - blob_reset(&hash); | |
| 534 | + if( eflg & MFESTFLG_UUID ){ | |
| 535 | + blob_append(&hash, "\n", 1); | |
| 536 | + blob_resize(&filename, nPrefix); | |
| 537 | + blob_append(&filename, "manifest.uuid", -1); | |
| 538 | + zName = blob_str(&filename); | |
| 539 | + tar_add_file(zName, &hash, 0, mTime); | |
| 540 | + blob_reset(&hash); | |
| 541 | + } | |
| 542 | + if( eflg & MFESTFLG_TAGS ){ | |
| 543 | + Blob tagslist; | |
| 544 | + blob_zero(&tagslist); | |
| 545 | + get_checkin_taglist(rid, &tagslist); | |
| 546 | + blob_resize(&filename, nPrefix); | |
| 547 | + blob_append(&filename, "manifest.tags", -1); | |
| 548 | + zName = blob_str(&filename); | |
| 549 | + tar_add_file(zName, &tagslist, 0, mTime); | |
| 550 | + blob_reset(&tagslist); | |
| 551 | + } | |
| 516 | 552 | } |
| 517 | 553 | manifest_file_rewind(pManifest); |
| 518 | 554 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 519 | 555 | int fid; |
| 520 | 556 | if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue; |
| 521 | 557 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -493,28 +493,64 @@ | |
| 493 | } |
| 494 | nPrefix = blob_size(&filename); |
| 495 | |
| 496 | pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 497 | if( pManifest ){ |
| 498 | mTime = (pManifest->rDate - 2440587.5)*86400.0; |
| 499 | tar_begin(mTime); |
| 500 | if( (pInclude==0 || glob_match(pInclude, "manifest")) |
| 501 | && !glob_match(pExclude, "manifest") |
| 502 | && db_get_boolean("manifest", 0) |
| 503 | ){ |
| 504 | blob_append(&filename, "manifest", -1); |
| 505 | zName = blob_str(&filename); |
| 506 | sha1sum_blob(&mfile, &hash); |
| 507 | sterilize_manifest(&mfile); |
| 508 | tar_add_file(zName, &mfile, 0, mTime); |
| 509 | blob_reset(&mfile); |
| 510 | blob_append(&hash, "\n", 1); |
| 511 | blob_resize(&filename, nPrefix); |
| 512 | blob_append(&filename, "manifest.uuid", -1); |
| 513 | zName = blob_str(&filename); |
| 514 | tar_add_file(zName, &hash, 0, mTime); |
| 515 | blob_reset(&hash); |
| 516 | } |
| 517 | manifest_file_rewind(pManifest); |
| 518 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 519 | int fid; |
| 520 | if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue; |
| 521 |
| --- src/tar.c | |
| +++ src/tar.c | |
| @@ -493,28 +493,64 @@ | |
| 493 | } |
| 494 | nPrefix = blob_size(&filename); |
| 495 | |
| 496 | pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 497 | if( pManifest ){ |
| 498 | int flg, eflg = 0; |
| 499 | mTime = (pManifest->rDate - 2440587.5)*86400.0; |
| 500 | tar_begin(mTime); |
| 501 | flg = db_get_manifest_setting(); |
| 502 | if( flg ){ |
| 503 | /* eflg is the effective flags, taking include/exclude into account */ |
| 504 | if( (pInclude==0 || glob_match(pInclude, "manifest")) |
| 505 | && !glob_match(pExclude, "manifest") |
| 506 | && (flg & MFESTFLG_RAW) ){ |
| 507 | eflg |= MFESTFLG_RAW; |
| 508 | } |
| 509 | if( (pInclude==0 || glob_match(pInclude, "manifest.uuid")) |
| 510 | && !glob_match(pExclude, "manifest.uuid") |
| 511 | && (flg & MFESTFLG_UUID) ){ |
| 512 | eflg |= MFESTFLG_UUID; |
| 513 | } |
| 514 | if( (pInclude==0 || glob_match(pInclude, "manifest.tags")) |
| 515 | && !glob_match(pExclude, "manifest.tags") |
| 516 | && (flg & MFESTFLG_TAGS) ){ |
| 517 | eflg |= MFESTFLG_TAGS; |
| 518 | } |
| 519 | |
| 520 | if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ |
| 521 | if( eflg & MFESTFLG_RAW ){ |
| 522 | blob_append(&filename, "manifest", -1); |
| 523 | zName = blob_str(&filename); |
| 524 | } |
| 525 | if( eflg & MFESTFLG_UUID ){ |
| 526 | sha1sum_blob(&mfile, &hash); |
| 527 | } |
| 528 | if( eflg & MFESTFLG_RAW ) { |
| 529 | sterilize_manifest(&mfile); |
| 530 | tar_add_file(zName, &mfile, 0, mTime); |
| 531 | } |
| 532 | } |
| 533 | blob_reset(&mfile); |
| 534 | if( eflg & MFESTFLG_UUID ){ |
| 535 | blob_append(&hash, "\n", 1); |
| 536 | blob_resize(&filename, nPrefix); |
| 537 | blob_append(&filename, "manifest.uuid", -1); |
| 538 | zName = blob_str(&filename); |
| 539 | tar_add_file(zName, &hash, 0, mTime); |
| 540 | blob_reset(&hash); |
| 541 | } |
| 542 | if( eflg & MFESTFLG_TAGS ){ |
| 543 | Blob tagslist; |
| 544 | blob_zero(&tagslist); |
| 545 | get_checkin_taglist(rid, &tagslist); |
| 546 | blob_resize(&filename, nPrefix); |
| 547 | blob_append(&filename, "manifest.tags", -1); |
| 548 | zName = blob_str(&filename); |
| 549 | tar_add_file(zName, &tagslist, 0, mTime); |
| 550 | blob_reset(&tagslist); |
| 551 | } |
| 552 | } |
| 553 | manifest_file_rewind(pManifest); |
| 554 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 555 | int fid; |
| 556 | if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue; |
| 557 |
+54
-16
| --- src/zip.c | ||
| +++ src/zip.c | ||
| @@ -350,29 +350,67 @@ | ||
| 350 | 350 | } |
| 351 | 351 | nPrefix = blob_size(&filename); |
| 352 | 352 | |
| 353 | 353 | pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 354 | 354 | if( pManifest ){ |
| 355 | + int flg, eflg = 0; | |
| 355 | 356 | char *zName; |
| 356 | 357 | zip_set_timedate(pManifest->rDate); |
| 357 | - if( (pInclude==0 || glob_match(pInclude, "manifest")) | |
| 358 | - && !glob_match(pExclude, "manifest") | |
| 359 | - && db_get_boolean("manifest", 0) | |
| 360 | - ){ | |
| 361 | - blob_append(&filename, "manifest", -1); | |
| 362 | - zName = blob_str(&filename); | |
| 363 | - zip_add_folders(zName); | |
| 364 | - sha1sum_blob(&mfile, &hash); | |
| 365 | - sterilize_manifest(&mfile); | |
| 366 | - zip_add_file(zName, &mfile, 0); | |
| 358 | + flg = db_get_manifest_setting(); | |
| 359 | + if( flg ){ | |
| 360 | + /* eflg is the effective flags, taking include/exclude into account */ | |
| 361 | + if( (pInclude==0 || glob_match(pInclude, "manifest")) | |
| 362 | + && !glob_match(pExclude, "manifest") | |
| 363 | + && (flg & MFESTFLG_RAW) ){ | |
| 364 | + eflg |= MFESTFLG_RAW; | |
| 365 | + } | |
| 366 | + if( (pInclude==0 || glob_match(pInclude, "manifest.uuid")) | |
| 367 | + && !glob_match(pExclude, "manifest.uuid") | |
| 368 | + && (flg & MFESTFLG_UUID) ){ | |
| 369 | + eflg |= MFESTFLG_UUID; | |
| 370 | + } | |
| 371 | + if( (pInclude==0 || glob_match(pInclude, "manifest.tags")) | |
| 372 | + && !glob_match(pExclude, "manifest.tags") | |
| 373 | + && (flg & MFESTFLG_TAGS) ){ | |
| 374 | + eflg |= MFESTFLG_TAGS; | |
| 375 | + } | |
| 376 | + | |
| 377 | + if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ | |
| 378 | + if( eflg & MFESTFLG_RAW ){ | |
| 379 | + blob_append(&filename, "manifest", -1); | |
| 380 | + zName = blob_str(&filename); | |
| 381 | + zip_add_folders(zName); | |
| 382 | + } | |
| 383 | + if( eflg & MFESTFLG_UUID ){ | |
| 384 | + sha1sum_blob(&mfile, &hash); | |
| 385 | + } | |
| 386 | + if( eflg & MFESTFLG_RAW ){ | |
| 387 | + sterilize_manifest(&mfile); | |
| 388 | + zip_add_file(zName, &mfile, 0); | |
| 389 | + } | |
| 390 | + } | |
| 367 | 391 | blob_reset(&mfile); |
| 368 | - blob_append(&hash, "\n", 1); | |
| 369 | - blob_resize(&filename, nPrefix); | |
| 370 | - blob_append(&filename, "manifest.uuid", -1); | |
| 371 | - zName = blob_str(&filename); | |
| 372 | - zip_add_file(zName, &hash, 0); | |
| 373 | - blob_reset(&hash); | |
| 392 | + if( eflg & MFESTFLG_UUID ){ | |
| 393 | + blob_append(&hash, "\n", 1); | |
| 394 | + blob_resize(&filename, nPrefix); | |
| 395 | + blob_append(&filename, "manifest.uuid", -1); | |
| 396 | + zName = blob_str(&filename); | |
| 397 | + zip_add_folders(zName); | |
| 398 | + zip_add_file(zName, &hash, 0); | |
| 399 | + blob_reset(&hash); | |
| 400 | + } | |
| 401 | + if( eflg & MFESTFLG_TAGS ){ | |
| 402 | + Blob tagslist; | |
| 403 | + blob_zero(&tagslist); | |
| 404 | + get_checkin_taglist(rid, &tagslist); | |
| 405 | + blob_resize(&filename, nPrefix); | |
| 406 | + blob_append(&filename, "manifest.tags", -1); | |
| 407 | + zName = blob_str(&filename); | |
| 408 | + zip_add_folders(zName); | |
| 409 | + zip_add_file(zName, &tagslist, 0); | |
| 410 | + blob_reset(&tagslist); | |
| 411 | + } | |
| 374 | 412 | } |
| 375 | 413 | manifest_file_rewind(pManifest); |
| 376 | 414 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 377 | 415 | int fid; |
| 378 | 416 | if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue; |
| 379 | 417 | |
| 380 | 418 | ADDED test/set-manifest.test |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -350,29 +350,67 @@ | |
| 350 | } |
| 351 | nPrefix = blob_size(&filename); |
| 352 | |
| 353 | pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 354 | if( pManifest ){ |
| 355 | char *zName; |
| 356 | zip_set_timedate(pManifest->rDate); |
| 357 | if( (pInclude==0 || glob_match(pInclude, "manifest")) |
| 358 | && !glob_match(pExclude, "manifest") |
| 359 | && db_get_boolean("manifest", 0) |
| 360 | ){ |
| 361 | blob_append(&filename, "manifest", -1); |
| 362 | zName = blob_str(&filename); |
| 363 | zip_add_folders(zName); |
| 364 | sha1sum_blob(&mfile, &hash); |
| 365 | sterilize_manifest(&mfile); |
| 366 | zip_add_file(zName, &mfile, 0); |
| 367 | blob_reset(&mfile); |
| 368 | blob_append(&hash, "\n", 1); |
| 369 | blob_resize(&filename, nPrefix); |
| 370 | blob_append(&filename, "manifest.uuid", -1); |
| 371 | zName = blob_str(&filename); |
| 372 | zip_add_file(zName, &hash, 0); |
| 373 | blob_reset(&hash); |
| 374 | } |
| 375 | manifest_file_rewind(pManifest); |
| 376 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 377 | int fid; |
| 378 | if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue; |
| 379 | |
| 380 | DDED test/set-manifest.test |
| --- src/zip.c | |
| +++ src/zip.c | |
| @@ -350,29 +350,67 @@ | |
| 350 | } |
| 351 | nPrefix = blob_size(&filename); |
| 352 | |
| 353 | pManifest = manifest_get(rid, CFTYPE_MANIFEST, 0); |
| 354 | if( pManifest ){ |
| 355 | int flg, eflg = 0; |
| 356 | char *zName; |
| 357 | zip_set_timedate(pManifest->rDate); |
| 358 | flg = db_get_manifest_setting(); |
| 359 | if( flg ){ |
| 360 | /* eflg is the effective flags, taking include/exclude into account */ |
| 361 | if( (pInclude==0 || glob_match(pInclude, "manifest")) |
| 362 | && !glob_match(pExclude, "manifest") |
| 363 | && (flg & MFESTFLG_RAW) ){ |
| 364 | eflg |= MFESTFLG_RAW; |
| 365 | } |
| 366 | if( (pInclude==0 || glob_match(pInclude, "manifest.uuid")) |
| 367 | && !glob_match(pExclude, "manifest.uuid") |
| 368 | && (flg & MFESTFLG_UUID) ){ |
| 369 | eflg |= MFESTFLG_UUID; |
| 370 | } |
| 371 | if( (pInclude==0 || glob_match(pInclude, "manifest.tags")) |
| 372 | && !glob_match(pExclude, "manifest.tags") |
| 373 | && (flg & MFESTFLG_TAGS) ){ |
| 374 | eflg |= MFESTFLG_TAGS; |
| 375 | } |
| 376 | |
| 377 | if( eflg & (MFESTFLG_RAW|MFESTFLG_UUID) ){ |
| 378 | if( eflg & MFESTFLG_RAW ){ |
| 379 | blob_append(&filename, "manifest", -1); |
| 380 | zName = blob_str(&filename); |
| 381 | zip_add_folders(zName); |
| 382 | } |
| 383 | if( eflg & MFESTFLG_UUID ){ |
| 384 | sha1sum_blob(&mfile, &hash); |
| 385 | } |
| 386 | if( eflg & MFESTFLG_RAW ){ |
| 387 | sterilize_manifest(&mfile); |
| 388 | zip_add_file(zName, &mfile, 0); |
| 389 | } |
| 390 | } |
| 391 | blob_reset(&mfile); |
| 392 | if( eflg & MFESTFLG_UUID ){ |
| 393 | blob_append(&hash, "\n", 1); |
| 394 | blob_resize(&filename, nPrefix); |
| 395 | blob_append(&filename, "manifest.uuid", -1); |
| 396 | zName = blob_str(&filename); |
| 397 | zip_add_folders(zName); |
| 398 | zip_add_file(zName, &hash, 0); |
| 399 | blob_reset(&hash); |
| 400 | } |
| 401 | if( eflg & MFESTFLG_TAGS ){ |
| 402 | Blob tagslist; |
| 403 | blob_zero(&tagslist); |
| 404 | get_checkin_taglist(rid, &tagslist); |
| 405 | blob_resize(&filename, nPrefix); |
| 406 | blob_append(&filename, "manifest.tags", -1); |
| 407 | zName = blob_str(&filename); |
| 408 | zip_add_folders(zName); |
| 409 | zip_add_file(zName, &tagslist, 0); |
| 410 | blob_reset(&tagslist); |
| 411 | } |
| 412 | } |
| 413 | manifest_file_rewind(pManifest); |
| 414 | while( (pFile = manifest_file_next(pManifest,0))!=0 ){ |
| 415 | int fid; |
| 416 | if( pInclude!=0 && !glob_match(pInclude, pFile->zName) ) continue; |
| 417 | |
| 418 | DDED test/set-manifest.test |
+113
| --- a/test/set-manifest.test | ||
| +++ b/test/set-manifest.test | ||
| @@ -0,0 +1,113 @@ | ||
| 1 | +# | |
| 2 | +# Copyright (c) 2016 D. Richard Hipp | |
| 3 | +# | |
| 4 | +# This program is free software; you can redistribute it and/or | |
| 5 | +# modify it under the terms of the Simplified BSD License (also | |
| 6 | +# known as the "2-Clause License" or "FreeBSD License".) | |
| 7 | +# | |
| 8 | +# This program is distributed in the hope that it will be useful, | |
| 9 | +# but without any warranty; without even the implied warranty of | |
| 10 | +# merchantability or fitness for a particular purpose. | |
| 11 | +# | |
| 12 | +# Author contact information: | |
| 13 | +# [email protected] | |
| 14 | +# http://www.hwaci.com/drh/ | |
| 15 | +# | |
| 16 | +############################################################################ | |
| 17 | +# | |
| 18 | +# Test manifest setting | |
| 19 | +# | |
| 20 | + | |
| 21 | +t (c) 2016 D. Richard Hipp | |
| 22 | +# | |
| 23 | +# This program is free software; you can redistribute it and/or | |
| 24 | +# modify it under the terms of the Simplified BSD License (also | |
| 25 | +# known as the "2-Clause License" or "FreeBSD License".) | |
| 26 | +# | |
| 27 | +# T# | |
| 28 | +# Copyright (c) 20 | |
| 29 | + | |
| 30 | +proc file_contains {fname match} { | |
| 31 | + set fp [open $fname r] | |
| 32 | + set contents [read $fp] | |
| 33 | + close $fp | |
| 34 | + set lines [split $contents "\n"] | |
| 35 | + foreach line $lines { | |
| 36 | + if {[regexp $match $line]} { | |
| 37 | + return 1 | |
| 38 | + } | |
| 39 | + } | |
| 40 | + return 0 | |
| 41 | +} | |
| 42 | + | |
| 43 | +# We need SHA1 to effectively test the manifest files produced by | |
| 44 | +# fossil. It looks like the one from tcllib is exactly what we need. | |
| 45 | +# On ActiveTcl, add it with teacup. On other platforms, YMMV. | |
| 46 | +# teacup install sha1 | |
| 47 | +if {[catch {package require sha1}] != 0} then { | |
| 48 | + puts "The \"sha1\" package is not available." | |
| 49 | + test_cleanup_then_return | |
| 50 | +} | |
| 51 | + | |
| 52 | +# We need a respository, so let it have one. | |
| 53 | +test_setup | |
| 54 | + | |
| 55 | +#### Verify classic behavior of the manifest setting | |
| 56 | + | |
| 57 | +# Setting is off by default, and there are no extra files. | |
| 58 | +fossil settings manifest | |
| 59 | +test "set-manifest-1" {[regexp {^manifest *$} $RESULT]} | |
| 60 | +set filelist [$v" {$RESULT eq ""} | |
| 61 | + fossi D. Richard Hipp | |
| 62 | +# | |
| 63 | +# This program is free software; you can redistribute it and/or | |
| 64 | +# modify it under the terms of the Simplified BSD License (also | |
| 65 | +# known as the "2-Clause License" or "FreeBSD License".) | |
| 66 | +# | |
| 67 | +# This program is distributed in the hope that it will be useful, | |
| 68 | +# buithout any warranty; without even the implied warranty of | |
| 69 | +# mer# | |
| 70 | +# Copyright manifes$ckid eq $uuid} foreach f $filelist { | |
| 71 | + test "set-manifest-2-$v-f-$f" {[file isfile $f]} | |
| 72 | + } | |
| 73 | +} | |
| 74 | + | |
| 75 | +# ... and manifest.uuid is the checkout's hash | |
| 76 | +fossil info | |
| 77 | +regexp {(?m)^checkout:\s+([0-9a-f]{40,64})\s.*$} $RESULT ckoutline ckid | |
| 78 | +set uuid [string trim [read_file "manifest.uuid"]] | |
| 79 | +test "set-manifest-2-uuid" {[same_uuid $ckid $uuid]} | |
| 80 | + | |
| 81 | + | |
| 82 | +# ... which is also the SHA1 of the file "manifest" before it was | |
| 83 | +#License" or "FreeBSD License0 | |
| 84 | + | |
| 85 | +proc file_contains {fname match}e "manifest"] "" ma2-manifest" {$muuid eq $uuidequire sha1}] != 0} then close $fp | |
| 86 | + set lines [split $contents "\n"] | |
| 87 | + foreach line $lines { | |
| 88 | + if {[regexp $match $line]} { | |
| 89 | + return 1 | |
| 90 | + } | |
| 91 | + } | |
| 92 | + return 0 | |
| 93 | +} | |
| 94 | + | |
| 95 | +# We need SHA1 to effectively test the manifest files produced by | |
| 96 | +# fossil. It looks like the one from tcllib is exactly what we need. | |
| 97 | +# On ActiveTcl, add it with teacup. On other platforms, YMMV. | |
| 98 | +# teacup install sha1 | |
| 99 | +if {[catch {package require sha1}] != 0} then { | |
| 100 | + puts "The \"sha1\" package is not available." | |
| 101 | + test_cleanup_then_return | |
| 102 | +} | |
| 103 | + | |
| 104 | +# We need a respository, so let it have one. | |
| 105 | +test_setup | |
| 106 | + | |
| 107 | +#### Verify classic behavior of the manifest setting | |
| 108 | + | |
| 109 | +# Setting is off by default, and there are no extra files. | |
| 110 | +fossil settings manifest | |
| 111 | +test "set-manifest-1" {[regexp {^manifest *$} $RESULT]} | |
| 112 | +set filelist [$v" {$RESULT eq ""} | |
| 113 | + fossi D. R |
| --- a/test/set-manifest.test | |
| +++ b/test/set-manifest.test | |
| @@ -0,0 +1,113 @@ | |
| --- a/test/set-manifest.test | |
| +++ b/test/set-manifest.test | |
| @@ -0,0 +1,113 @@ | |
| 1 | # |
| 2 | # Copyright (c) 2016 D. Richard Hipp |
| 3 | # |
| 4 | # This program is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the Simplified BSD License (also |
| 6 | # known as the "2-Clause License" or "FreeBSD License".) |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, |
| 9 | # but without any warranty; without even the implied warranty of |
| 10 | # merchantability or fitness for a particular purpose. |
| 11 | # |
| 12 | # Author contact information: |
| 13 | # [email protected] |
| 14 | # http://www.hwaci.com/drh/ |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test manifest setting |
| 19 | # |
| 20 | |
| 21 | t (c) 2016 D. Richard Hipp |
| 22 | # |
| 23 | # This program is free software; you can redistribute it and/or |
| 24 | # modify it under the terms of the Simplified BSD License (also |
| 25 | # known as the "2-Clause License" or "FreeBSD License".) |
| 26 | # |
| 27 | # T# |
| 28 | # Copyright (c) 20 |
| 29 | |
| 30 | proc file_contains {fname match} { |
| 31 | set fp [open $fname r] |
| 32 | set contents [read $fp] |
| 33 | close $fp |
| 34 | set lines [split $contents "\n"] |
| 35 | foreach line $lines { |
| 36 | if {[regexp $match $line]} { |
| 37 | return 1 |
| 38 | } |
| 39 | } |
| 40 | return 0 |
| 41 | } |
| 42 | |
| 43 | # We need SHA1 to effectively test the manifest files produced by |
| 44 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 45 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| 46 | # teacup install sha1 |
| 47 | if {[catch {package require sha1}] != 0} then { |
| 48 | puts "The \"sha1\" package is not available." |
| 49 | test_cleanup_then_return |
| 50 | } |
| 51 | |
| 52 | # We need a respository, so let it have one. |
| 53 | test_setup |
| 54 | |
| 55 | #### Verify classic behavior of the manifest setting |
| 56 | |
| 57 | # Setting is off by default, and there are no extra files. |
| 58 | fossil settings manifest |
| 59 | test "set-manifest-1" {[regexp {^manifest *$} $RESULT]} |
| 60 | set filelist [$v" {$RESULT eq ""} |
| 61 | fossi D. Richard Hipp |
| 62 | # |
| 63 | # This program is free software; you can redistribute it and/or |
| 64 | # modify it under the terms of the Simplified BSD License (also |
| 65 | # known as the "2-Clause License" or "FreeBSD License".) |
| 66 | # |
| 67 | # This program is distributed in the hope that it will be useful, |
| 68 | # buithout any warranty; without even the implied warranty of |
| 69 | # mer# |
| 70 | # Copyright manifes$ckid eq $uuid} foreach f $filelist { |
| 71 | test "set-manifest-2-$v-f-$f" {[file isfile $f]} |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | # ... and manifest.uuid is the checkout's hash |
| 76 | fossil info |
| 77 | regexp {(?m)^checkout:\s+([0-9a-f]{40,64})\s.*$} $RESULT ckoutline ckid |
| 78 | set uuid [string trim [read_file "manifest.uuid"]] |
| 79 | test "set-manifest-2-uuid" {[same_uuid $ckid $uuid]} |
| 80 | |
| 81 | |
| 82 | # ... which is also the SHA1 of the file "manifest" before it was |
| 83 | #License" or "FreeBSD License0 |
| 84 | |
| 85 | proc file_contains {fname match}e "manifest"] "" ma2-manifest" {$muuid eq $uuidequire sha1}] != 0} then close $fp |
| 86 | set lines [split $contents "\n"] |
| 87 | foreach line $lines { |
| 88 | if {[regexp $match $line]} { |
| 89 | return 1 |
| 90 | } |
| 91 | } |
| 92 | return 0 |
| 93 | } |
| 94 | |
| 95 | # We need SHA1 to effectively test the manifest files produced by |
| 96 | # fossil. It looks like the one from tcllib is exactly what we need. |
| 97 | # On ActiveTcl, add it with teacup. On other platforms, YMMV. |
| 98 | # teacup install sha1 |
| 99 | if {[catch {package require sha1}] != 0} then { |
| 100 | puts "The \"sha1\" package is not available." |
| 101 | test_cleanup_then_return |
| 102 | } |
| 103 | |
| 104 | # We need a respository, so let it have one. |
| 105 | test_setup |
| 106 | |
| 107 | #### Verify classic behavior of the manifest setting |
| 108 | |
| 109 | # Setting is off by default, and there are no extra files. |
| 110 | fossil settings manifest |
| 111 | test "set-manifest-1" {[regexp {^manifest *$} $RESULT]} |
| 112 | set filelist [$v" {$RESULT eq ""} |
| 113 | fossi D. R |