Fossil SCM
Add the --tclsh command to "fossil diff" in order to specify an alternative TCL interpreter.
Commit
9fc945c056ac3da1e9de0628b942a16064519dd174174164708c8cb294c4ff43
Parent
03cc3329384cd0c…
2 files changed
+6
+8
-2
M
src/db.c
+6
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -3473,10 +3473,16 @@ | ||
| 3473 | 3473 | ** This is the setup script to be evaluated after creating |
| 3474 | 3474 | ** and initializing the Tcl interpreter. By default, this |
| 3475 | 3475 | ** is empty and no extra setup is performed. |
| 3476 | 3476 | */ |
| 3477 | 3477 | #endif /* FOSSIL_ENABLE_TCL */ |
| 3478 | +/* | |
| 3479 | +** SETTING: tclsh width=80 default=tclsh | |
| 3480 | +** Name of the external TCL interpreter used for such things | |
| 3481 | +** as running the GUI diff viewer launched by the --tk option | |
| 3482 | +** of the various "diff" commands. | |
| 3483 | +*/ | |
| 3478 | 3484 | #ifdef FOSSIL_ENABLE_TH1_DOCS |
| 3479 | 3485 | /* |
| 3480 | 3486 | ** SETTING: th1-docs boolean default=off |
| 3481 | 3487 | ** If enabled, this allows embedded documentation files to contain |
| 3482 | 3488 | ** arbitrary TH1 scripts that are evaluated on the server. If native |
| 3483 | 3489 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -3473,10 +3473,16 @@ | |
| 3473 | ** This is the setup script to be evaluated after creating |
| 3474 | ** and initializing the Tcl interpreter. By default, this |
| 3475 | ** is empty and no extra setup is performed. |
| 3476 | */ |
| 3477 | #endif /* FOSSIL_ENABLE_TCL */ |
| 3478 | #ifdef FOSSIL_ENABLE_TH1_DOCS |
| 3479 | /* |
| 3480 | ** SETTING: th1-docs boolean default=off |
| 3481 | ** If enabled, this allows embedded documentation files to contain |
| 3482 | ** arbitrary TH1 scripts that are evaluated on the server. If native |
| 3483 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -3473,10 +3473,16 @@ | |
| 3473 | ** This is the setup script to be evaluated after creating |
| 3474 | ** and initializing the Tcl interpreter. By default, this |
| 3475 | ** is empty and no extra setup is performed. |
| 3476 | */ |
| 3477 | #endif /* FOSSIL_ENABLE_TCL */ |
| 3478 | /* |
| 3479 | ** SETTING: tclsh width=80 default=tclsh |
| 3480 | ** Name of the external TCL interpreter used for such things |
| 3481 | ** as running the GUI diff viewer launched by the --tk option |
| 3482 | ** of the various "diff" commands. |
| 3483 | */ |
| 3484 | #ifdef FOSSIL_ENABLE_TH1_DOCS |
| 3485 | /* |
| 3486 | ** SETTING: th1-docs boolean default=off |
| 3487 | ** If enabled, this allows embedded documentation files to contain |
| 3488 | ** arbitrary TH1 scripts that are evaluated on the server. If native |
| 3489 |
+8
-2
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -697,17 +697,22 @@ | ||
| 697 | 697 | void diff_tk(const char *zSubCmd, int firstArg){ |
| 698 | 698 | int i; |
| 699 | 699 | Blob script; |
| 700 | 700 | const char *zTempFile = 0; |
| 701 | 701 | char *zCmd; |
| 702 | + const char *zTclsh; | |
| 702 | 703 | blob_zero(&script); |
| 703 | 704 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", |
| 704 | 705 | g.nameOfExe, zSubCmd); |
| 705 | 706 | find_option("html",0,0); |
| 706 | 707 | find_option("side-by-side","y",0); |
| 707 | 708 | find_option("internal","i",0); |
| 708 | 709 | find_option("verbose","v",0); |
| 710 | + zTclsh = find_option("tclsh",0,1); | |
| 711 | + if( zTclsh==0 ){ | |
| 712 | + zTclsh = db_get("tclsh","tclsh"); | |
| 713 | + } | |
| 709 | 714 | /* The undocumented --script FILENAME option causes the Tk script to |
| 710 | 715 | ** be written into the FILENAME instead of being run. This is used |
| 711 | 716 | ** for testing and debugging. */ |
| 712 | 717 | zTempFile = find_option("script",0,1); |
| 713 | 718 | for(i=firstArg; i<g.argc; i++){ |
| @@ -721,11 +726,11 @@ | ||
| 721 | 726 | } |
| 722 | 727 | } |
| 723 | 728 | blob_appendf(&script, "}\n%s", builtin_file("diff.tcl", 0)); |
| 724 | 729 | if( zTempFile ){ |
| 725 | 730 | blob_write_to_file(&script, zTempFile); |
| 726 | - fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile); | |
| 731 | + fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile); | |
| 727 | 732 | }else{ |
| 728 | 733 | #if defined(FOSSIL_ENABLE_TCL) |
| 729 | 734 | Th_FossilInit(TH_INIT_DEFAULT); |
| 730 | 735 | if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script), |
| 731 | 736 | blob_size(&script), 1, 1, 0)==TCL_OK ){ |
| @@ -738,11 +743,11 @@ | ||
| 738 | 743 | * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback |
| 739 | 744 | * to using the external "tclsh", if available. |
| 740 | 745 | */ |
| 741 | 746 | #endif |
| 742 | 747 | zTempFile = write_blob_to_temp_file(&script); |
| 743 | - zCmd = mprintf("tclsh \"%s\"", zTempFile); | |
| 748 | + zCmd = mprintf("\"%s\" \"%s\"", zTclsh, zTempFile); | |
| 744 | 749 | fossil_system(zCmd); |
| 745 | 750 | file_delete(zTempFile); |
| 746 | 751 | fossil_free(zCmd); |
| 747 | 752 | } |
| 748 | 753 | blob_reset(&script); |
| @@ -825,10 +830,11 @@ | ||
| 825 | 830 | ** --internal|-i Use internal diff logic |
| 826 | 831 | ** --new-file|-N Show complete text of added and deleted files |
| 827 | 832 | ** --numstat Show only the number of lines delete and added |
| 828 | 833 | ** --side-by-side|-y Side-by-side diff |
| 829 | 834 | ** --strip-trailing-cr Strip trailing CR |
| 835 | +** --tclsh PATH Tcl/Tk used for --tk (default: "tclsh") | |
| 830 | 836 | ** --tk Launch a Tcl/Tk GUI for display |
| 831 | 837 | ** --to VERSION Select VERSION as target for the diff |
| 832 | 838 | ** --undo Diff against the "undo" buffer |
| 833 | 839 | ** --unified Unified diff |
| 834 | 840 | ** -v|--verbose Output complete text of added or deleted files |
| 835 | 841 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -697,17 +697,22 @@ | |
| 697 | void diff_tk(const char *zSubCmd, int firstArg){ |
| 698 | int i; |
| 699 | Blob script; |
| 700 | const char *zTempFile = 0; |
| 701 | char *zCmd; |
| 702 | blob_zero(&script); |
| 703 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", |
| 704 | g.nameOfExe, zSubCmd); |
| 705 | find_option("html",0,0); |
| 706 | find_option("side-by-side","y",0); |
| 707 | find_option("internal","i",0); |
| 708 | find_option("verbose","v",0); |
| 709 | /* The undocumented --script FILENAME option causes the Tk script to |
| 710 | ** be written into the FILENAME instead of being run. This is used |
| 711 | ** for testing and debugging. */ |
| 712 | zTempFile = find_option("script",0,1); |
| 713 | for(i=firstArg; i<g.argc; i++){ |
| @@ -721,11 +726,11 @@ | |
| 721 | } |
| 722 | } |
| 723 | blob_appendf(&script, "}\n%s", builtin_file("diff.tcl", 0)); |
| 724 | if( zTempFile ){ |
| 725 | blob_write_to_file(&script, zTempFile); |
| 726 | fossil_print("To see diff, run: tclsh \"%s\"\n", zTempFile); |
| 727 | }else{ |
| 728 | #if defined(FOSSIL_ENABLE_TCL) |
| 729 | Th_FossilInit(TH_INIT_DEFAULT); |
| 730 | if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script), |
| 731 | blob_size(&script), 1, 1, 0)==TCL_OK ){ |
| @@ -738,11 +743,11 @@ | |
| 738 | * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback |
| 739 | * to using the external "tclsh", if available. |
| 740 | */ |
| 741 | #endif |
| 742 | zTempFile = write_blob_to_temp_file(&script); |
| 743 | zCmd = mprintf("tclsh \"%s\"", zTempFile); |
| 744 | fossil_system(zCmd); |
| 745 | file_delete(zTempFile); |
| 746 | fossil_free(zCmd); |
| 747 | } |
| 748 | blob_reset(&script); |
| @@ -825,10 +830,11 @@ | |
| 825 | ** --internal|-i Use internal diff logic |
| 826 | ** --new-file|-N Show complete text of added and deleted files |
| 827 | ** --numstat Show only the number of lines delete and added |
| 828 | ** --side-by-side|-y Side-by-side diff |
| 829 | ** --strip-trailing-cr Strip trailing CR |
| 830 | ** --tk Launch a Tcl/Tk GUI for display |
| 831 | ** --to VERSION Select VERSION as target for the diff |
| 832 | ** --undo Diff against the "undo" buffer |
| 833 | ** --unified Unified diff |
| 834 | ** -v|--verbose Output complete text of added or deleted files |
| 835 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -697,17 +697,22 @@ | |
| 697 | void diff_tk(const char *zSubCmd, int firstArg){ |
| 698 | int i; |
| 699 | Blob script; |
| 700 | const char *zTempFile = 0; |
| 701 | char *zCmd; |
| 702 | const char *zTclsh; |
| 703 | blob_zero(&script); |
| 704 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", |
| 705 | g.nameOfExe, zSubCmd); |
| 706 | find_option("html",0,0); |
| 707 | find_option("side-by-side","y",0); |
| 708 | find_option("internal","i",0); |
| 709 | find_option("verbose","v",0); |
| 710 | zTclsh = find_option("tclsh",0,1); |
| 711 | if( zTclsh==0 ){ |
| 712 | zTclsh = db_get("tclsh","tclsh"); |
| 713 | } |
| 714 | /* The undocumented --script FILENAME option causes the Tk script to |
| 715 | ** be written into the FILENAME instead of being run. This is used |
| 716 | ** for testing and debugging. */ |
| 717 | zTempFile = find_option("script",0,1); |
| 718 | for(i=firstArg; i<g.argc; i++){ |
| @@ -721,11 +726,11 @@ | |
| 726 | } |
| 727 | } |
| 728 | blob_appendf(&script, "}\n%s", builtin_file("diff.tcl", 0)); |
| 729 | if( zTempFile ){ |
| 730 | blob_write_to_file(&script, zTempFile); |
| 731 | fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile); |
| 732 | }else{ |
| 733 | #if defined(FOSSIL_ENABLE_TCL) |
| 734 | Th_FossilInit(TH_INIT_DEFAULT); |
| 735 | if( evaluateTclWithEvents(g.interp, &g.tcl, blob_str(&script), |
| 736 | blob_size(&script), 1, 1, 0)==TCL_OK ){ |
| @@ -738,11 +743,11 @@ | |
| 743 | * dynamically (e.g. x64 Tcl with x86 Fossil). Therefore, fallback |
| 744 | * to using the external "tclsh", if available. |
| 745 | */ |
| 746 | #endif |
| 747 | zTempFile = write_blob_to_temp_file(&script); |
| 748 | zCmd = mprintf("\"%s\" \"%s\"", zTclsh, zTempFile); |
| 749 | fossil_system(zCmd); |
| 750 | file_delete(zTempFile); |
| 751 | fossil_free(zCmd); |
| 752 | } |
| 753 | blob_reset(&script); |
| @@ -825,10 +830,11 @@ | |
| 830 | ** --internal|-i Use internal diff logic |
| 831 | ** --new-file|-N Show complete text of added and deleted files |
| 832 | ** --numstat Show only the number of lines delete and added |
| 833 | ** --side-by-side|-y Side-by-side diff |
| 834 | ** --strip-trailing-cr Strip trailing CR |
| 835 | ** --tclsh PATH Tcl/Tk used for --tk (default: "tclsh") |
| 836 | ** --tk Launch a Tcl/Tk GUI for display |
| 837 | ** --to VERSION Select VERSION as target for the diff |
| 838 | ** --undo Diff against the "undo" buffer |
| 839 | ** --unified Unified diff |
| 840 | ** -v|--verbose Output complete text of added or deleted files |
| 841 |