Fossil SCM

Add --wiki-file and --wiki-mimetype options to the ci command.

stephan 2026-11-13 10:39 UTC trunk
Commit 94e16bea4dce8331fabe5074ecb0c2e6eb648b0b69fa78d873fe9a4da0cddc53
1 file changed +33 -1
+33 -1
--- src/checkin.c
+++ src/checkin.c
@@ -2442,11 +2442,11 @@
24422442
blob_reset(&txt);
24432443
}
24442444
blob_reset(&html);
24452445
blob_reset(&in);
24462446
return rc;
2447
-}
2447
+}
24482448
24492449
/*
24502450
** COMMAND: ci#
24512451
** COMMAND: commit
24522452
**
@@ -2534,10 +2534,16 @@
25342534
** --proxy PROXY Use PROXY as http proxy during sync operation
25352535
** --tag TAG-NAME Add TAG-NAME to the check-in. May be repeated.
25362536
** --trace Debug tracing
25372537
** --user-override USER Record USER as the login that created the
25382538
** new check-in, rather that the current user.
2539
+** --wiki-file FILE Adds FILE's content as a wiki page associated
2540
+** with this check-in.
2541
+** --wiki-mimetype TYPE Mimetype for --wiki-file. Default is from the
2542
+** file extension: .md=markdown, .wiki=fossil,
2543
+** otherwise plain text. Accepts "markdown",
2544
+** "wiki", and "plain" as aliases.
25392545
**
25402546
** See also: [[branch]], [[changes]], [[update]], [[extras]], [[sync]]
25412547
*/
25422548
void commit_cmd(void){
25432549
int hasChanges; /* True if unsaved changes exist */
@@ -2587,10 +2593,12 @@
25872593
int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
25882594
int mxSize;
25892595
char *zCurBranch = 0; /* The current branch name of checkout */
25902596
char *zNewBranch = 0; /* The branch name after update */
25912597
int ckComFlgs; /* Flags passed to verify_comment() */
2598
+ const char * zWikiFile; /* --wiki-file X */
2599
+ const char * zWikiMime; /* --wiki-mimetype X */
25922600
25932601
memset(&sCiInfo, 0, sizeof(sCiInfo));
25942602
url_proxy_options();
25952603
/* Undocumented. Supported only for backwards
25962604
** compatibility -------vvvvvvv */
@@ -2655,10 +2663,12 @@
26552663
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
26562664
useCksum = db_get_boolean("repo-cksum", 1);
26572665
bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
26582666
mxSize = db_large_file_size();
26592667
if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0;
2668
+ zWikiFile = find_option("wiki-file",0,1);
2669
+ zWikiMime = find_option("wiki-mimetype",0,1);
26602670
(void)fossil_text_editor();
26612671
verify_all_options();
26622672
26632673
/* The --no-warnings flag and the --force flag each imply
26642674
** the --no-verify-comment flag */
@@ -3305,10 +3315,32 @@
33053315
vfile_aggregate_checksum_disk(nvid, &cksum2);
33063316
if( blob_compare(&cksum1, &cksum2) ){
33073317
fossil_fatal("working check-out before and after commit does not match");
33083318
}
33093319
}
3320
+
3321
+ if( zWikiFile ){
3322
+ /* Handle --wiki-file and --wiki-mimetype */
3323
+ Blob bWiki = BLOB_INITIALIZER;
3324
+ char * zPageName;
3325
+ blob_read_from_file(&bWiki, zWikiFile, ExtFILE);
3326
+ if( !zWikiMime ){
3327
+ if( 0==sqlite3_strglob("*.md", zWikiFile) ){
3328
+ zWikiMime = "text/x-markdown";
3329
+ }else if( 0==sqlite3_strglob("*.wiki", zWikiFile) ){
3330
+ zWikiMime = "text/x-fossil-wiki";
3331
+ }else{
3332
+ zWikiMime = "text/plain";
3333
+ }
3334
+ }
3335
+ zWikiMime = wiki_filter_mimetypes(zWikiMime);
3336
+ zPageName = mprintf("checkin/%s", zUuid);
3337
+ wiki_cmd_commit(zPageName, 0, &bWiki, zWikiMime, 0);
3338
+ fossil_print("Added %s (%s)\n", zPageName, zWikiMime);
3339
+ blob_reset(&bWiki);
3340
+ fossil_free(zPageName);
3341
+ }
33103342
33113343
/* Clear the undo/redo stack */
33123344
undo_reset();
33133345
33143346
/* Commit */
33153347
--- src/checkin.c
+++ src/checkin.c
@@ -2442,11 +2442,11 @@
2442 blob_reset(&txt);
2443 }
2444 blob_reset(&html);
2445 blob_reset(&in);
2446 return rc;
2447 }
2448
2449 /*
2450 ** COMMAND: ci#
2451 ** COMMAND: commit
2452 **
@@ -2534,10 +2534,16 @@
2534 ** --proxy PROXY Use PROXY as http proxy during sync operation
2535 ** --tag TAG-NAME Add TAG-NAME to the check-in. May be repeated.
2536 ** --trace Debug tracing
2537 ** --user-override USER Record USER as the login that created the
2538 ** new check-in, rather that the current user.
 
 
 
 
 
 
2539 **
2540 ** See also: [[branch]], [[changes]], [[update]], [[extras]], [[sync]]
2541 */
2542 void commit_cmd(void){
2543 int hasChanges; /* True if unsaved changes exist */
@@ -2587,10 +2593,12 @@
2587 int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
2588 int mxSize;
2589 char *zCurBranch = 0; /* The current branch name of checkout */
2590 char *zNewBranch = 0; /* The branch name after update */
2591 int ckComFlgs; /* Flags passed to verify_comment() */
 
 
2592
2593 memset(&sCiInfo, 0, sizeof(sCiInfo));
2594 url_proxy_options();
2595 /* Undocumented. Supported only for backwards
2596 ** compatibility -------vvvvvvv */
@@ -2655,10 +2663,12 @@
2655 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
2656 useCksum = db_get_boolean("repo-cksum", 1);
2657 bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
2658 mxSize = db_large_file_size();
2659 if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0;
 
 
2660 (void)fossil_text_editor();
2661 verify_all_options();
2662
2663 /* The --no-warnings flag and the --force flag each imply
2664 ** the --no-verify-comment flag */
@@ -3305,10 +3315,32 @@
3305 vfile_aggregate_checksum_disk(nvid, &cksum2);
3306 if( blob_compare(&cksum1, &cksum2) ){
3307 fossil_fatal("working check-out before and after commit does not match");
3308 }
3309 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3310
3311 /* Clear the undo/redo stack */
3312 undo_reset();
3313
3314 /* Commit */
3315
--- src/checkin.c
+++ src/checkin.c
@@ -2442,11 +2442,11 @@
2442 blob_reset(&txt);
2443 }
2444 blob_reset(&html);
2445 blob_reset(&in);
2446 return rc;
2447 }
2448
2449 /*
2450 ** COMMAND: ci#
2451 ** COMMAND: commit
2452 **
@@ -2534,10 +2534,16 @@
2534 ** --proxy PROXY Use PROXY as http proxy during sync operation
2535 ** --tag TAG-NAME Add TAG-NAME to the check-in. May be repeated.
2536 ** --trace Debug tracing
2537 ** --user-override USER Record USER as the login that created the
2538 ** new check-in, rather that the current user.
2539 ** --wiki-file FILE Adds FILE's content as a wiki page associated
2540 ** with this check-in.
2541 ** --wiki-mimetype TYPE Mimetype for --wiki-file. Default is from the
2542 ** file extension: .md=markdown, .wiki=fossil,
2543 ** otherwise plain text. Accepts "markdown",
2544 ** "wiki", and "plain" as aliases.
2545 **
2546 ** See also: [[branch]], [[changes]], [[update]], [[extras]], [[sync]]
2547 */
2548 void commit_cmd(void){
2549 int hasChanges; /* True if unsaved changes exist */
@@ -2587,10 +2593,12 @@
2593 int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
2594 int mxSize;
2595 char *zCurBranch = 0; /* The current branch name of checkout */
2596 char *zNewBranch = 0; /* The branch name after update */
2597 int ckComFlgs; /* Flags passed to verify_comment() */
2598 const char * zWikiFile; /* --wiki-file X */
2599 const char * zWikiMime; /* --wiki-mimetype X */
2600
2601 memset(&sCiInfo, 0, sizeof(sCiInfo));
2602 url_proxy_options();
2603 /* Undocumented. Supported only for backwards
2604 ** compatibility -------vvvvvvv */
@@ -2655,10 +2663,12 @@
2663 if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
2664 useCksum = db_get_boolean("repo-cksum", 1);
2665 bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
2666 mxSize = db_large_file_size();
2667 if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0;
2668 zWikiFile = find_option("wiki-file",0,1);
2669 zWikiMime = find_option("wiki-mimetype",0,1);
2670 (void)fossil_text_editor();
2671 verify_all_options();
2672
2673 /* The --no-warnings flag and the --force flag each imply
2674 ** the --no-verify-comment flag */
@@ -3305,10 +3315,32 @@
3315 vfile_aggregate_checksum_disk(nvid, &cksum2);
3316 if( blob_compare(&cksum1, &cksum2) ){
3317 fossil_fatal("working check-out before and after commit does not match");
3318 }
3319 }
3320
3321 if( zWikiFile ){
3322 /* Handle --wiki-file and --wiki-mimetype */
3323 Blob bWiki = BLOB_INITIALIZER;
3324 char * zPageName;
3325 blob_read_from_file(&bWiki, zWikiFile, ExtFILE);
3326 if( !zWikiMime ){
3327 if( 0==sqlite3_strglob("*.md", zWikiFile) ){
3328 zWikiMime = "text/x-markdown";
3329 }else if( 0==sqlite3_strglob("*.wiki", zWikiFile) ){
3330 zWikiMime = "text/x-fossil-wiki";
3331 }else{
3332 zWikiMime = "text/plain";
3333 }
3334 }
3335 zWikiMime = wiki_filter_mimetypes(zWikiMime);
3336 zPageName = mprintf("checkin/%s", zUuid);
3337 wiki_cmd_commit(zPageName, 0, &bWiki, zWikiMime, 0);
3338 fossil_print("Added %s (%s)\n", zPageName, zWikiMime);
3339 blob_reset(&bWiki);
3340 fossil_free(zPageName);
3341 }
3342
3343 /* Clear the undo/redo stack */
3344 undo_reset();
3345
3346 /* Commit */
3347

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button