Fossil SCM
Show the current hash policy on the "Database Stats" line of the /stat screen.
Commit
2ca8bc8baacdcc562426862ac4b61f6b534d277e
Parent
91f5ad9b94ef47d…
2 files changed
+14
-3
+2
-1
+14
-3
| --- src/hname.c | ||
| +++ src/hname.c | ||
| @@ -211,10 +211,24 @@ | ||
| 211 | 211 | return HPOLICY_SHA3; |
| 212 | 212 | }else{ |
| 213 | 213 | return HPOLICY_AUTO; |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | + | |
| 217 | +/* | |
| 218 | +** Names of the hash policies. | |
| 219 | +*/ | |
| 220 | +static const char *azPolicy[] = { | |
| 221 | + "sha1", "auto", "sha3", "sha3-only", "shun-sha1" | |
| 222 | +}; | |
| 223 | + | |
| 224 | +/* Return the name of the current hash policy. | |
| 225 | +*/ | |
| 226 | +const char *hpolicy_name(void){ | |
| 227 | + return azPolicy[g.eHashPolicy]; | |
| 228 | +} | |
| 229 | + | |
| 216 | 230 | |
| 217 | 231 | /* |
| 218 | 232 | ** COMMAND: hash-policy* |
| 219 | 233 | ** |
| 220 | 234 | ** Usage: fossil hash-policy ?NEW-POLICY? |
| @@ -242,13 +256,10 @@ | ||
| 242 | 256 | ** immediately promote to "sha3" if the repository contains one or more |
| 243 | 257 | ** artifacts with SHA3 names. The default hash policy for new repositories |
| 244 | 258 | ** is "shun-sha1". |
| 245 | 259 | */ |
| 246 | 260 | void hash_policy_command(void){ |
| 247 | - static const char *azPolicy[] = { | |
| 248 | - "sha1", "auto", "sha3", "sha3-only", "shun-sha1" | |
| 249 | - }; | |
| 250 | 261 | int i; |
| 251 | 262 | db_find_and_open_repository(0, 0); |
| 252 | 263 | if( g.argc!=2 && g.argc!=3 ) usage("?NEW-POLICY?"); |
| 253 | 264 | if( g.argc==2 ){ |
| 254 | 265 | fossil_print("%s\n", azPolicy[g.eHashPolicy]); |
| 255 | 266 |
| --- src/hname.c | |
| +++ src/hname.c | |
| @@ -211,10 +211,24 @@ | |
| 211 | return HPOLICY_SHA3; |
| 212 | }else{ |
| 213 | return HPOLICY_AUTO; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /* |
| 218 | ** COMMAND: hash-policy* |
| 219 | ** |
| 220 | ** Usage: fossil hash-policy ?NEW-POLICY? |
| @@ -242,13 +256,10 @@ | |
| 242 | ** immediately promote to "sha3" if the repository contains one or more |
| 243 | ** artifacts with SHA3 names. The default hash policy for new repositories |
| 244 | ** is "shun-sha1". |
| 245 | */ |
| 246 | void hash_policy_command(void){ |
| 247 | static const char *azPolicy[] = { |
| 248 | "sha1", "auto", "sha3", "sha3-only", "shun-sha1" |
| 249 | }; |
| 250 | int i; |
| 251 | db_find_and_open_repository(0, 0); |
| 252 | if( g.argc!=2 && g.argc!=3 ) usage("?NEW-POLICY?"); |
| 253 | if( g.argc==2 ){ |
| 254 | fossil_print("%s\n", azPolicy[g.eHashPolicy]); |
| 255 |
| --- src/hname.c | |
| +++ src/hname.c | |
| @@ -211,10 +211,24 @@ | |
| 211 | return HPOLICY_SHA3; |
| 212 | }else{ |
| 213 | return HPOLICY_AUTO; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /* |
| 218 | ** Names of the hash policies. |
| 219 | */ |
| 220 | static const char *azPolicy[] = { |
| 221 | "sha1", "auto", "sha3", "sha3-only", "shun-sha1" |
| 222 | }; |
| 223 | |
| 224 | /* Return the name of the current hash policy. |
| 225 | */ |
| 226 | const char *hpolicy_name(void){ |
| 227 | return azPolicy[g.eHashPolicy]; |
| 228 | } |
| 229 | |
| 230 | |
| 231 | /* |
| 232 | ** COMMAND: hash-policy* |
| 233 | ** |
| 234 | ** Usage: fossil hash-policy ?NEW-POLICY? |
| @@ -242,13 +256,10 @@ | |
| 256 | ** immediately promote to "sha3" if the repository contains one or more |
| 257 | ** artifacts with SHA3 names. The default hash policy for new repositories |
| 258 | ** is "shun-sha1". |
| 259 | */ |
| 260 | void hash_policy_command(void){ |
| 261 | int i; |
| 262 | db_find_and_open_repository(0, 0); |
| 263 | if( g.argc!=2 && g.argc!=3 ) usage("?NEW-POLICY?"); |
| 264 | if( g.argc==2 ){ |
| 265 | fossil_print("%s\n", azPolicy[g.eHashPolicy]); |
| 266 |
+2
-1
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -192,11 +192,12 @@ | ||
| 192 | 192 | @ <tr><th>Database Stats:</th><td> |
| 193 | 193 | @ %d(db_int(0, "PRAGMA repository.page_count")) pages, |
| 194 | 194 | @ %d(db_int(0, "PRAGMA repository.page_size")) bytes/page, |
| 195 | 195 | @ %d(db_int(0, "PRAGMA repository.freelist_count")) free pages, |
| 196 | 196 | @ %s(db_text(0, "PRAGMA repository.encoding")), |
| 197 | - @ %s(db_text(0, "PRAGMA repository.journal_mode")) mode | |
| 197 | + @ %s(db_text(0, "PRAGMA repository.journal_mode")) mode, | |
| 198 | + @ hash %s(hpolicy_name()) | |
| 198 | 199 | @ </td></tr> |
| 199 | 200 | |
| 200 | 201 | @ </table> |
| 201 | 202 | style_footer(); |
| 202 | 203 | } |
| 203 | 204 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -192,11 +192,12 @@ | |
| 192 | @ <tr><th>Database Stats:</th><td> |
| 193 | @ %d(db_int(0, "PRAGMA repository.page_count")) pages, |
| 194 | @ %d(db_int(0, "PRAGMA repository.page_size")) bytes/page, |
| 195 | @ %d(db_int(0, "PRAGMA repository.freelist_count")) free pages, |
| 196 | @ %s(db_text(0, "PRAGMA repository.encoding")), |
| 197 | @ %s(db_text(0, "PRAGMA repository.journal_mode")) mode |
| 198 | @ </td></tr> |
| 199 | |
| 200 | @ </table> |
| 201 | style_footer(); |
| 202 | } |
| 203 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -192,11 +192,12 @@ | |
| 192 | @ <tr><th>Database Stats:</th><td> |
| 193 | @ %d(db_int(0, "PRAGMA repository.page_count")) pages, |
| 194 | @ %d(db_int(0, "PRAGMA repository.page_size")) bytes/page, |
| 195 | @ %d(db_int(0, "PRAGMA repository.freelist_count")) free pages, |
| 196 | @ %s(db_text(0, "PRAGMA repository.encoding")), |
| 197 | @ %s(db_text(0, "PRAGMA repository.journal_mode")) mode, |
| 198 | @ hash %s(hpolicy_name()) |
| 199 | @ </td></tr> |
| 200 | |
| 201 | @ </table> |
| 202 | style_footer(); |
| 203 | } |
| 204 |