Fossil SCM
Continuing work on the --tk option to the 3-way-merge command.
Commit
57ae422a377852df2eda874d0041eedd435d012709e146af319c97179aa5482d
Parent
bdcacd55be6762e…
2 files changed
+43
-23
+25
-3
+43
-23
| --- src/merge.tcl | ||
| +++ src/merge.tcl | ||
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | LN_COL_FG #444444 |
| 17 | 17 | TXT_COL_BG #ffffff |
| 18 | 18 | TXT_COL_FG #000000 |
| 19 | 19 | MKR_COL_BG #444444 |
| 20 | 20 | MKR_COL_FG #dddddd |
| 21 | - CHNG_BG #d0d0ff | |
| 21 | + CHNG_BG #d0d070 | |
| 22 | 22 | ADD_BG #c0ffc0 |
| 23 | 23 | RM_BG #ffc0c0 |
| 24 | 24 | HR_FG #444444 |
| 25 | 25 | HR_PAD_TOP 4 |
| 26 | 26 | HR_PAD_BTM 8 |
| @@ -40,11 +40,11 @@ | ||
| 40 | 40 | LN_COL_FG #444444 |
| 41 | 41 | TXT_COL_BG #3f3f3f |
| 42 | 42 | TXT_COL_FG #dcdccc |
| 43 | 43 | MKR_COL_BG #444444 |
| 44 | 44 | MKR_COL_FG #dddddd |
| 45 | - CHNG_BG #6a6afc | |
| 45 | + CHNG_BG #6a6a00 | |
| 46 | 46 | ADD_BG #57934c |
| 47 | 47 | RM_BG #ef6767 |
| 48 | 48 | HR_FG #444444 |
| 49 | 49 | HR_PAD_TOP 4 |
| 50 | 50 | HR_PAD_BTM 8 |
| @@ -106,60 +106,80 @@ | ||
| 106 | 106 | set lnA 1 |
| 107 | 107 | set lnB 1 |
| 108 | 108 | set lnC 1 |
| 109 | 109 | set lnD 1 |
| 110 | 110 | foreach {A B C D} $mergetxt { |
| 111 | - set key [string index $A 0] | |
| 112 | - if {$key=="."} { | |
| 111 | + set key1 [string index $A 0] | |
| 112 | + if {$key1=="S"} { | |
| 113 | + set N [string range $A 1 end] | |
| 114 | + incr lnA $N | |
| 115 | + incr lnB $N | |
| 116 | + incr lnC $N | |
| 117 | + incr lnD $N | |
| 118 | + .lnA insert end ...\n hrln | |
| 119 | + .txtA insert end [string repeat . 30]\n hrtxt | |
| 120 | + .lnB insert end ...\n hrln | |
| 121 | + .txtB insert end [string repeat . 30]\n hrtxt | |
| 122 | + .lnC insert end ...\n hrln | |
| 123 | + .txtC insert end [string repeat . 30]\n hrtxt | |
| 124 | + .lnD insert end ...\n hrln | |
| 125 | + .txtD insert end [string repeat . 30]\n hrtxt | |
| 126 | + continue | |
| 127 | + } | |
| 128 | + set key2 [string index $B 0] | |
| 129 | + set key3 [string index $C 0] | |
| 130 | + set key4 [string index $D 0] | |
| 131 | + if {$key1=="."} { | |
| 113 | 132 | .lnA insert end \n - |
| 114 | 133 | .txtA insert end \n - |
| 115 | 134 | } else { |
| 116 | 135 | .lnA insert end $lnA\n - |
| 117 | 136 | incr lnA |
| 118 | 137 | .txtA insert end [string range $A 1 end]\n - |
| 119 | 138 | } |
| 120 | - set key [string index $B 0] | |
| 121 | - if {$key=="."} { | |
| 139 | + if {$key2=="."} { | |
| 122 | 140 | .lnB insert end \n - |
| 123 | 141 | .txtB insert end \n - |
| 124 | 142 | } else { |
| 125 | 143 | .lnB insert end $lnB\n - |
| 126 | 144 | incr lnB |
| 127 | - if {$key=="1"} { | |
| 128 | - .txtB insert end [string range $A 1 end]\n - | |
| 145 | + if {$key4=="2"} {set tag chng} {set tag -} | |
| 146 | + if {$key2=="1"} { | |
| 147 | + .txtB insert end [string range $A 1 end]\n $tag | |
| 129 | 148 | } else { |
| 130 | - .txtB insert end [string range $B 1 end]\n - | |
| 149 | + .txtB insert end [string range $B 1 end]\n $tag | |
| 131 | 150 | } |
| 132 | 151 | } |
| 133 | - set key [string index $C 0] | |
| 134 | - if {$key=="."} { | |
| 152 | + if {$key3=="."} { | |
| 135 | 153 | .lnC insert end \n - |
| 136 | 154 | .txtC insert end \n - |
| 137 | 155 | } else { |
| 138 | 156 | .lnC insert end $lnC\n - |
| 139 | 157 | incr lnC |
| 140 | - if {$key=="1"} { | |
| 141 | - .txtC insert end [string range $A 1 end]\n - | |
| 142 | - } elseif {$key=="2"} { | |
| 143 | - .txtC insert end [string range $B 1 end]\n - | |
| 158 | + if {$key4=="3"} {set tag add} {set tag -} | |
| 159 | + if {$key3=="1"} { | |
| 160 | + .txtC insert end [string range $A 1 end]\n $tag | |
| 161 | + } elseif {$key3=="2"} { | |
| 162 | + .txtC insert end [string range $B 1 end]\n $tag | |
| 144 | 163 | } else { |
| 145 | - .txtC insert end [string range $C 1 end]\n - | |
| 164 | + .txtC insert end [string range $C 1 end]\n $tag | |
| 146 | 165 | } |
| 147 | 166 | } |
| 148 | - set key [string index $D 0] | |
| 149 | - if {$key=="."} { | |
| 167 | + if {$key4=="."} { | |
| 150 | 168 | .lnD insert end \n - |
| 151 | 169 | .txtD insert end \n - |
| 152 | 170 | } else { |
| 153 | 171 | .lnD insert end $lnD\n - |
| 154 | 172 | incr lnD |
| 155 | - if {$key=="1"} { | |
| 173 | + if {$key4=="1"} { | |
| 156 | 174 | .txtD insert end [string range $A 1 end]\n - |
| 157 | - } elseif {$key=="2"} { | |
| 158 | - .txtD insert end [string range $B 1 end]\n - | |
| 159 | - } elseif {$key=="3"} { | |
| 160 | - .txtD insert end [string range $C 1 end]\n - | |
| 175 | + } elseif {$key4=="2"} { | |
| 176 | + .txtD insert end [string range $B 1 end]\n chng | |
| 177 | + } elseif {$key4=="3"} { | |
| 178 | + .txtD insert end [string range $C 1 end]\n add | |
| 179 | + } elseif {$key4=="X"} { | |
| 180 | + .txtD insert end " \n" rm | |
| 161 | 181 | } else { |
| 162 | 182 | .txtD insert end [string range $D 1 end]\n - |
| 163 | 183 | } |
| 164 | 184 | } |
| 165 | 185 | } |
| 166 | 186 |
| --- src/merge.tcl | |
| +++ src/merge.tcl | |
| @@ -16,11 +16,11 @@ | |
| 16 | LN_COL_FG #444444 |
| 17 | TXT_COL_BG #ffffff |
| 18 | TXT_COL_FG #000000 |
| 19 | MKR_COL_BG #444444 |
| 20 | MKR_COL_FG #dddddd |
| 21 | CHNG_BG #d0d0ff |
| 22 | ADD_BG #c0ffc0 |
| 23 | RM_BG #ffc0c0 |
| 24 | HR_FG #444444 |
| 25 | HR_PAD_TOP 4 |
| 26 | HR_PAD_BTM 8 |
| @@ -40,11 +40,11 @@ | |
| 40 | LN_COL_FG #444444 |
| 41 | TXT_COL_BG #3f3f3f |
| 42 | TXT_COL_FG #dcdccc |
| 43 | MKR_COL_BG #444444 |
| 44 | MKR_COL_FG #dddddd |
| 45 | CHNG_BG #6a6afc |
| 46 | ADD_BG #57934c |
| 47 | RM_BG #ef6767 |
| 48 | HR_FG #444444 |
| 49 | HR_PAD_TOP 4 |
| 50 | HR_PAD_BTM 8 |
| @@ -106,60 +106,80 @@ | |
| 106 | set lnA 1 |
| 107 | set lnB 1 |
| 108 | set lnC 1 |
| 109 | set lnD 1 |
| 110 | foreach {A B C D} $mergetxt { |
| 111 | set key [string index $A 0] |
| 112 | if {$key=="."} { |
| 113 | .lnA insert end \n - |
| 114 | .txtA insert end \n - |
| 115 | } else { |
| 116 | .lnA insert end $lnA\n - |
| 117 | incr lnA |
| 118 | .txtA insert end [string range $A 1 end]\n - |
| 119 | } |
| 120 | set key [string index $B 0] |
| 121 | if {$key=="."} { |
| 122 | .lnB insert end \n - |
| 123 | .txtB insert end \n - |
| 124 | } else { |
| 125 | .lnB insert end $lnB\n - |
| 126 | incr lnB |
| 127 | if {$key=="1"} { |
| 128 | .txtB insert end [string range $A 1 end]\n - |
| 129 | } else { |
| 130 | .txtB insert end [string range $B 1 end]\n - |
| 131 | } |
| 132 | } |
| 133 | set key [string index $C 0] |
| 134 | if {$key=="."} { |
| 135 | .lnC insert end \n - |
| 136 | .txtC insert end \n - |
| 137 | } else { |
| 138 | .lnC insert end $lnC\n - |
| 139 | incr lnC |
| 140 | if {$key=="1"} { |
| 141 | .txtC insert end [string range $A 1 end]\n - |
| 142 | } elseif {$key=="2"} { |
| 143 | .txtC insert end [string range $B 1 end]\n - |
| 144 | } else { |
| 145 | .txtC insert end [string range $C 1 end]\n - |
| 146 | } |
| 147 | } |
| 148 | set key [string index $D 0] |
| 149 | if {$key=="."} { |
| 150 | .lnD insert end \n - |
| 151 | .txtD insert end \n - |
| 152 | } else { |
| 153 | .lnD insert end $lnD\n - |
| 154 | incr lnD |
| 155 | if {$key=="1"} { |
| 156 | .txtD insert end [string range $A 1 end]\n - |
| 157 | } elseif {$key=="2"} { |
| 158 | .txtD insert end [string range $B 1 end]\n - |
| 159 | } elseif {$key=="3"} { |
| 160 | .txtD insert end [string range $C 1 end]\n - |
| 161 | } else { |
| 162 | .txtD insert end [string range $D 1 end]\n - |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 |
| --- src/merge.tcl | |
| +++ src/merge.tcl | |
| @@ -16,11 +16,11 @@ | |
| 16 | LN_COL_FG #444444 |
| 17 | TXT_COL_BG #ffffff |
| 18 | TXT_COL_FG #000000 |
| 19 | MKR_COL_BG #444444 |
| 20 | MKR_COL_FG #dddddd |
| 21 | CHNG_BG #d0d070 |
| 22 | ADD_BG #c0ffc0 |
| 23 | RM_BG #ffc0c0 |
| 24 | HR_FG #444444 |
| 25 | HR_PAD_TOP 4 |
| 26 | HR_PAD_BTM 8 |
| @@ -40,11 +40,11 @@ | |
| 40 | LN_COL_FG #444444 |
| 41 | TXT_COL_BG #3f3f3f |
| 42 | TXT_COL_FG #dcdccc |
| 43 | MKR_COL_BG #444444 |
| 44 | MKR_COL_FG #dddddd |
| 45 | CHNG_BG #6a6a00 |
| 46 | ADD_BG #57934c |
| 47 | RM_BG #ef6767 |
| 48 | HR_FG #444444 |
| 49 | HR_PAD_TOP 4 |
| 50 | HR_PAD_BTM 8 |
| @@ -106,60 +106,80 @@ | |
| 106 | set lnA 1 |
| 107 | set lnB 1 |
| 108 | set lnC 1 |
| 109 | set lnD 1 |
| 110 | foreach {A B C D} $mergetxt { |
| 111 | set key1 [string index $A 0] |
| 112 | if {$key1=="S"} { |
| 113 | set N [string range $A 1 end] |
| 114 | incr lnA $N |
| 115 | incr lnB $N |
| 116 | incr lnC $N |
| 117 | incr lnD $N |
| 118 | .lnA insert end ...\n hrln |
| 119 | .txtA insert end [string repeat . 30]\n hrtxt |
| 120 | .lnB insert end ...\n hrln |
| 121 | .txtB insert end [string repeat . 30]\n hrtxt |
| 122 | .lnC insert end ...\n hrln |
| 123 | .txtC insert end [string repeat . 30]\n hrtxt |
| 124 | .lnD insert end ...\n hrln |
| 125 | .txtD insert end [string repeat . 30]\n hrtxt |
| 126 | continue |
| 127 | } |
| 128 | set key2 [string index $B 0] |
| 129 | set key3 [string index $C 0] |
| 130 | set key4 [string index $D 0] |
| 131 | if {$key1=="."} { |
| 132 | .lnA insert end \n - |
| 133 | .txtA insert end \n - |
| 134 | } else { |
| 135 | .lnA insert end $lnA\n - |
| 136 | incr lnA |
| 137 | .txtA insert end [string range $A 1 end]\n - |
| 138 | } |
| 139 | if {$key2=="."} { |
| 140 | .lnB insert end \n - |
| 141 | .txtB insert end \n - |
| 142 | } else { |
| 143 | .lnB insert end $lnB\n - |
| 144 | incr lnB |
| 145 | if {$key4=="2"} {set tag chng} {set tag -} |
| 146 | if {$key2=="1"} { |
| 147 | .txtB insert end [string range $A 1 end]\n $tag |
| 148 | } else { |
| 149 | .txtB insert end [string range $B 1 end]\n $tag |
| 150 | } |
| 151 | } |
| 152 | if {$key3=="."} { |
| 153 | .lnC insert end \n - |
| 154 | .txtC insert end \n - |
| 155 | } else { |
| 156 | .lnC insert end $lnC\n - |
| 157 | incr lnC |
| 158 | if {$key4=="3"} {set tag add} {set tag -} |
| 159 | if {$key3=="1"} { |
| 160 | .txtC insert end [string range $A 1 end]\n $tag |
| 161 | } elseif {$key3=="2"} { |
| 162 | .txtC insert end [string range $B 1 end]\n $tag |
| 163 | } else { |
| 164 | .txtC insert end [string range $C 1 end]\n $tag |
| 165 | } |
| 166 | } |
| 167 | if {$key4=="."} { |
| 168 | .lnD insert end \n - |
| 169 | .txtD insert end \n - |
| 170 | } else { |
| 171 | .lnD insert end $lnD\n - |
| 172 | incr lnD |
| 173 | if {$key4=="1"} { |
| 174 | .txtD insert end [string range $A 1 end]\n - |
| 175 | } elseif {$key4=="2"} { |
| 176 | .txtD insert end [string range $B 1 end]\n chng |
| 177 | } elseif {$key4=="3"} { |
| 178 | .txtD insert end [string range $C 1 end]\n add |
| 179 | } elseif {$key4=="X"} { |
| 180 | .txtD insert end " \n" rm |
| 181 | } else { |
| 182 | .txtD insert end [string range $D 1 end]\n - |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 |
+25
-3
| --- src/merge3.c | ||
| +++ src/merge3.c | ||
| @@ -177,10 +177,11 @@ | ||
| 177 | 177 | Blob *pPivot; /* The common ancestor */ |
| 178 | 178 | Blob *pV1; /* First variant */ |
| 179 | 179 | Blob *pV2; /* Second variant */ |
| 180 | 180 | Blob *pOut; /* Write merge results here */ |
| 181 | 181 | int useCrLf; /* Use CRLF line endings */ |
| 182 | + int nContext; /* Size of unchanged line boundaries */ | |
| 182 | 183 | unsigned int lnPivot; /* Lines read from pivot */ |
| 183 | 184 | unsigned int lnV1; /* Lines read from v1 */ |
| 184 | 185 | unsigned int lnV2; /* Lines read from v2 */ |
| 185 | 186 | unsigned int lnOut; /* Lines written to out */ |
| 186 | 187 | unsigned int nConflict; /* Number of conflicts seen */ |
| @@ -353,10 +354,11 @@ | ||
| 353 | 354 | ** |
| 354 | 355 | ** . This line is omitted. |
| 355 | 356 | ** T Literal text follows that should have a \n terminator. |
| 356 | 357 | ** R Literal text follows that needs a \r\n terminator. |
| 357 | 358 | ** Z Literal text without a line terminator. |
| 359 | +** S Skipped lines in all 4 files. | |
| 358 | 360 | ** 1 Text is a copy of token 1 |
| 359 | 361 | ** 2 Use data from data-token 2 |
| 360 | 362 | ** 3 Use data from data-token 3 |
| 361 | 363 | */ |
| 362 | 364 | |
| @@ -396,15 +398,34 @@ | ||
| 396 | 398 | } |
| 397 | 399 | pIn->iCursor = i; |
| 398 | 400 | blob_append_char(pOut, '"'); |
| 399 | 401 | } |
| 400 | 402 | static void tclSame(MergeBuilder *p, unsigned int N){ |
| 401 | - int i; | |
| 402 | - for(i=0; i<N; i++){ | |
| 403 | + int i = 0; | |
| 404 | + int nSkip; | |
| 405 | + | |
| 406 | + if( p->lnPivot>=2 || p->lnV1>2 || p->lnV2>2 ){ | |
| 407 | + while( i<N && i<p->nContext ){ | |
| 408 | + tclLineOfText(p->pOut, p->pPivot); | |
| 409 | + blob_append(p->pOut, " 1 1 1\n", 7); | |
| 410 | + i++; | |
| 411 | + } | |
| 412 | + nSkip = N - p->nContext*2; | |
| 413 | + }else{ | |
| 414 | + nSkip = N - p->nContext; | |
| 415 | + } | |
| 416 | + if( nSkip>0 ){ | |
| 417 | + blob_appendf(p->pOut, "S%d . . .\n", nSkip); | |
| 418 | + blob_copy_lines(0, p->pPivot, nSkip); | |
| 419 | + i += nSkip; | |
| 420 | + } | |
| 421 | + while( i<N ){ | |
| 403 | 422 | tclLineOfText(p->pOut, p->pPivot); |
| 404 | 423 | blob_append(p->pOut, " 1 1 1\n", 7); |
| 424 | + i++; | |
| 405 | 425 | } |
| 426 | + | |
| 406 | 427 | p->lnPivot += N; |
| 407 | 428 | p->lnV1 += N; |
| 408 | 429 | p->lnV2 += N; |
| 409 | 430 | blob_copy_lines(0, p->pV1, N); |
| 410 | 431 | blob_copy_lines(0, p->pV2, N); |
| @@ -517,10 +538,11 @@ | ||
| 517 | 538 | p->xSame = tclSame; |
| 518 | 539 | p->xChngV1 = tclChngV1; |
| 519 | 540 | p->xChngV2 = tclChngV2; |
| 520 | 541 | p->xChngBoth = tclChngBoth; |
| 521 | 542 | p->xConflict = tclConflict; |
| 543 | + p->nContext = 6; | |
| 522 | 544 | } |
| 523 | 545 | /*****************************************************************************/ |
| 524 | 546 | |
| 525 | 547 | /* |
| 526 | 548 | ** aC[] is an "edit triple" for changes from A to B. Advance through |
| @@ -828,11 +850,11 @@ | ||
| 828 | 850 | } |
| 829 | 851 | if( find_option("tcl", 0, 0) ){ |
| 830 | 852 | mergebuilder_init_tcl(&s); |
| 831 | 853 | noWarn = 1; |
| 832 | 854 | } |
| 833 | - flagTk = find_option("tk", 0, 0); | |
| 855 | + flagTk = find_option("tk", 0, 0)!=0; | |
| 834 | 856 | blob_zero(&pivot); s.pPivot = &pivot; |
| 835 | 857 | blob_zero(&v1); s.pV1 = &v1; |
| 836 | 858 | blob_zero(&v2); s.pV2 = &v2; |
| 837 | 859 | blob_zero(&out); s.pOut = &out; |
| 838 | 860 | |
| 839 | 861 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -177,10 +177,11 @@ | |
| 177 | Blob *pPivot; /* The common ancestor */ |
| 178 | Blob *pV1; /* First variant */ |
| 179 | Blob *pV2; /* Second variant */ |
| 180 | Blob *pOut; /* Write merge results here */ |
| 181 | int useCrLf; /* Use CRLF line endings */ |
| 182 | unsigned int lnPivot; /* Lines read from pivot */ |
| 183 | unsigned int lnV1; /* Lines read from v1 */ |
| 184 | unsigned int lnV2; /* Lines read from v2 */ |
| 185 | unsigned int lnOut; /* Lines written to out */ |
| 186 | unsigned int nConflict; /* Number of conflicts seen */ |
| @@ -353,10 +354,11 @@ | |
| 353 | ** |
| 354 | ** . This line is omitted. |
| 355 | ** T Literal text follows that should have a \n terminator. |
| 356 | ** R Literal text follows that needs a \r\n terminator. |
| 357 | ** Z Literal text without a line terminator. |
| 358 | ** 1 Text is a copy of token 1 |
| 359 | ** 2 Use data from data-token 2 |
| 360 | ** 3 Use data from data-token 3 |
| 361 | */ |
| 362 | |
| @@ -396,15 +398,34 @@ | |
| 396 | } |
| 397 | pIn->iCursor = i; |
| 398 | blob_append_char(pOut, '"'); |
| 399 | } |
| 400 | static void tclSame(MergeBuilder *p, unsigned int N){ |
| 401 | int i; |
| 402 | for(i=0; i<N; i++){ |
| 403 | tclLineOfText(p->pOut, p->pPivot); |
| 404 | blob_append(p->pOut, " 1 1 1\n", 7); |
| 405 | } |
| 406 | p->lnPivot += N; |
| 407 | p->lnV1 += N; |
| 408 | p->lnV2 += N; |
| 409 | blob_copy_lines(0, p->pV1, N); |
| 410 | blob_copy_lines(0, p->pV2, N); |
| @@ -517,10 +538,11 @@ | |
| 517 | p->xSame = tclSame; |
| 518 | p->xChngV1 = tclChngV1; |
| 519 | p->xChngV2 = tclChngV2; |
| 520 | p->xChngBoth = tclChngBoth; |
| 521 | p->xConflict = tclConflict; |
| 522 | } |
| 523 | /*****************************************************************************/ |
| 524 | |
| 525 | /* |
| 526 | ** aC[] is an "edit triple" for changes from A to B. Advance through |
| @@ -828,11 +850,11 @@ | |
| 828 | } |
| 829 | if( find_option("tcl", 0, 0) ){ |
| 830 | mergebuilder_init_tcl(&s); |
| 831 | noWarn = 1; |
| 832 | } |
| 833 | flagTk = find_option("tk", 0, 0); |
| 834 | blob_zero(&pivot); s.pPivot = &pivot; |
| 835 | blob_zero(&v1); s.pV1 = &v1; |
| 836 | blob_zero(&v2); s.pV2 = &v2; |
| 837 | blob_zero(&out); s.pOut = &out; |
| 838 | |
| 839 |
| --- src/merge3.c | |
| +++ src/merge3.c | |
| @@ -177,10 +177,11 @@ | |
| 177 | Blob *pPivot; /* The common ancestor */ |
| 178 | Blob *pV1; /* First variant */ |
| 179 | Blob *pV2; /* Second variant */ |
| 180 | Blob *pOut; /* Write merge results here */ |
| 181 | int useCrLf; /* Use CRLF line endings */ |
| 182 | int nContext; /* Size of unchanged line boundaries */ |
| 183 | unsigned int lnPivot; /* Lines read from pivot */ |
| 184 | unsigned int lnV1; /* Lines read from v1 */ |
| 185 | unsigned int lnV2; /* Lines read from v2 */ |
| 186 | unsigned int lnOut; /* Lines written to out */ |
| 187 | unsigned int nConflict; /* Number of conflicts seen */ |
| @@ -353,10 +354,11 @@ | |
| 354 | ** |
| 355 | ** . This line is omitted. |
| 356 | ** T Literal text follows that should have a \n terminator. |
| 357 | ** R Literal text follows that needs a \r\n terminator. |
| 358 | ** Z Literal text without a line terminator. |
| 359 | ** S Skipped lines in all 4 files. |
| 360 | ** 1 Text is a copy of token 1 |
| 361 | ** 2 Use data from data-token 2 |
| 362 | ** 3 Use data from data-token 3 |
| 363 | */ |
| 364 | |
| @@ -396,15 +398,34 @@ | |
| 398 | } |
| 399 | pIn->iCursor = i; |
| 400 | blob_append_char(pOut, '"'); |
| 401 | } |
| 402 | static void tclSame(MergeBuilder *p, unsigned int N){ |
| 403 | int i = 0; |
| 404 | int nSkip; |
| 405 | |
| 406 | if( p->lnPivot>=2 || p->lnV1>2 || p->lnV2>2 ){ |
| 407 | while( i<N && i<p->nContext ){ |
| 408 | tclLineOfText(p->pOut, p->pPivot); |
| 409 | blob_append(p->pOut, " 1 1 1\n", 7); |
| 410 | i++; |
| 411 | } |
| 412 | nSkip = N - p->nContext*2; |
| 413 | }else{ |
| 414 | nSkip = N - p->nContext; |
| 415 | } |
| 416 | if( nSkip>0 ){ |
| 417 | blob_appendf(p->pOut, "S%d . . .\n", nSkip); |
| 418 | blob_copy_lines(0, p->pPivot, nSkip); |
| 419 | i += nSkip; |
| 420 | } |
| 421 | while( i<N ){ |
| 422 | tclLineOfText(p->pOut, p->pPivot); |
| 423 | blob_append(p->pOut, " 1 1 1\n", 7); |
| 424 | i++; |
| 425 | } |
| 426 | |
| 427 | p->lnPivot += N; |
| 428 | p->lnV1 += N; |
| 429 | p->lnV2 += N; |
| 430 | blob_copy_lines(0, p->pV1, N); |
| 431 | blob_copy_lines(0, p->pV2, N); |
| @@ -517,10 +538,11 @@ | |
| 538 | p->xSame = tclSame; |
| 539 | p->xChngV1 = tclChngV1; |
| 540 | p->xChngV2 = tclChngV2; |
| 541 | p->xChngBoth = tclChngBoth; |
| 542 | p->xConflict = tclConflict; |
| 543 | p->nContext = 6; |
| 544 | } |
| 545 | /*****************************************************************************/ |
| 546 | |
| 547 | /* |
| 548 | ** aC[] is an "edit triple" for changes from A to B. Advance through |
| @@ -828,11 +850,11 @@ | |
| 850 | } |
| 851 | if( find_option("tcl", 0, 0) ){ |
| 852 | mergebuilder_init_tcl(&s); |
| 853 | noWarn = 1; |
| 854 | } |
| 855 | flagTk = find_option("tk", 0, 0)!=0; |
| 856 | blob_zero(&pivot); s.pPivot = &pivot; |
| 857 | blob_zero(&v1); s.pV1 = &v1; |
| 858 | blob_zero(&v2); s.pV2 = &v2; |
| 859 | blob_zero(&out); s.pOut = &out; |
| 860 | |
| 861 |