Fossil SCM
Add the "-c N" option to "fossil 3-way --tk".
Commit
c4b68636e2d895c8f8961b622492b65a8e108009ddff81e7d2d8186905a4b81a
Parent
7002d98d7373dab…
2 files changed
+1
-1
+12
-5
+1
-1
| --- src/merge.tcl | ||
| +++ src/merge.tcl | ||
| @@ -158,11 +158,11 @@ | ||
| 158 | 158 | incr lnC |
| 159 | 159 | if {$key4=="3"} {set tag add} {set tag $dtag} |
| 160 | 160 | if {$key3=="1"} { |
| 161 | 161 | .txtC insert end [string range $A 1 end]\n $tag |
| 162 | 162 | } elseif {$key3=="2"} { |
| 163 | - .txtC insert end [string range $B 1 end]\n $tag | |
| 163 | + .txtC insert end [string range $B 1 end]\n chng | |
| 164 | 164 | } else { |
| 165 | 165 | .txtC insert end [string range $C 1 end]\n $tag |
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | if {$key4=="."} { |
| 169 | 169 |
| --- src/merge.tcl | |
| +++ src/merge.tcl | |
| @@ -158,11 +158,11 @@ | |
| 158 | incr lnC |
| 159 | if {$key4=="3"} {set tag add} {set tag $dtag} |
| 160 | if {$key3=="1"} { |
| 161 | .txtC insert end [string range $A 1 end]\n $tag |
| 162 | } elseif {$key3=="2"} { |
| 163 | .txtC insert end [string range $B 1 end]\n $tag |
| 164 | } else { |
| 165 | .txtC insert end [string range $C 1 end]\n $tag |
| 166 | } |
| 167 | } |
| 168 | if {$key4=="."} { |
| 169 |
| --- src/merge.tcl | |
| +++ src/merge.tcl | |
| @@ -158,11 +158,11 @@ | |
| 158 | incr lnC |
| 159 | if {$key4=="3"} {set tag add} {set tag $dtag} |
| 160 | if {$key3=="1"} { |
| 161 | .txtC insert end [string range $A 1 end]\n $tag |
| 162 | } elseif {$key3=="2"} { |
| 163 | .txtC insert end [string range $B 1 end]\n chng |
| 164 | } else { |
| 165 | .txtC insert end [string range $C 1 end]\n $tag |
| 166 | } |
| 167 | } |
| 168 | if {$key4=="."} { |
| 169 |
+12
-5
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -528,11 +528,10 @@ | ||
| 528 | 528 | p->xSame = tclSame; |
| 529 | 529 | p->xChngV1 = tclChngV1; |
| 530 | 530 | p->xChngV2 = tclChngV2; |
| 531 | 531 | p->xChngBoth = tclChngBoth; |
| 532 | 532 | p->xConflict = tclConflict; |
| 533 | - p->nContext = 6; | |
| 534 | 533 | } |
| 535 | 534 | /*****************************************************************************/ |
| 536 | 535 | |
| 537 | 536 | /* |
| 538 | 537 | ** The aC[] array contains triples of integers. Within each triple, the |
| @@ -769,20 +768,20 @@ | ||
| 769 | 768 | ** directly. Otherwise: |
| 770 | 769 | ** (1) Write the Tcl/Tk script used for rendering into a temp file. |
| 771 | 770 | ** (2) Invoke "tclsh" on the temp file using fossil_system(). |
| 772 | 771 | ** (3) Delete the temp file. |
| 773 | 772 | */ |
| 774 | -void merge_tk(const char *zSubCmd, int firstArg){ | |
| 773 | +void merge_tk(const char *zSubCmd, int firstArg, int nContext){ | |
| 775 | 774 | int i; |
| 776 | 775 | Blob script; |
| 777 | 776 | const char *zTempFile = 0; |
| 778 | 777 | char *zCmd; |
| 779 | 778 | const char *zTclsh; |
| 780 | 779 | int bDarkMode = find_option("dark",0,0)!=0; |
| 781 | 780 | blob_zero(&script); |
| 782 | - blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl", | |
| 783 | - g.nameOfExe, zSubCmd); | |
| 781 | + blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl -c %d", | |
| 782 | + g.nameOfExe, zSubCmd, nContext); | |
| 784 | 783 | find_option("tcl",0,0); |
| 785 | 784 | find_option("debug",0,0); |
| 786 | 785 | zTclsh = find_option("tclsh",0,1); |
| 787 | 786 | if( zTclsh==0 ){ |
| 788 | 787 | zTclsh = db_get("tclsh",0); |
| @@ -863,10 +862,11 @@ | ||
| 863 | 862 | MergeBuilder s; |
| 864 | 863 | int nConflict; |
| 865 | 864 | Blob pivot, v1, v2, out; |
| 866 | 865 | int noWarn = 0; |
| 867 | 866 | int flagTk = 0; |
| 867 | + const char *zCnt; | |
| 868 | 868 | |
| 869 | 869 | mergebuilder_init_text(&s); |
| 870 | 870 | if( find_option("debug", 0, 0) ){ |
| 871 | 871 | mergebuilder_init(&s); |
| 872 | 872 | } |
| @@ -873,10 +873,17 @@ | ||
| 873 | 873 | if( find_option("tcl", 0, 0) ){ |
| 874 | 874 | mergebuilder_init_tcl(&s); |
| 875 | 875 | noWarn = 1; |
| 876 | 876 | } |
| 877 | 877 | flagTk = find_option("tk", 0, 0)!=0; |
| 878 | + zCnt = find_option("context", "c", 1); | |
| 879 | + if( zCnt ){ | |
| 880 | + s.nContext = atoi(zCnt); | |
| 881 | + if( s.nContext<0 ) s.nContext = 0xfffffff; | |
| 882 | + }else{ | |
| 883 | + s.nContext = 6; | |
| 884 | + } | |
| 878 | 885 | blob_zero(&pivot); s.pPivot = &pivot; |
| 879 | 886 | blob_zero(&v1); s.pV1 = &v1; |
| 880 | 887 | blob_zero(&v2); s.pV2 = &v2; |
| 881 | 888 | blob_zero(&out); s.pOut = &out; |
| 882 | 889 | |
| @@ -889,11 +896,11 @@ | ||
| 889 | 896 | if( flagTk ){ |
| 890 | 897 | if( g.argc==6 ){ |
| 891 | 898 | fossil_fatal("Cannot use an output file (\"%s\") with the --tk option", |
| 892 | 899 | g.argv[5]); |
| 893 | 900 | } |
| 894 | - merge_tk("3-way-merge", 2); | |
| 901 | + merge_tk("3-way-merge", 2, s.nContext); | |
| 895 | 902 | return; |
| 896 | 903 | } |
| 897 | 904 | if( blob_read_from_file(s.pPivot, g.argv[2], ExtFILE)<0 ){ |
| 898 | 905 | fossil_fatal("cannot read %s", g.argv[2]); |
| 899 | 906 | } |
| 900 | 907 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -528,11 +528,10 @@ | |
| 528 | p->xSame = tclSame; |
| 529 | p->xChngV1 = tclChngV1; |
| 530 | p->xChngV2 = tclChngV2; |
| 531 | p->xChngBoth = tclChngBoth; |
| 532 | p->xConflict = tclConflict; |
| 533 | p->nContext = 6; |
| 534 | } |
| 535 | /*****************************************************************************/ |
| 536 | |
| 537 | /* |
| 538 | ** The aC[] array contains triples of integers. Within each triple, the |
| @@ -769,20 +768,20 @@ | |
| 769 | ** directly. Otherwise: |
| 770 | ** (1) Write the Tcl/Tk script used for rendering into a temp file. |
| 771 | ** (2) Invoke "tclsh" on the temp file using fossil_system(). |
| 772 | ** (3) Delete the temp file. |
| 773 | */ |
| 774 | void merge_tk(const char *zSubCmd, int firstArg){ |
| 775 | int i; |
| 776 | Blob script; |
| 777 | const char *zTempFile = 0; |
| 778 | char *zCmd; |
| 779 | const char *zTclsh; |
| 780 | int bDarkMode = find_option("dark",0,0)!=0; |
| 781 | blob_zero(&script); |
| 782 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl", |
| 783 | g.nameOfExe, zSubCmd); |
| 784 | find_option("tcl",0,0); |
| 785 | find_option("debug",0,0); |
| 786 | zTclsh = find_option("tclsh",0,1); |
| 787 | if( zTclsh==0 ){ |
| 788 | zTclsh = db_get("tclsh",0); |
| @@ -863,10 +862,11 @@ | |
| 863 | MergeBuilder s; |
| 864 | int nConflict; |
| 865 | Blob pivot, v1, v2, out; |
| 866 | int noWarn = 0; |
| 867 | int flagTk = 0; |
| 868 | |
| 869 | mergebuilder_init_text(&s); |
| 870 | if( find_option("debug", 0, 0) ){ |
| 871 | mergebuilder_init(&s); |
| 872 | } |
| @@ -873,10 +873,17 @@ | |
| 873 | if( find_option("tcl", 0, 0) ){ |
| 874 | mergebuilder_init_tcl(&s); |
| 875 | noWarn = 1; |
| 876 | } |
| 877 | flagTk = find_option("tk", 0, 0)!=0; |
| 878 | blob_zero(&pivot); s.pPivot = &pivot; |
| 879 | blob_zero(&v1); s.pV1 = &v1; |
| 880 | blob_zero(&v2); s.pV2 = &v2; |
| 881 | blob_zero(&out); s.pOut = &out; |
| 882 | |
| @@ -889,11 +896,11 @@ | |
| 889 | if( flagTk ){ |
| 890 | if( g.argc==6 ){ |
| 891 | fossil_fatal("Cannot use an output file (\"%s\") with the --tk option", |
| 892 | g.argv[5]); |
| 893 | } |
| 894 | merge_tk("3-way-merge", 2); |
| 895 | return; |
| 896 | } |
| 897 | if( blob_read_from_file(s.pPivot, g.argv[2], ExtFILE)<0 ){ |
| 898 | fossil_fatal("cannot read %s", g.argv[2]); |
| 899 | } |
| 900 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -528,11 +528,10 @@ | |
| 528 | p->xSame = tclSame; |
| 529 | p->xChngV1 = tclChngV1; |
| 530 | p->xChngV2 = tclChngV2; |
| 531 | p->xChngBoth = tclChngBoth; |
| 532 | p->xConflict = tclConflict; |
| 533 | } |
| 534 | /*****************************************************************************/ |
| 535 | |
| 536 | /* |
| 537 | ** The aC[] array contains triples of integers. Within each triple, the |
| @@ -769,20 +768,20 @@ | |
| 768 | ** directly. Otherwise: |
| 769 | ** (1) Write the Tcl/Tk script used for rendering into a temp file. |
| 770 | ** (2) Invoke "tclsh" on the temp file using fossil_system(). |
| 771 | ** (3) Delete the temp file. |
| 772 | */ |
| 773 | void merge_tk(const char *zSubCmd, int firstArg, int nContext){ |
| 774 | int i; |
| 775 | Blob script; |
| 776 | const char *zTempFile = 0; |
| 777 | char *zCmd; |
| 778 | const char *zTclsh; |
| 779 | int bDarkMode = find_option("dark",0,0)!=0; |
| 780 | blob_zero(&script); |
| 781 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl -c %d", |
| 782 | g.nameOfExe, zSubCmd, nContext); |
| 783 | find_option("tcl",0,0); |
| 784 | find_option("debug",0,0); |
| 785 | zTclsh = find_option("tclsh",0,1); |
| 786 | if( zTclsh==0 ){ |
| 787 | zTclsh = db_get("tclsh",0); |
| @@ -863,10 +862,11 @@ | |
| 862 | MergeBuilder s; |
| 863 | int nConflict; |
| 864 | Blob pivot, v1, v2, out; |
| 865 | int noWarn = 0; |
| 866 | int flagTk = 0; |
| 867 | const char *zCnt; |
| 868 | |
| 869 | mergebuilder_init_text(&s); |
| 870 | if( find_option("debug", 0, 0) ){ |
| 871 | mergebuilder_init(&s); |
| 872 | } |
| @@ -873,10 +873,17 @@ | |
| 873 | if( find_option("tcl", 0, 0) ){ |
| 874 | mergebuilder_init_tcl(&s); |
| 875 | noWarn = 1; |
| 876 | } |
| 877 | flagTk = find_option("tk", 0, 0)!=0; |
| 878 | zCnt = find_option("context", "c", 1); |
| 879 | if( zCnt ){ |
| 880 | s.nContext = atoi(zCnt); |
| 881 | if( s.nContext<0 ) s.nContext = 0xfffffff; |
| 882 | }else{ |
| 883 | s.nContext = 6; |
| 884 | } |
| 885 | blob_zero(&pivot); s.pPivot = &pivot; |
| 886 | blob_zero(&v1); s.pV1 = &v1; |
| 887 | blob_zero(&v2); s.pV2 = &v2; |
| 888 | blob_zero(&out); s.pOut = &out; |
| 889 | |
| @@ -889,11 +896,11 @@ | |
| 896 | if( flagTk ){ |
| 897 | if( g.argc==6 ){ |
| 898 | fossil_fatal("Cannot use an output file (\"%s\") with the --tk option", |
| 899 | g.argv[5]); |
| 900 | } |
| 901 | merge_tk("3-way-merge", 2, s.nContext); |
| 902 | return; |
| 903 | } |
| 904 | if( blob_read_from_file(s.pPivot, g.argv[2], ExtFILE)<0 ){ |
| 905 | fossil_fatal("cannot read %s", g.argv[2]); |
| 906 | } |
| 907 |