212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
+
+
|
}
}
# Prepare for RCS/CVS/CT diff. Checkout copies of the versions needed.
proc prepareRev {top} {
global Pref
$::widgets($top,commit) configure -state disabled
set type $::diff($top,modetype)
if {$type eq "CT"} {
# Figure out stream and current version
if {[catch {exec cleartool ls $::diff($top,RevFile)} info]} {
tk_messageBox -icon error -title "Cleartool error" -message $info
return
|
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
+
+
+
|
if {$type eq "CVS"} {
GetCvsRev $::diff($top,RevFile) $::diff($top,leftFile) $r
} elseif {$type eq "RCS"} {
GetRcsRev $::diff($top,RevFile) $::diff($top,leftFile) $r
} else {
GetCtRev $::diff($top,RevFile) $::diff($top,leftFile) $r
}
if {$type eq "CVS" && [llength $revs] == 0} {
$::widgets($top,commit) configure -state normal
}
} else {
# Compare the two specified versions.
disallowEdit $top
set r1 [lindex $revs 0]
set r2 [lindex $revs 1]
set ::diff($top,leftFile) [tmpFile]
set ::diff($top,rightFile) [tmpFile]
|
320
321
322
323
324
325
326
|
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
proc cleanupRev {top} {
global Pref
clearTmp $::diff($top,rightFile) $::diff($top,leftFile)
set ::diff($top,rightFile) $::diff($top,RevFile)
set ::diff($top,leftFile) $::diff($top,RevFile)
}
proc revCommit {top} {
if {[$::widgets($top,commit) cget -state] eq "disabled"} return
CvsCommitFile $top $::diff($top,RevFile)
}
# Check in CVS controlled file
proc CvsCommitFile {top filename} {
set logmsg [LogDialog $top $filename]
if {$logmsg ne ""} {
catch {exec cvs -q commit -m $logmsg $filename}
}
}
# Dialog for log message
proc LogDialog {top filename {clean 0}} {
set w $top.logmsg
destroy $w
toplevel $w -padx 3 -pady 3
wm title $w "Commit log message for [file tail $filename]"
set ::diff($top,logdialogok) 0
text $w.t -width 70 -height 10
if {!$clean && [info exists ::diff(logdialog)]} {
$w.t insert end $::diff(logdialog)
$w.t tag add sel 1.0 end-1c
$w.t mark set insert 1.0
}
button $w.ok -width 10 -text "Commit" -underline 1 \
-command "set ::diff($top,logdialogok) 1 ; \
set ::diff(logdialog) \[$w.t get 1.0 end\] ; \
destroy $w"
button $w.ca -width 10 -text "Cancel" -command "destroy $w" -underline 0
bind $w <Alt-o> [list $w.ok invoke]\;break
bind $w <Alt-c> [list destroy $w]\;break
bind $w <Key-Escape> [list destroy $w]\;break
grid $w.t - -sticky news -padx 3 -pady 3
grid $w.ok $w.ca -padx 3 -pady 3
tkwait visibility $w
focus -force $w.t
tkwait window $w
if {$::diff($top,logdialogok)} {
set res [string trim $::diff(logdialog)]
set ::diff(logdialog) $res
if {$res eq ""} {
set res "No Log"
}
} else {
set res ""
}
return $res
}
|