Fossil SCM

Add the --fossilcmd option to "fossil ui". Carry the --jsmode and --create options through to the remote fossil.

drh 2021-07-01 13:58 trunk
Commit c359589ef6371bf3a2c5eccbbb3ba9e5bc272b13a7c9424dba6dc20d0a4affad
1 file changed +13 -4
+13 -4
--- src/main.c
+++ src/main.c
@@ -2843,10 +2843,12 @@
28432843
** --ckout-alias NAME Treat URIs of the form /doc/NAME/... as if they were
28442844
** /doc/ckout/...
28452845
** --create Create a new REPOSITORY if it does not already exist
28462846
** --extroot DIR Document root for the /ext extension mechanism
28472847
** --files GLOBLIST Comma-separated list of glob patterns for static files
2848
+** --fossilcmd PATH Full pathname of the "fossil" executable on the remote
2849
+** system when REPOSITORY is remote. Default: "fossil"
28482850
** --localauth enable automatic login for requests from localhost
28492851
** --localhost listen on 127.0.0.1 only (always true for "ui")
28502852
** --https Indicates that the input is coming through a reverse
28512853
** proxy that has already translated HTTPS into HTTP.
28522854
** --jsmode MODE Determine how JavaScript is delivered with pages.
@@ -2902,10 +2904,12 @@
29022904
int fCreate = 0; /* The --create flag */
29032905
int fNoBrowser = 0; /* Do not auto-launch web-browser */
29042906
const char *zInitPage = 0; /* Start on this page. --page option */
29052907
int findServerArg = 2; /* argv index for find_server_repository() */
29062908
char *zRemote = 0; /* Remote host on which to run "fossil ui" */
2909
+ const char *zJsMode; /* The --jsmode parameter */
2910
+ const char *zFossilCmd; /* Name of "fossil" binary on remote system */
29072911
29082912
29092913
#if defined(_WIN32)
29102914
const char *zStopperFile; /* Name of file used to terminate server */
29112915
zStopperFile = find_option("stopper", 0, 1);
@@ -2913,11 +2917,12 @@
29132917
29142918
if( g.zErrlog==0 ){
29152919
g.zErrlog = "-";
29162920
}
29172921
g.zExtRoot = find_option("extroot",0,1);
2918
- builtin_set_js_delivery_mode(find_option("jsmode",0,1),0);
2922
+ zJsMode = find_option("jsmode",0,1);
2923
+ builtin_set_js_delivery_mode(zJsMode,0);
29192924
zFileGlob = find_option("files-urlenc",0,1);
29202925
if( zFileGlob ){
29212926
char *z = mprintf("%s", zFileGlob);
29222927
dehttpize(z);
29232928
zFileGlob = z;
@@ -2933,10 +2938,11 @@
29332938
Th_InitTraceLog();
29342939
zPort = find_option("port", "P", 1);
29352940
isUiCmd = g.argv[1][0]=='u';
29362941
if( isUiCmd ){
29372942
zInitPage = find_option("page", 0, 1);
2943
+ zFossilCmd = find_option("fossilcmd", 0, 1);
29382944
}
29392945
zNotFound = find_option("notfound", 0, 1);
29402946
allowRepoList = find_option("repolist",0,0)!=0;
29412947
if( find_option("nocompress",0,0)!=0 ) g.fNoHttpCompress = 1;
29422948
zAltBase = find_option("baseurl", 0, 1);
@@ -3047,29 +3053,32 @@
30473053
FILE *sshIn;
30483054
Blob ssh;
30493055
char zLine[1000];
30503056
blob_init(&ssh, 0, 0);
30513057
transport_ssh_command(&ssh);
3058
+ if( zFossilCmd==0 ) zFossilCmd = "fossil";
30523059
blob_appendf(&ssh,
30533060
" -t -L127.0.0.1:%d:127.0.0.1:%d -- %!$"
3054
- " fossil ui --nobrowser --localauth --port %d",
3055
- iPort, iPort, zRemote, iPort);
3061
+ " %$ ui --nobrowser --localauth --port %d",
3062
+ iPort, iPort, zRemote, zFossilCmd, iPort);
30563063
if( zNotFound ) blob_appendf(&ssh, " --notfound %!$", zNotFound);
30573064
if( zFileGlob ) blob_appendf(&ssh, " --files-urlenc %T", zFileGlob);
30583065
if( g.zCkoutAlias ) blob_appendf(&ssh, " --ckout-alias %!$",g.zCkoutAlias);
30593066
if( g.zExtRoot ) blob_appendf(&ssh, " --extroot %$", g.zExtRoot);
30603067
if( skin_in_use() ) blob_appendf(&ssh, " --skin %s", skin_in_use());
3068
+ if( zJsMode ) blob_appendf(&ssh, " --jsmode %s", zJsMode);
3069
+ if( fCreate ) blob_appendf(&ssh, " --create");
30613070
blob_appendf(&ssh, " %$", g.argv[2]);
30623071
fossil_print("%s\n", blob_str(&ssh));
30633072
sshIn = popen(blob_str(&ssh), "r");
30643073
if( sshIn==0 ){
30653074
fossil_fatal("unable to %s", blob_str(&ssh));
30663075
}
30673076
while( fgets(zLine, sizeof(zLine), sshIn) ){
30683077
fputs(zLine, stdout);
30693078
fflush(stdout);
3070
- if( zBrowserCmd ){
3079
+ if( zBrowserCmd && sqlite3_strglob("*Listening for HTTP*",zLine)==0 ){
30713080
char *zCmd = mprintf(zBrowserCmd/*works-like:"%d"*/,iPort);
30723081
fossil_system(zCmd);
30733082
fossil_free(zCmd);
30743083
fossil_free(zBrowserCmd);
30753084
zBrowserCmd = 0;
30763085
--- src/main.c
+++ src/main.c
@@ -2843,10 +2843,12 @@
2843 ** --ckout-alias NAME Treat URIs of the form /doc/NAME/... as if they were
2844 ** /doc/ckout/...
2845 ** --create Create a new REPOSITORY if it does not already exist
2846 ** --extroot DIR Document root for the /ext extension mechanism
2847 ** --files GLOBLIST Comma-separated list of glob patterns for static files
 
 
2848 ** --localauth enable automatic login for requests from localhost
2849 ** --localhost listen on 127.0.0.1 only (always true for "ui")
2850 ** --https Indicates that the input is coming through a reverse
2851 ** proxy that has already translated HTTPS into HTTP.
2852 ** --jsmode MODE Determine how JavaScript is delivered with pages.
@@ -2902,10 +2904,12 @@
2902 int fCreate = 0; /* The --create flag */
2903 int fNoBrowser = 0; /* Do not auto-launch web-browser */
2904 const char *zInitPage = 0; /* Start on this page. --page option */
2905 int findServerArg = 2; /* argv index for find_server_repository() */
2906 char *zRemote = 0; /* Remote host on which to run "fossil ui" */
 
 
2907
2908
2909 #if defined(_WIN32)
2910 const char *zStopperFile; /* Name of file used to terminate server */
2911 zStopperFile = find_option("stopper", 0, 1);
@@ -2913,11 +2917,12 @@
2913
2914 if( g.zErrlog==0 ){
2915 g.zErrlog = "-";
2916 }
2917 g.zExtRoot = find_option("extroot",0,1);
2918 builtin_set_js_delivery_mode(find_option("jsmode",0,1),0);
 
2919 zFileGlob = find_option("files-urlenc",0,1);
2920 if( zFileGlob ){
2921 char *z = mprintf("%s", zFileGlob);
2922 dehttpize(z);
2923 zFileGlob = z;
@@ -2933,10 +2938,11 @@
2933 Th_InitTraceLog();
2934 zPort = find_option("port", "P", 1);
2935 isUiCmd = g.argv[1][0]=='u';
2936 if( isUiCmd ){
2937 zInitPage = find_option("page", 0, 1);
 
2938 }
2939 zNotFound = find_option("notfound", 0, 1);
2940 allowRepoList = find_option("repolist",0,0)!=0;
2941 if( find_option("nocompress",0,0)!=0 ) g.fNoHttpCompress = 1;
2942 zAltBase = find_option("baseurl", 0, 1);
@@ -3047,29 +3053,32 @@
3047 FILE *sshIn;
3048 Blob ssh;
3049 char zLine[1000];
3050 blob_init(&ssh, 0, 0);
3051 transport_ssh_command(&ssh);
 
3052 blob_appendf(&ssh,
3053 " -t -L127.0.0.1:%d:127.0.0.1:%d -- %!$"
3054 " fossil ui --nobrowser --localauth --port %d",
3055 iPort, iPort, zRemote, iPort);
3056 if( zNotFound ) blob_appendf(&ssh, " --notfound %!$", zNotFound);
3057 if( zFileGlob ) blob_appendf(&ssh, " --files-urlenc %T", zFileGlob);
3058 if( g.zCkoutAlias ) blob_appendf(&ssh, " --ckout-alias %!$",g.zCkoutAlias);
3059 if( g.zExtRoot ) blob_appendf(&ssh, " --extroot %$", g.zExtRoot);
3060 if( skin_in_use() ) blob_appendf(&ssh, " --skin %s", skin_in_use());
 
 
3061 blob_appendf(&ssh, " %$", g.argv[2]);
3062 fossil_print("%s\n", blob_str(&ssh));
3063 sshIn = popen(blob_str(&ssh), "r");
3064 if( sshIn==0 ){
3065 fossil_fatal("unable to %s", blob_str(&ssh));
3066 }
3067 while( fgets(zLine, sizeof(zLine), sshIn) ){
3068 fputs(zLine, stdout);
3069 fflush(stdout);
3070 if( zBrowserCmd ){
3071 char *zCmd = mprintf(zBrowserCmd/*works-like:"%d"*/,iPort);
3072 fossil_system(zCmd);
3073 fossil_free(zCmd);
3074 fossil_free(zBrowserCmd);
3075 zBrowserCmd = 0;
3076
--- src/main.c
+++ src/main.c
@@ -2843,10 +2843,12 @@
2843 ** --ckout-alias NAME Treat URIs of the form /doc/NAME/... as if they were
2844 ** /doc/ckout/...
2845 ** --create Create a new REPOSITORY if it does not already exist
2846 ** --extroot DIR Document root for the /ext extension mechanism
2847 ** --files GLOBLIST Comma-separated list of glob patterns for static files
2848 ** --fossilcmd PATH Full pathname of the "fossil" executable on the remote
2849 ** system when REPOSITORY is remote. Default: "fossil"
2850 ** --localauth enable automatic login for requests from localhost
2851 ** --localhost listen on 127.0.0.1 only (always true for "ui")
2852 ** --https Indicates that the input is coming through a reverse
2853 ** proxy that has already translated HTTPS into HTTP.
2854 ** --jsmode MODE Determine how JavaScript is delivered with pages.
@@ -2902,10 +2904,12 @@
2904 int fCreate = 0; /* The --create flag */
2905 int fNoBrowser = 0; /* Do not auto-launch web-browser */
2906 const char *zInitPage = 0; /* Start on this page. --page option */
2907 int findServerArg = 2; /* argv index for find_server_repository() */
2908 char *zRemote = 0; /* Remote host on which to run "fossil ui" */
2909 const char *zJsMode; /* The --jsmode parameter */
2910 const char *zFossilCmd; /* Name of "fossil" binary on remote system */
2911
2912
2913 #if defined(_WIN32)
2914 const char *zStopperFile; /* Name of file used to terminate server */
2915 zStopperFile = find_option("stopper", 0, 1);
@@ -2913,11 +2917,12 @@
2917
2918 if( g.zErrlog==0 ){
2919 g.zErrlog = "-";
2920 }
2921 g.zExtRoot = find_option("extroot",0,1);
2922 zJsMode = find_option("jsmode",0,1);
2923 builtin_set_js_delivery_mode(zJsMode,0);
2924 zFileGlob = find_option("files-urlenc",0,1);
2925 if( zFileGlob ){
2926 char *z = mprintf("%s", zFileGlob);
2927 dehttpize(z);
2928 zFileGlob = z;
@@ -2933,10 +2938,11 @@
2938 Th_InitTraceLog();
2939 zPort = find_option("port", "P", 1);
2940 isUiCmd = g.argv[1][0]=='u';
2941 if( isUiCmd ){
2942 zInitPage = find_option("page", 0, 1);
2943 zFossilCmd = find_option("fossilcmd", 0, 1);
2944 }
2945 zNotFound = find_option("notfound", 0, 1);
2946 allowRepoList = find_option("repolist",0,0)!=0;
2947 if( find_option("nocompress",0,0)!=0 ) g.fNoHttpCompress = 1;
2948 zAltBase = find_option("baseurl", 0, 1);
@@ -3047,29 +3053,32 @@
3053 FILE *sshIn;
3054 Blob ssh;
3055 char zLine[1000];
3056 blob_init(&ssh, 0, 0);
3057 transport_ssh_command(&ssh);
3058 if( zFossilCmd==0 ) zFossilCmd = "fossil";
3059 blob_appendf(&ssh,
3060 " -t -L127.0.0.1:%d:127.0.0.1:%d -- %!$"
3061 " %$ ui --nobrowser --localauth --port %d",
3062 iPort, iPort, zRemote, zFossilCmd, iPort);
3063 if( zNotFound ) blob_appendf(&ssh, " --notfound %!$", zNotFound);
3064 if( zFileGlob ) blob_appendf(&ssh, " --files-urlenc %T", zFileGlob);
3065 if( g.zCkoutAlias ) blob_appendf(&ssh, " --ckout-alias %!$",g.zCkoutAlias);
3066 if( g.zExtRoot ) blob_appendf(&ssh, " --extroot %$", g.zExtRoot);
3067 if( skin_in_use() ) blob_appendf(&ssh, " --skin %s", skin_in_use());
3068 if( zJsMode ) blob_appendf(&ssh, " --jsmode %s", zJsMode);
3069 if( fCreate ) blob_appendf(&ssh, " --create");
3070 blob_appendf(&ssh, " %$", g.argv[2]);
3071 fossil_print("%s\n", blob_str(&ssh));
3072 sshIn = popen(blob_str(&ssh), "r");
3073 if( sshIn==0 ){
3074 fossil_fatal("unable to %s", blob_str(&ssh));
3075 }
3076 while( fgets(zLine, sizeof(zLine), sshIn) ){
3077 fputs(zLine, stdout);
3078 fflush(stdout);
3079 if( zBrowserCmd && sqlite3_strglob("*Listening for HTTP*",zLine)==0 ){
3080 char *zCmd = mprintf(zBrowserCmd/*works-like:"%d"*/,iPort);
3081 fossil_system(zCmd);
3082 fossil_free(zCmd);
3083 fossil_free(zBrowserCmd);
3084 zBrowserCmd = 0;
3085

Keyboard Shortcuts

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