Fossil SCM
Add the --fossilcmd option to "fossil ui". Carry the --jsmode and --create options through to the remote fossil.
Commit
c359589ef6371bf3a2c5eccbbb3ba9e5bc272b13a7c9424dba6dc20d0a4affad
Parent
12b5eed944b70f7…
1 file changed
+13
-4
+13
-4
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2843,10 +2843,12 @@ | ||
| 2843 | 2843 | ** --ckout-alias NAME Treat URIs of the form /doc/NAME/... as if they were |
| 2844 | 2844 | ** /doc/ckout/... |
| 2845 | 2845 | ** --create Create a new REPOSITORY if it does not already exist |
| 2846 | 2846 | ** --extroot DIR Document root for the /ext extension mechanism |
| 2847 | 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" | |
| 2848 | 2850 | ** --localauth enable automatic login for requests from localhost |
| 2849 | 2851 | ** --localhost listen on 127.0.0.1 only (always true for "ui") |
| 2850 | 2852 | ** --https Indicates that the input is coming through a reverse |
| 2851 | 2853 | ** proxy that has already translated HTTPS into HTTP. |
| 2852 | 2854 | ** --jsmode MODE Determine how JavaScript is delivered with pages. |
| @@ -2902,10 +2904,12 @@ | ||
| 2902 | 2904 | int fCreate = 0; /* The --create flag */ |
| 2903 | 2905 | int fNoBrowser = 0; /* Do not auto-launch web-browser */ |
| 2904 | 2906 | const char *zInitPage = 0; /* Start on this page. --page option */ |
| 2905 | 2907 | int findServerArg = 2; /* argv index for find_server_repository() */ |
| 2906 | 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 */ | |
| 2907 | 2911 | |
| 2908 | 2912 | |
| 2909 | 2913 | #if defined(_WIN32) |
| 2910 | 2914 | const char *zStopperFile; /* Name of file used to terminate server */ |
| 2911 | 2915 | zStopperFile = find_option("stopper", 0, 1); |
| @@ -2913,11 +2917,12 @@ | ||
| 2913 | 2917 | |
| 2914 | 2918 | if( g.zErrlog==0 ){ |
| 2915 | 2919 | g.zErrlog = "-"; |
| 2916 | 2920 | } |
| 2917 | 2921 | 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); | |
| 2919 | 2924 | zFileGlob = find_option("files-urlenc",0,1); |
| 2920 | 2925 | if( zFileGlob ){ |
| 2921 | 2926 | char *z = mprintf("%s", zFileGlob); |
| 2922 | 2927 | dehttpize(z); |
| 2923 | 2928 | zFileGlob = z; |
| @@ -2933,10 +2938,11 @@ | ||
| 2933 | 2938 | Th_InitTraceLog(); |
| 2934 | 2939 | zPort = find_option("port", "P", 1); |
| 2935 | 2940 | isUiCmd = g.argv[1][0]=='u'; |
| 2936 | 2941 | if( isUiCmd ){ |
| 2937 | 2942 | zInitPage = find_option("page", 0, 1); |
| 2943 | + zFossilCmd = find_option("fossilcmd", 0, 1); | |
| 2938 | 2944 | } |
| 2939 | 2945 | zNotFound = find_option("notfound", 0, 1); |
| 2940 | 2946 | allowRepoList = find_option("repolist",0,0)!=0; |
| 2941 | 2947 | if( find_option("nocompress",0,0)!=0 ) g.fNoHttpCompress = 1; |
| 2942 | 2948 | zAltBase = find_option("baseurl", 0, 1); |
| @@ -3047,29 +3053,32 @@ | ||
| 3047 | 3053 | FILE *sshIn; |
| 3048 | 3054 | Blob ssh; |
| 3049 | 3055 | char zLine[1000]; |
| 3050 | 3056 | blob_init(&ssh, 0, 0); |
| 3051 | 3057 | transport_ssh_command(&ssh); |
| 3058 | + if( zFossilCmd==0 ) zFossilCmd = "fossil"; | |
| 3052 | 3059 | blob_appendf(&ssh, |
| 3053 | 3060 | " -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); | |
| 3056 | 3063 | if( zNotFound ) blob_appendf(&ssh, " --notfound %!$", zNotFound); |
| 3057 | 3064 | if( zFileGlob ) blob_appendf(&ssh, " --files-urlenc %T", zFileGlob); |
| 3058 | 3065 | if( g.zCkoutAlias ) blob_appendf(&ssh, " --ckout-alias %!$",g.zCkoutAlias); |
| 3059 | 3066 | if( g.zExtRoot ) blob_appendf(&ssh, " --extroot %$", g.zExtRoot); |
| 3060 | 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"); | |
| 3061 | 3070 | blob_appendf(&ssh, " %$", g.argv[2]); |
| 3062 | 3071 | fossil_print("%s\n", blob_str(&ssh)); |
| 3063 | 3072 | sshIn = popen(blob_str(&ssh), "r"); |
| 3064 | 3073 | if( sshIn==0 ){ |
| 3065 | 3074 | fossil_fatal("unable to %s", blob_str(&ssh)); |
| 3066 | 3075 | } |
| 3067 | 3076 | while( fgets(zLine, sizeof(zLine), sshIn) ){ |
| 3068 | 3077 | fputs(zLine, stdout); |
| 3069 | 3078 | fflush(stdout); |
| 3070 | - if( zBrowserCmd ){ | |
| 3079 | + if( zBrowserCmd && sqlite3_strglob("*Listening for HTTP*",zLine)==0 ){ | |
| 3071 | 3080 | char *zCmd = mprintf(zBrowserCmd/*works-like:"%d"*/,iPort); |
| 3072 | 3081 | fossil_system(zCmd); |
| 3073 | 3082 | fossil_free(zCmd); |
| 3074 | 3083 | fossil_free(zBrowserCmd); |
| 3075 | 3084 | zBrowserCmd = 0; |
| 3076 | 3085 |
| --- 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 |