116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
+
+
-
+
+
|
$w mark set $mark $index
}
set diff($top,curMerge) 0
set diff($top,curMergeSel) 2
$w tag configure merge0 -foreground red
showDiff $top 0
update
# If there is any diff, show the first
if {$t > 0} {
seeText $w merges0 mergee0
seeText $w merges0 mergee0
}
}
# Move to and highlight another diff.
proc nextMerge {top delta} {
global diff
set w $top.merge.t
|
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
+
|
-parent $top.merge]
if {$apa eq ""} return
set ::diff($top,mergeFile) $apa
}
}
set ch [open $::diff($top,mergeFile) "w"]
fconfigure $ch -translation $::diff($top,mergetranslation)
puts -nonewline $ch [$w get 1.0 end-1char]
close $ch
# Detect if this is a GIT merge, and possibly add it to the index
# after save (i.e. git add file)
if {[detectRevSystem $::diff($top,mergeFile)] eq "GIT"} {
set apa [tk_messageBox -parent $top.merge -icon info -type yesno \
|
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
set diff($top,leftMergeData) {}
set diff($top,rightMergeData) {}
array unset diff $top,mergeSelection,*
}
# Create a window to display merge result.
proc makeMergeWin {top} {
if {![info exists ::diff($top,mergetranslation)]} {
if {$::tcl_platform(platform) eq "windows"} {
set ::diff($top,mergetranslation) crlf
} else {
set ::diff($top,mergetranslation) lf
}
}
set w $top.merge
if {![winfo exists $w]} {
toplevel $w
} else {
destroy {*}[winfo children $w]
}
wm title $w "Merge result"
menu $w.m
$w configure -menu $w.m
$w.m add cascade -label "File" -underline 0 -menu $w.m.mf
menu $w.m.mf
$w.m.mf add command -label "Save" -underline 0 -command "saveMerge $top"
$w.m.mf add separator
$w.m.mf add command -label "Close" -underline 0 -command "closeMerge $top"
$w.m add cascade -label "Select" -underline 0 -menu $w.m.ms
menu $w.m.ms
$w.m.ms add radiobutton -label "Left+Right" -value 12 \
-variable diff($top,curMergeSel) -command "selectMerge $top"
$w.m.ms add radiobutton -label "Left" -underline 0 -value 1 \
-variable diff($top,curMergeSel) -command "selectMerge $top"
$w.m.ms add radiobutton -label "Right" -underline 0 -value 2 \
-variable diff($top,curMergeSel) -command "selectMerge $top"
$w.m.ms add radiobutton -label "Right+Left" -value 21 \
-variable diff($top,curMergeSel) -command "selectMerge $top"
$w.m.ms add separator
$w.m.ms add command -label "All Left" -command "selectMergeAll $top 1"
$w.m.ms add command -label "All Right" -command "selectMergeAll $top 2"
$w.m add cascade -label "Config" -underline 0 -menu $w.m.mc
menu $w.m.mc
$w.m.mc add radiobutton -label "Line end LF" -value lf -variable diff($top,mergetranslation)
$w.m.mc add radiobutton -label "Line end CRLF" -value crlf -variable diff($top,mergetranslation)
if {$::diff($top,mode) eq "conflict"} {
$w.m.mc add separator
$w.m.mc add checkbutton -label "Pure" -variable diff($top,modetype) \
-onvalue "Pure" -offvalue "" -command {doDiff}
}
ttk::frame $w.f
ttk::radiobutton $w.f.rb1 -text "LR" -value 12 \
-variable diff($top,curMergeSel) \
-command "selectMerge $top"
ttk::radiobutton $w.f.rb2 -text "L" -value 1 \
|
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
-
-
+
+
-
-
+
+
-
-
-
-
-
-
|
bind $w <Shift-Key-Up> "focus $w ; nextMerge $top -10"
ttk::button $w.f.bs -text "Save" -command "saveMerge $top"
ttk::button $w.f.bq -text "Close" -command "closeMerge $top"
wm protocol $w WM_DELETE_WINDOW "closeMerge $top"
grid $w.f.rb1 $w.f.rb2 $w.f.rb3 $w.f.rb4 x $w.f.b1 $w.f.b2 x \
$w.f.bl $w.f.br x x x $w.f.bs $w.f.bq -sticky we -padx 1
grid columnconfigure $w.f {4 7 10 12} -minsize 10
$w.f.bl $w.f.br x $w.f.bs $w.f.bq -sticky we -padx 1
grid columnconfigure $w.f {4 7 10} -minsize 10
grid columnconfigure $w.f 10 -weight 1
grid columnconfigure $w.f {0 1 2 3} -uniform a
grid columnconfigure $w.f {5 6 8 9} -uniform b
grid columnconfigure $w.f {11 13 14} -uniform c
grid columnconfigure $w.f {5 6 8 9 11 12} -uniform b
#grid columnconfigure $w.f {11 13 14} -uniform c
if {$::diff($top,mode) eq "conflict"} {
ttk::checkbutton $w.f.bm -text "Pure" -variable diff($top,modetype) \
-onvalue "Pure" -offvalue "" -command {doDiff}
grid $w.f.bm -row 0 -column 11
}
text $w.t -width 80 -height 20 -xscrollcommand "$w.sbx set" \
-yscrollcommand "$w.sby set" -font myfont
scrollbar $w.sbx -orient horizontal -command "$w.t xview"
scrollbar $w.sby -orient vertical -command "$w.t yview"
bind $w.t <Key-Escape> [list focus $w]
|