📄 version.tcl
字号:
} # retrieve the list of available revision numbers if {[info exists sn_verctl_options(${rcstype},revision-number-pattern)]} { set pattern $sn_verctl_options(${rcstype},revision-number-pattern) set revs [sn_lgrep ${pattern} ${output}] } else { set revs {} } if {${revs} == ""} { return 0 } return 1}proc sn_rcs_exec {cmd {bsy 0}} { global errorCode set retval "" set cmd [join ${cmd}] sn_log "sn_rcs_exec: About to exec $cmd." if {[catch {sn_exec_x_events ${cmd} ${bsy}} retval]} { sn_error_dialog ${retval} error ${retval} } return ${retval}}# Check in a list of files.proc sn_rcs_checkin {marked_files} { global sn_options global sn_verctl_options set files [RevisionCtrl&::source_file_names ${marked_files}] set rcstype $sn_options(both,rcs-type) # create toplevel, but don't display it yet set w [sourcenav::Window::next_window_name] sourcenav::Window ${w} ${w} withdraw # remove the dots from the 'check in' string and set the title with it ${w} title "[string trimright [get_indep String ChooseCheckIn]\ "."] ${files}" global ${w}.withlock if {![info exists ${w}.withlock]} { set ${w}.withlock $sn_verctl_options(${rcstype},checkout-with-lock) } set checkin ${w}.ctrl.button_0 set cancel ${w}.ctrl.button_1 frame ${w}.ctrl frame ${w}.ctrl.lock checkbutton ${w}.ctrl.lock.lock -text [get_indep String ChooseWithLock]\ -variable ${w}.withlock pack ${w}.ctrl.lock.lock -pady 10 -fill x sn_motif_buttons ${w}.ctrl bottom -1 [get_indep String ok]\ [get_indep String cancel] ${checkin} config -command " set ${w}-select_status \[set ${w}.withlock\] " ${cancel} config -command " set ${w}-select_status cancel " frame ${w}.ctrl.heading label ${w}.ctrl.heading.lb -text [get_indep String Comment] pack ${w}.ctrl.heading.lb -side left -padx 5 frame ${w}.ctrl.rem set t ${w}.ctrl.rem.t text ${t} -height 4 -width 65 -wrap none pack ${t} -padx 5 -fill both -expand y pack ${w}.ctrl.heading -fill both -expand y pack ${w}.ctrl.rem -fill both -expand y pack ${w}.ctrl.lock -fill x -expand y pack ${w}.ctrl -fill both -expand y ${w} move_to_mouse ${w} on_close "${cancel} invoke" upvar #0 ${w}-select_status status set status "" tkwait variable ${w}-select_status set txt [string trim [${t} get 0.0 "end -1c"]] itcl::delete object ${w} if {${status} != "cancel"} { if {${status}} { if {[info exists sn_verctl_options(${rcstype},checkin-exclusive)]} { set cmd $sn_verctl_options(${rcstype},checkin-exclusive) } else { set cmd $sn_verctl_options(${rcstype},checkin) } } else { set cmd $sn_verctl_options(${rcstype},checkin) } # Separate out the filename arguments. append cmd " " set relative_files [sn_rcs_process_filenames $sn_verctl_options($rcstype,use-relative-path) $files] set via $sn_verctl_options(${rcstype},checkin-comment-via) switch ${via} { "cmdline" { # Include quotes to keep the text as a single argument. append cmd "\"${txt}\" ${relative_files}" } "file" { set commentf [sn_tmpFileName] set fd [open ${commentf} "w+"] fconfigure ${fd} -encoding $sn_options(def,system-encoding) -blocking 0 puts ${fd} ${txt} close ${fd} append cmd "${commentf} ${relative_files}" } "stdin" { set commentf [sn_tmpFileName] set fd [open ${commentf} "w+"] fconfigure ${fd} -encoding $sn_options(def,system-encoding) -blocking 0 puts ${fd} ${txt} close ${fd} append cmd "${relative_files} < ${commentf}" } } # Change directory to file's directory. if {$sn_verctl_options($rcstype,use-relative-path)} { set currentworkdir [pwd] cd [sn_rcs_get_common_path $files] } set status [expr ![catch {sn_rcs_exec ${cmd}}]] # Move back to working directory. if {$sn_verctl_options($rcstype,use-relative-path)} { cd $currentworkdir } if {${via} == "stdin"} { file delete -- ${commentf} } if {!${status}} { RevisionCtrl&::refresh ${marked_files} } } else { set status 0 } set st ${status} unset status return ${st}}proc sn_rcs_checkout {marked_files {bsy 1}} { global sn_options global sn_verctl_options set rcstype $sn_options(both,rcs-type) set files [RevisionCtrl&::source_file_names ${marked_files}] set relative_files [sn_rcs_process_filenames $sn_verctl_options($rcstype,use-relative-path) $files] set versions "" if {[catch {sn_rcs_get_version_nums ${files} versions} msg]} { return } set w [sourcenav::Window::next_window_name] sourcenav::Window ${w} ${w} withdraw set t [string trimright [get_indep String ChooseCheckOut] "."] set tf [lindex [lindex ${marked_files} 0] 0] ${w} title "${t} ${tf}" global ${w}.withlock if {![info exists ${w}.withlock]} { set ${w}.withlock $sn_verctl_options(${rcstype},checkout-with-lock) } set checkout ${w}.ctrl.button_0 set cancel ${w}.ctrl.button_1 frame ${w}.ctrl frame ${w}.ctrl.lock checkbutton ${w}.ctrl.lock.lock -text [get_indep String ChooseWithLock]\ -variable ${w}.withlock pack ${w}.ctrl.lock.lock -side left -padx 10 -fill x sn_motif_buttons ${w}.ctrl bottom -1 [get_indep String ok]\ [get_indep String cancel] ${checkout} config -command " set ${w}-select_status \[set ${w}.withlock\] " ${cancel} config -command " set ${w}-select_status cancel " frame ${w}.ctrl.vers global ${w}.ctrl.vers entry ${w}.ctrl.vers.e -textvariable ${w}.ctrl.vers label ${w}.ctrl.vers.l -text [get_indep String ChooseRevision] pack ${w}.ctrl.vers.l -side left pack ${w}.ctrl.vers.e -side left -fill x -expand y -padx 5 pack ${w}.ctrl.vers -pady 2 pack ${w}.ctrl.lock -fill x -expand y pack ${w}.ctrl -side left -fill both set ${w}.ctrl.vers [lindex ${versions} 0] Selector& ${w}.syms -contents ${versions} -height 5 -width 10 -sort "" ${w}.syms treebind <ButtonRelease-1> "set ${w}.ctrl.vers \[${w}.syms marked\]" ${w}.syms treebind <Double-1> "${checkout} invoke" pack ${w}.syms -side left -fill both -expand y ${w} move_to_mouse ${w} on_close "${cancel} invoke" upvar #0 ${w}-select_status status set status "" vwait ${w}-select_status itcl::delete object ${w} if {${status} != "cancel"} { upvar #0 ${w}.ctrl.vers rev if {${status}} { set cmd $sn_verctl_options(${rcstype},checkout-exclusive)${rev} } else { set cmd $sn_verctl_options(${rcstype},checkout)${rev} } # Change directory to file's directory. if {$sn_verctl_options($rcstype,use-relative-path)} { set currentworkdir [pwd] cd [sn_rcs_get_common_path $files] } set status [expr ![catch {sn_rcs_exec "${cmd} ${relative_files}"}]] # Move back to working directory. if {$sn_verctl_options($rcstype,use-relative-path)} { cd $currentworkdir } if {${status}} { RevisionCtrl&::refresh ${marked_files} } } else { set status 0 } set sta ${status} unset status return ${sta}}proc sn_rcs_discard {marked_files {bsy 1}} { global sn_options global sn_verctl_options set files [RevisionCtrl&::source_file_names ${marked_files}] set rcstype $sn_options(both,rcs-type) set relative_files [sn_rcs_process_filenames $sn_verctl_options($rcstype,use-relative-path) $files] set cmd $sn_verctl_options(${rcstype},discard) if {${cmd} == {}} { sn_error_dialog [get_indep String DiscardNotSupported] return 0 } # Change directory to file's directory. if {$sn_verctl_options($rcstype,use-relative-path)} { set currentworkdir [pwd] cd [sn_rcs_get_common_path $files] } set result [sn_rcs_exec "${cmd} ${relative_files}"] # Move back to working directory. if {$sn_verctl_options($rcstype,use-relative-path)} { cd $currentworkdir } RevisionCtrl&::refresh ${marked_files} if {${result} == ""} { return 0 } return 1}proc sn_rcs_lockunlockdel {cmd marked_files {bsy 1}} { global sn_options global sn_verctl_options set rcstype $sn_options(both,rcs-type) set files [RevisionCtrl&::source_file_names ${marked_files}] set relative_files [sn_rcs_process_filenames $sn_verctl_options($rcstype,use-relative-path) $files] switch ${cmd} { "lock" { set ti [string trimright [get_indep String ChooseLock] "."] } "unlock" { set ti [string trimright [get_indep String ChooseUnlock] "."] } "del" { set ti [string trimright [get_indep String ChooseDel] "."] } } set w [sourcenav::Window::next_window_name] sourcenav::Window ${w} ${w} withdraw set tf [lindex [lindex ${marked_files} 0] 0] ${w} title "${ti} ${tf}" set lock ${w}.ctrl.button_0 set cancel ${w}.ctrl.button_1 frame ${w}.ctrl sn_motif_buttons ${w}.ctrl bottom 0 [get_indep String ok]\ [get_indep String cancel] ${lock} config -command " set ${w}-select_status [list ${cmd}] " ${cancel} config -command " set ${w}-select_status cancel " frame ${w}.ctrl.vers global ${w}.ctrl.vers entry ${w}.ctrl.vers.e -textvariable ${w}.ctrl.vers label ${w}.ctrl.vers.l -text [get_indep String ChooseRevision] pack ${w}.ctrl.vers.l -side left pack ${w}.ctrl.vers.e -side left -fill x -expand y -padx 5 pack ${w}.ctrl.vers -pady 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -