Fossil SCM

Add the --ckout-alias option to "fossil ui", "fossil server", and "fossil http". The "--ckout-alias NAME" means that URLs of the form "/doc/NAME/..." are interpreted as if they were "/doc/ckout/...". This helps in testing embedded documentation changes prior to check-in.

drh 2021-01-28 12:09 trunk
Commit dc1121f6a7553982d35ea926931a908940618b3da8ba045d0c129efe8708e4c5
+9 -2
--- src/doc.c
+++ src/doc.c
@@ -867,11 +867,16 @@
867867
** directly from disk and need not be a managed file. For /uv, FILE
868868
** can also be the hash of the unversioned file.
869869
**
870870
** The "ckout" CHECKIN is intended for development - to provide a mechanism
871871
** for looking at what a file will look like using the /doc webpage after
872
-** it gets checked in.
872
+** it gets checked in. Some commands like "fossil ui", "fossil server",
873
+** and "fossil http" accept an argument "--ckout-alias NAME" when allows
874
+** NAME to be understood as an alias for "ckout". On a site with many
875
+** embedded hyperlinks to /doc/trunk/... one can run with "--ckout-alias trunk"
876
+** to simulate what the pending changes will look like after they are
877
+** checked in. The NAME alias is stored in g.zCkoutAlias.
873878
**
874879
** The file extension is used to decide how to render the file.
875880
**
876881
** If FILE ends in "/" then the names "FILE/index.html", "FILE/index.wiki",
877882
** and "FILE/index.md" are tried in that order. If the binary was compiled
@@ -988,11 +993,13 @@
988993
"SELECT name FROM unversioned WHERE hash=%Q", zName);
989994
g.isConst = 1;
990995
}
991996
zDfltTitle = zName;
992997
}
993
- }else if( fossil_strcmp(zCheckin,"ckout")==0 ){
998
+ }else if( fossil_strcmp(zCheckin,"ckout")==0
999
+ || fossil_strcmp(zCheckin,g.zCkoutAlias)==0
1000
+ ){
9941001
/* Read from the local checkout */
9951002
char *zFullpath;
9961003
db_must_be_within_tree();
9971004
zFullpath = mprintf("%s/%s", g.zLocalRoot, zName);
9981005
if( file_isfile(zFullpath, RepoFILE)
9991006
--- src/doc.c
+++ src/doc.c
@@ -867,11 +867,16 @@
867 ** directly from disk and need not be a managed file. For /uv, FILE
868 ** can also be the hash of the unversioned file.
869 **
870 ** The "ckout" CHECKIN is intended for development - to provide a mechanism
871 ** for looking at what a file will look like using the /doc webpage after
872 ** it gets checked in.
 
 
 
 
 
873 **
874 ** The file extension is used to decide how to render the file.
875 **
876 ** If FILE ends in "/" then the names "FILE/index.html", "FILE/index.wiki",
877 ** and "FILE/index.md" are tried in that order. If the binary was compiled
@@ -988,11 +993,13 @@
988 "SELECT name FROM unversioned WHERE hash=%Q", zName);
989 g.isConst = 1;
990 }
991 zDfltTitle = zName;
992 }
993 }else if( fossil_strcmp(zCheckin,"ckout")==0 ){
 
 
994 /* Read from the local checkout */
995 char *zFullpath;
996 db_must_be_within_tree();
997 zFullpath = mprintf("%s/%s", g.zLocalRoot, zName);
998 if( file_isfile(zFullpath, RepoFILE)
999
--- src/doc.c
+++ src/doc.c
@@ -867,11 +867,16 @@
867 ** directly from disk and need not be a managed file. For /uv, FILE
868 ** can also be the hash of the unversioned file.
869 **
870 ** The "ckout" CHECKIN is intended for development - to provide a mechanism
871 ** for looking at what a file will look like using the /doc webpage after
872 ** it gets checked in. Some commands like "fossil ui", "fossil server",
873 ** and "fossil http" accept an argument "--ckout-alias NAME" when allows
874 ** NAME to be understood as an alias for "ckout". On a site with many
875 ** embedded hyperlinks to /doc/trunk/... one can run with "--ckout-alias trunk"
876 ** to simulate what the pending changes will look like after they are
877 ** checked in. The NAME alias is stored in g.zCkoutAlias.
878 **
879 ** The file extension is used to decide how to render the file.
880 **
881 ** If FILE ends in "/" then the names "FILE/index.html", "FILE/index.wiki",
882 ** and "FILE/index.md" are tried in that order. If the binary was compiled
@@ -988,11 +993,13 @@
993 "SELECT name FROM unversioned WHERE hash=%Q", zName);
994 g.isConst = 1;
995 }
996 zDfltTitle = zName;
997 }
998 }else if( fossil_strcmp(zCheckin,"ckout")==0
999 || fossil_strcmp(zCheckin,g.zCkoutAlias)==0
1000 ){
1001 /* Read from the local checkout */
1002 char *zFullpath;
1003 db_must_be_within_tree();
1004 zFullpath = mprintf("%s/%s", g.zLocalRoot, zName);
1005 if( file_isfile(zFullpath, RepoFILE)
1006
+7
--- src/main.c
+++ src/main.c
@@ -209,10 +209,11 @@
209209
char isHTTP; /* True if server/CGI modes, else assume CLI. */
210210
char javascriptHyperlink; /* If true, set href= using script, not HTML */
211211
Blob httpHeader; /* Complete text of the HTTP request header */
212212
UrlData url; /* Information about current URL */
213213
const char *zLogin; /* Login name. NULL or "" if not logged in. */
214
+ const char *zCkoutAlias; /* doc/ uses this branch as an alias for "ckout" */
214215
const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
215216
** SSL client identity */
216217
#if defined(_WIN32) && USE_SEE
217218
const char *zPidKey; /* Saved value of the --usepidkey option. Only
218219
* applicable when using SEE on Windows. */
@@ -2511,10 +2512,12 @@
25112512
** for requests coming from localhost, if the "localauth" setting is not
25122513
** enabled.
25132514
**
25142515
** Options:
25152516
** --baseurl URL base URL (useful with reverse proxies)
2517
+** --ckout-alias N Treat URIs of the form /doc/N/... as if they were
2518
+** /doc/ckout/...
25162519
** --extroot DIR document root for the /ext extension mechanism
25172520
** --files GLOB comma-separate glob patterns for static file to serve
25182521
** --host NAME specify hostname of the server
25192522
** --https signal a request coming in via https
25202523
** --in FILE Take input from FILE instead of standard input
@@ -2581,10 +2584,11 @@
25812584
allowRepoList = find_option("repolist",0,0)!=0;
25822585
g.useLocalauth = find_option("localauth", 0, 0)!=0;
25832586
g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
25842587
g.fNoHttpCompress = find_option("nocompress",0,0)!=0;
25852588
g.zExtRoot = find_option("extroot",0,1);
2589
+ g.zCkoutAlias = find_option("ckout-alias",0,1);
25862590
zInFile = find_option("in",0,1);
25872591
if( zInFile ){
25882592
backoffice_disable();
25892593
g.httpIn = fossil_fopen(zInFile, "rb");
25902594
if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile);
@@ -2759,10 +2763,12 @@
27592763
** connection is from localhost. The "ui" command also enables --repolist
27602764
** by default.
27612765
**
27622766
** Options:
27632767
** --baseurl URL Use URL as the base (useful for reverse proxies)
2768
+** --ckout-alias NAME Treat URIs of the form /doc/NAME/... as if they were
2769
+** /doc/ckout/...
27642770
** --create Create a new REPOSITORY if it does not already exist
27652771
** --extroot DIR Document root for the /ext extension mechanism
27662772
** --files GLOBLIST Comma-separated list of glob patterns for static files
27672773
** --localauth enable automatic login for requests from localhost
27682774
** --localhost listen on 127.0.0.1 only (always true for "ui")
@@ -2861,10 +2867,11 @@
28612867
cgi_replace_parameter("HTTPS","on");
28622868
}
28632869
if( find_option("localhost", 0, 0)!=0 ){
28642870
flags |= HTTP_SERVER_LOCALHOST;
28652871
}
2872
+ g.zCkoutAlias = find_option("ckout-alias",0,1);
28662873
28672874
/* We should be done with options.. */
28682875
verify_all_options();
28692876
28702877
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
28712878
--- src/main.c
+++ src/main.c
@@ -209,10 +209,11 @@
209 char isHTTP; /* True if server/CGI modes, else assume CLI. */
210 char javascriptHyperlink; /* If true, set href= using script, not HTML */
211 Blob httpHeader; /* Complete text of the HTTP request header */
212 UrlData url; /* Information about current URL */
213 const char *zLogin; /* Login name. NULL or "" if not logged in. */
 
214 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
215 ** SSL client identity */
216 #if defined(_WIN32) && USE_SEE
217 const char *zPidKey; /* Saved value of the --usepidkey option. Only
218 * applicable when using SEE on Windows. */
@@ -2511,10 +2512,12 @@
2511 ** for requests coming from localhost, if the "localauth" setting is not
2512 ** enabled.
2513 **
2514 ** Options:
2515 ** --baseurl URL base URL (useful with reverse proxies)
 
 
2516 ** --extroot DIR document root for the /ext extension mechanism
2517 ** --files GLOB comma-separate glob patterns for static file to serve
2518 ** --host NAME specify hostname of the server
2519 ** --https signal a request coming in via https
2520 ** --in FILE Take input from FILE instead of standard input
@@ -2581,10 +2584,11 @@
2581 allowRepoList = find_option("repolist",0,0)!=0;
2582 g.useLocalauth = find_option("localauth", 0, 0)!=0;
2583 g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2584 g.fNoHttpCompress = find_option("nocompress",0,0)!=0;
2585 g.zExtRoot = find_option("extroot",0,1);
 
2586 zInFile = find_option("in",0,1);
2587 if( zInFile ){
2588 backoffice_disable();
2589 g.httpIn = fossil_fopen(zInFile, "rb");
2590 if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile);
@@ -2759,10 +2763,12 @@
2759 ** connection is from localhost. The "ui" command also enables --repolist
2760 ** by default.
2761 **
2762 ** Options:
2763 ** --baseurl URL Use URL as the base (useful for reverse proxies)
 
 
2764 ** --create Create a new REPOSITORY if it does not already exist
2765 ** --extroot DIR Document root for the /ext extension mechanism
2766 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2767 ** --localauth enable automatic login for requests from localhost
2768 ** --localhost listen on 127.0.0.1 only (always true for "ui")
@@ -2861,10 +2867,11 @@
2861 cgi_replace_parameter("HTTPS","on");
2862 }
2863 if( find_option("localhost", 0, 0)!=0 ){
2864 flags |= HTTP_SERVER_LOCALHOST;
2865 }
 
2866
2867 /* We should be done with options.. */
2868 verify_all_options();
2869
2870 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
2871
--- src/main.c
+++ src/main.c
@@ -209,10 +209,11 @@
209 char isHTTP; /* True if server/CGI modes, else assume CLI. */
210 char javascriptHyperlink; /* If true, set href= using script, not HTML */
211 Blob httpHeader; /* Complete text of the HTTP request header */
212 UrlData url; /* Information about current URL */
213 const char *zLogin; /* Login name. NULL or "" if not logged in. */
214 const char *zCkoutAlias; /* doc/ uses this branch as an alias for "ckout" */
215 const char *zSSLIdentity; /* Value of --ssl-identity option, filename of
216 ** SSL client identity */
217 #if defined(_WIN32) && USE_SEE
218 const char *zPidKey; /* Saved value of the --usepidkey option. Only
219 * applicable when using SEE on Windows. */
@@ -2511,10 +2512,12 @@
2512 ** for requests coming from localhost, if the "localauth" setting is not
2513 ** enabled.
2514 **
2515 ** Options:
2516 ** --baseurl URL base URL (useful with reverse proxies)
2517 ** --ckout-alias N Treat URIs of the form /doc/N/... as if they were
2518 ** /doc/ckout/...
2519 ** --extroot DIR document root for the /ext extension mechanism
2520 ** --files GLOB comma-separate glob patterns for static file to serve
2521 ** --host NAME specify hostname of the server
2522 ** --https signal a request coming in via https
2523 ** --in FILE Take input from FILE instead of standard input
@@ -2581,10 +2584,11 @@
2584 allowRepoList = find_option("repolist",0,0)!=0;
2585 g.useLocalauth = find_option("localauth", 0, 0)!=0;
2586 g.sslNotAvailable = find_option("nossl", 0, 0)!=0;
2587 g.fNoHttpCompress = find_option("nocompress",0,0)!=0;
2588 g.zExtRoot = find_option("extroot",0,1);
2589 g.zCkoutAlias = find_option("ckout-alias",0,1);
2590 zInFile = find_option("in",0,1);
2591 if( zInFile ){
2592 backoffice_disable();
2593 g.httpIn = fossil_fopen(zInFile, "rb");
2594 if( g.httpIn==0 ) fossil_fatal("cannot open \"%s\" for reading", zInFile);
@@ -2759,10 +2763,12 @@
2763 ** connection is from localhost. The "ui" command also enables --repolist
2764 ** by default.
2765 **
2766 ** Options:
2767 ** --baseurl URL Use URL as the base (useful for reverse proxies)
2768 ** --ckout-alias NAME Treat URIs of the form /doc/NAME/... as if they were
2769 ** /doc/ckout/...
2770 ** --create Create a new REPOSITORY if it does not already exist
2771 ** --extroot DIR Document root for the /ext extension mechanism
2772 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2773 ** --localauth enable automatic login for requests from localhost
2774 ** --localhost listen on 127.0.0.1 only (always true for "ui")
@@ -2861,10 +2867,11 @@
2867 cgi_replace_parameter("HTTPS","on");
2868 }
2869 if( find_option("localhost", 0, 0)!=0 ){
2870 flags |= HTTP_SERVER_LOCALHOST;
2871 }
2872 g.zCkoutAlias = find_option("ckout-alias",0,1);
2873
2874 /* We should be done with options.. */
2875 verify_all_options();
2876
2877 if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
2878
--- src/winhttp.c
+++ src/winhttp.c
@@ -546,10 +546,14 @@
546546
}
547547
if( zNotFound ){
548548
blob_appendf(&options, " --notfound ");
549549
blob_append_escaped_arg(&options, zNotFound);
550550
}
551
+ if( g.zCkoutAlias ){
552
+ blob_appendf(&options, " --ckout-alias ");
553
+ blob_append_escaped_arg(&options, g.zCkoutAlias);
554
+ }
551555
if( zFileGlob ){
552556
blob_appendf(&options, " --files-urlenc %T", zFileGlob);
553557
}
554558
if( g.useLocalauth ){
555559
blob_appendf(&options, " --localauth");
556560
--- src/winhttp.c
+++ src/winhttp.c
@@ -546,10 +546,14 @@
546 }
547 if( zNotFound ){
548 blob_appendf(&options, " --notfound ");
549 blob_append_escaped_arg(&options, zNotFound);
550 }
 
 
 
 
551 if( zFileGlob ){
552 blob_appendf(&options, " --files-urlenc %T", zFileGlob);
553 }
554 if( g.useLocalauth ){
555 blob_appendf(&options, " --localauth");
556
--- src/winhttp.c
+++ src/winhttp.c
@@ -546,10 +546,14 @@
546 }
547 if( zNotFound ){
548 blob_appendf(&options, " --notfound ");
549 blob_append_escaped_arg(&options, zNotFound);
550 }
551 if( g.zCkoutAlias ){
552 blob_appendf(&options, " --ckout-alias ");
553 blob_append_escaped_arg(&options, g.zCkoutAlias);
554 }
555 if( zFileGlob ){
556 blob_appendf(&options, " --files-urlenc %T", zFileGlob);
557 }
558 if( g.useLocalauth ){
559 blob_appendf(&options, " --localauth");
560

Keyboard Shortcuts

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