Fossil SCM
Rename --wiki-file to --wiki/-w and add -wm alias for --wiki-mimetype. When --wiki is used with --branch, associate the new page with the branch instead of the check-in.
Commit
033412b16346dba7ea66a38cbf6fab6b49ffd93c86126358264a0ef355ee071a
Parent
94e16bea4dce833…
2 files changed
+15
-8
+3
-3
+15
-8
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -2534,13 +2534,14 @@ | ||
| 2534 | 2534 | ** --proxy PROXY Use PROXY as http proxy during sync operation |
| 2535 | 2535 | ** --tag TAG-NAME Add TAG-NAME to the check-in. May be repeated. |
| 2536 | 2536 | ** --trace Debug tracing |
| 2537 | 2537 | ** --user-override USER Record USER as the login that created the |
| 2538 | 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 | |
| 2539 | +** -w|--wiki FILE Adds FILE's content as a wiki page associated | |
| 2540 | +** with this check-in or, if used with --branch, | |
| 2541 | +** the branch. | |
| 2542 | +** --wm|--wiki-mimetype TYPE Mimetype for --wiki-file. Default is from the | |
| 2542 | 2543 | ** file extension: .md=markdown, .wiki=fossil, |
| 2543 | 2544 | ** otherwise plain text. Accepts "markdown", |
| 2544 | 2545 | ** "wiki", and "plain" as aliases. |
| 2545 | 2546 | ** |
| 2546 | 2547 | ** See also: [[branch]], [[changes]], [[update]], [[extras]], [[sync]] |
| @@ -2593,11 +2594,11 @@ | ||
| 2593 | 2594 | int bIgnoreSkew = 0; /* --ignore-clock-skew flag */ |
| 2594 | 2595 | int mxSize; |
| 2595 | 2596 | char *zCurBranch = 0; /* The current branch name of checkout */ |
| 2596 | 2597 | char *zNewBranch = 0; /* The branch name after update */ |
| 2597 | 2598 | int ckComFlgs; /* Flags passed to verify_comment() */ |
| 2598 | - const char * zWikiFile; /* --wiki-file X */ | |
| 2599 | + const char * zWikiFile; /* --wiki X */ | |
| 2599 | 2600 | const char * zWikiMime; /* --wiki-mimetype X */ |
| 2600 | 2601 | |
| 2601 | 2602 | memset(&sCiInfo, 0, sizeof(sCiInfo)); |
| 2602 | 2603 | url_proxy_options(); |
| 2603 | 2604 | /* Undocumented. Supported only for backwards |
| @@ -2663,12 +2664,12 @@ | ||
| 2663 | 2664 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 2664 | 2665 | useCksum = db_get_boolean("repo-cksum", 1); |
| 2665 | 2666 | bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0; |
| 2666 | 2667 | mxSize = db_large_file_size(); |
| 2667 | 2668 | 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); | |
| 2669 | + zWikiFile = find_option("wiki","w",1); | |
| 2670 | + zWikiMime = find_option("wiki-mimetype","wm",1); | |
| 2670 | 2671 | (void)fossil_text_editor(); |
| 2671 | 2672 | verify_all_options(); |
| 2672 | 2673 | |
| 2673 | 2674 | /* The --no-warnings flag and the --force flag each imply |
| 2674 | 2675 | ** the --no-verify-comment flag */ |
| @@ -3320,10 +3321,11 @@ | ||
| 3320 | 3321 | |
| 3321 | 3322 | if( zWikiFile ){ |
| 3322 | 3323 | /* Handle --wiki-file and --wiki-mimetype */ |
| 3323 | 3324 | Blob bWiki = BLOB_INITIALIZER; |
| 3324 | 3325 | char * zPageName; |
| 3326 | + int parentRid = 0; | |
| 3325 | 3327 | blob_read_from_file(&bWiki, zWikiFile, ExtFILE); |
| 3326 | 3328 | if( !zWikiMime ){ |
| 3327 | 3329 | if( 0==sqlite3_strglob("*.md", zWikiFile) ){ |
| 3328 | 3330 | zWikiMime = "text/x-markdown"; |
| 3329 | 3331 | }else if( 0==sqlite3_strglob("*.wiki", zWikiFile) ){ |
| @@ -3330,13 +3332,18 @@ | ||
| 3330 | 3332 | zWikiMime = "text/x-fossil-wiki"; |
| 3331 | 3333 | }else{ |
| 3332 | 3334 | zWikiMime = "text/plain"; |
| 3333 | 3335 | } |
| 3334 | 3336 | } |
| 3337 | + if( sCiInfo.zBranch ){ | |
| 3338 | + zPageName = mprintf("branch/%s", sCiInfo.zBranch); | |
| 3339 | + wiki_fetch_by_name(zPageName, 0, &parentRid, 0); | |
| 3340 | + }else{ | |
| 3341 | + zPageName = mprintf("checkin/%s", zUuid); | |
| 3342 | + } | |
| 3335 | 3343 | zWikiMime = wiki_filter_mimetypes(zWikiMime); |
| 3336 | - zPageName = mprintf("checkin/%s", zUuid); | |
| 3337 | - wiki_cmd_commit(zPageName, 0, &bWiki, zWikiMime, 0); | |
| 3344 | + wiki_cmd_commit(zPageName, parentRid, &bWiki, zWikiMime, 1); | |
| 3338 | 3345 | fossil_print("Added %s (%s)\n", zPageName, zWikiMime); |
| 3339 | 3346 | blob_reset(&bWiki); |
| 3340 | 3347 | fossil_free(zPageName); |
| 3341 | 3348 | } |
| 3342 | 3349 | |
| 3343 | 3350 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2534,13 +2534,14 @@ | |
| 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]] |
| @@ -2593,11 +2594,11 @@ | |
| 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 |
| @@ -2663,12 +2664,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 */ |
| @@ -3320,10 +3321,11 @@ | |
| 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,13 +3332,18 @@ | |
| 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 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2534,13 +2534,14 @@ | |
| 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 | ** -w|--wiki FILE Adds FILE's content as a wiki page associated |
| 2540 | ** with this check-in or, if used with --branch, |
| 2541 | ** the branch. |
| 2542 | ** --wm|--wiki-mimetype TYPE Mimetype for --wiki-file. Default is from the |
| 2543 | ** file extension: .md=markdown, .wiki=fossil, |
| 2544 | ** otherwise plain text. Accepts "markdown", |
| 2545 | ** "wiki", and "plain" as aliases. |
| 2546 | ** |
| 2547 | ** See also: [[branch]], [[changes]], [[update]], [[extras]], [[sync]] |
| @@ -2593,11 +2594,11 @@ | |
| 2594 | int bIgnoreSkew = 0; /* --ignore-clock-skew flag */ |
| 2595 | int mxSize; |
| 2596 | char *zCurBranch = 0; /* The current branch name of checkout */ |
| 2597 | char *zNewBranch = 0; /* The branch name after update */ |
| 2598 | int ckComFlgs; /* Flags passed to verify_comment() */ |
| 2599 | const char * zWikiFile; /* --wiki X */ |
| 2600 | const char * zWikiMime; /* --wiki-mimetype X */ |
| 2601 | |
| 2602 | memset(&sCiInfo, 0, sizeof(sCiInfo)); |
| 2603 | url_proxy_options(); |
| 2604 | /* Undocumented. Supported only for backwards |
| @@ -2663,12 +2664,12 @@ | |
| 2664 | if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; } |
| 2665 | useCksum = db_get_boolean("repo-cksum", 1); |
| 2666 | bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0; |
| 2667 | mxSize = db_large_file_size(); |
| 2668 | if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0; |
| 2669 | zWikiFile = find_option("wiki","w",1); |
| 2670 | zWikiMime = find_option("wiki-mimetype","wm",1); |
| 2671 | (void)fossil_text_editor(); |
| 2672 | verify_all_options(); |
| 2673 | |
| 2674 | /* The --no-warnings flag and the --force flag each imply |
| 2675 | ** the --no-verify-comment flag */ |
| @@ -3320,10 +3321,11 @@ | |
| 3321 | |
| 3322 | if( zWikiFile ){ |
| 3323 | /* Handle --wiki-file and --wiki-mimetype */ |
| 3324 | Blob bWiki = BLOB_INITIALIZER; |
| 3325 | char * zPageName; |
| 3326 | int parentRid = 0; |
| 3327 | blob_read_from_file(&bWiki, zWikiFile, ExtFILE); |
| 3328 | if( !zWikiMime ){ |
| 3329 | if( 0==sqlite3_strglob("*.md", zWikiFile) ){ |
| 3330 | zWikiMime = "text/x-markdown"; |
| 3331 | }else if( 0==sqlite3_strglob("*.wiki", zWikiFile) ){ |
| @@ -3330,13 +3332,18 @@ | |
| 3332 | zWikiMime = "text/x-fossil-wiki"; |
| 3333 | }else{ |
| 3334 | zWikiMime = "text/plain"; |
| 3335 | } |
| 3336 | } |
| 3337 | if( sCiInfo.zBranch ){ |
| 3338 | zPageName = mprintf("branch/%s", sCiInfo.zBranch); |
| 3339 | wiki_fetch_by_name(zPageName, 0, &parentRid, 0); |
| 3340 | }else{ |
| 3341 | zPageName = mprintf("checkin/%s", zUuid); |
| 3342 | } |
| 3343 | zWikiMime = wiki_filter_mimetypes(zWikiMime); |
| 3344 | wiki_cmd_commit(zPageName, parentRid, &bWiki, zWikiMime, 1); |
| 3345 | fossil_print("Added %s (%s)\n", zPageName, zWikiMime); |
| 3346 | blob_reset(&bWiki); |
| 3347 | fossil_free(zPageName); |
| 3348 | } |
| 3349 | |
| 3350 |
+3
-3
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -725,13 +725,13 @@ | ||
| 725 | 725 | ** If pRid is not NULL then if a result is found *pRid is set to its |
| 726 | 726 | ** RID. If ppWiki is not NULL then if found *ppWiki is set to the |
| 727 | 727 | ** loaded wiki object, which the caller is responsible for passing to |
| 728 | 728 | ** manifest_destroy(). |
| 729 | 729 | */ |
| 730 | -static int wiki_fetch_by_name( const char *zPageName, | |
| 731 | - unsigned int versionsBack, | |
| 732 | - int * pRid, Manifest **ppWiki ){ | |
| 730 | +int wiki_fetch_by_name( const char *zPageName, | |
| 731 | + unsigned int versionsBack, | |
| 732 | + int * pRid, Manifest **ppWiki ){ | |
| 733 | 733 | Manifest *pWiki = 0; |
| 734 | 734 | char *zTag = mprintf("wiki-%s", zPageName); |
| 735 | 735 | Stmt q = empty_Stmt; |
| 736 | 736 | int rid = 0; |
| 737 | 737 | |
| 738 | 738 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -725,13 +725,13 @@ | |
| 725 | ** If pRid is not NULL then if a result is found *pRid is set to its |
| 726 | ** RID. If ppWiki is not NULL then if found *ppWiki is set to the |
| 727 | ** loaded wiki object, which the caller is responsible for passing to |
| 728 | ** manifest_destroy(). |
| 729 | */ |
| 730 | static int wiki_fetch_by_name( const char *zPageName, |
| 731 | unsigned int versionsBack, |
| 732 | int * pRid, Manifest **ppWiki ){ |
| 733 | Manifest *pWiki = 0; |
| 734 | char *zTag = mprintf("wiki-%s", zPageName); |
| 735 | Stmt q = empty_Stmt; |
| 736 | int rid = 0; |
| 737 | |
| 738 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -725,13 +725,13 @@ | |
| 725 | ** If pRid is not NULL then if a result is found *pRid is set to its |
| 726 | ** RID. If ppWiki is not NULL then if found *ppWiki is set to the |
| 727 | ** loaded wiki object, which the caller is responsible for passing to |
| 728 | ** manifest_destroy(). |
| 729 | */ |
| 730 | int wiki_fetch_by_name( const char *zPageName, |
| 731 | unsigned int versionsBack, |
| 732 | int * pRid, Manifest **ppWiki ){ |
| 733 | Manifest *pWiki = 0; |
| 734 | char *zTag = mprintf("wiki-%s", zPageName); |
| 735 | Stmt q = empty_Stmt; |
| 736 | int rid = 0; |
| 737 | |
| 738 |