Fossil SCM

Add the "-c N" option to "fossil 3-way --tk".

drh 2024-12-03 01:31 merge-enhancements
Commit c4b68636e2d895c8f8961b622492b65a8e108009ddff81e7d2d8186905a4b81a
2 files changed +1 -1 +12 -5
+1 -1
--- src/merge.tcl
+++ src/merge.tcl
@@ -158,11 +158,11 @@
158158
incr lnC
159159
if {$key4=="3"} {set tag add} {set tag $dtag}
160160
if {$key3=="1"} {
161161
.txtC insert end [string range $A 1 end]\n $tag
162162
} 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
164164
} else {
165165
.txtC insert end [string range $C 1 end]\n $tag
166166
}
167167
}
168168
if {$key4=="."} {
169169
--- 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 @@
528528
p->xSame = tclSame;
529529
p->xChngV1 = tclChngV1;
530530
p->xChngV2 = tclChngV2;
531531
p->xChngBoth = tclChngBoth;
532532
p->xConflict = tclConflict;
533
- p->nContext = 6;
534533
}
535534
/*****************************************************************************/
536535
537536
/*
538537
** The aC[] array contains triples of integers. Within each triple, the
@@ -769,20 +768,20 @@
769768
** directly. Otherwise:
770769
** (1) Write the Tcl/Tk script used for rendering into a temp file.
771770
** (2) Invoke "tclsh" on the temp file using fossil_system().
772771
** (3) Delete the temp file.
773772
*/
774
-void merge_tk(const char *zSubCmd, int firstArg){
773
+void merge_tk(const char *zSubCmd, int firstArg, int nContext){
775774
int i;
776775
Blob script;
777776
const char *zTempFile = 0;
778777
char *zCmd;
779778
const char *zTclsh;
780779
int bDarkMode = find_option("dark",0,0)!=0;
781780
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);
784783
find_option("tcl",0,0);
785784
find_option("debug",0,0);
786785
zTclsh = find_option("tclsh",0,1);
787786
if( zTclsh==0 ){
788787
zTclsh = db_get("tclsh",0);
@@ -863,10 +862,11 @@
863862
MergeBuilder s;
864863
int nConflict;
865864
Blob pivot, v1, v2, out;
866865
int noWarn = 0;
867866
int flagTk = 0;
867
+ const char *zCnt;
868868
869869
mergebuilder_init_text(&s);
870870
if( find_option("debug", 0, 0) ){
871871
mergebuilder_init(&s);
872872
}
@@ -873,10 +873,17 @@
873873
if( find_option("tcl", 0, 0) ){
874874
mergebuilder_init_tcl(&s);
875875
noWarn = 1;
876876
}
877877
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
+ }
878885
blob_zero(&pivot); s.pPivot = &pivot;
879886
blob_zero(&v1); s.pV1 = &v1;
880887
blob_zero(&v2); s.pV2 = &v2;
881888
blob_zero(&out); s.pOut = &out;
882889
@@ -889,11 +896,11 @@
889896
if( flagTk ){
890897
if( g.argc==6 ){
891898
fossil_fatal("Cannot use an output file (\"%s\") with the --tk option",
892899
g.argv[5]);
893900
}
894
- merge_tk("3-way-merge", 2);
901
+ merge_tk("3-way-merge", 2, s.nContext);
895902
return;
896903
}
897904
if( blob_read_from_file(s.pPivot, g.argv[2], ExtFILE)<0 ){
898905
fossil_fatal("cannot read %s", g.argv[2]);
899906
}
900907
--- 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

Keyboard Shortcuts

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