527
528
proc rescan {after {honor_trustmtime 1}} {
529
global HEAD PARENT MERGE_HEAD commit_type
530
- global ui_index ui_workdir ui_status_value ui_comm
530
+ global ui_index ui_workdir ui_comm
531
global rescan_active file_states
532
global repo_config
533
566
rescan_stage2 {} $after
567
} else {
568
set rescan_active 1
569
- set ui_status_value {Refreshing file status...}
569
+ ui_status {Refreshing file status...}
570
set cmd [list git update-index]
571
lappend cmd -q
572
lappend cmd --unmerged
580
}
581
582
proc rescan_stage2 {fd after} {
583
- global ui_status_value
583
global rescan_active buf_rdi buf_rdf buf_rlo
584
585
if {$fd ne {}} {
600
set buf_rlo {}
601
602
set rescan_active 3
604
- set ui_status_value {Scanning for modified files ...}
603
+ ui_status {Scanning for modified files ...}
604
set fd_di [open "| git diff-index --cached -z [PARENT]" r]
605
set fd_df [open "| git diff-files -z" r]
606
set fd_lo [open $ls_others r]
760
return $r
761
}
762
763
+proc ui_status {msg} {
764
+ set ::ui_status_value $msg
765
+}
766
+
767
+proc ui_ready {{test {}}} {
768
+ if {$test eq {} || $::ui_status_value eq $test} {
769
+ ui_status Ready.
770
+ }
771
+}
772
+
773
proc escape_path {path} {
774
regsub -all {\\} $path "\\\\" path
775
regsub -all "\n" $path "\\n" path
1121
set starting_gitk_msg {Starting gitk... please wait...}
1122
1123
proc do_gitk {revs} {
1115
- global env ui_status_value starting_gitk_msg
1124
+ global env starting_gitk_msg
1125
1126
# -- Always start gitk through whatever we were loaded with. This
1127
# lets us bypass using shell process on Windows systems.
1138
error_popup "Unable to start gitk:\n\n$exe does not exist"
1139
} else {
1140
eval exec $cmd &
1132
- set ui_status_value $starting_gitk_msg
1141
+ ui_status $starting_gitk_msg
1142
after 10000 {
1134
- if {$ui_status_value eq $starting_gitk_msg} {
1135
- set ui_status_value {Ready.}
1136
- }
1143
+ ui_ready $starting_gitk_msg
1144
}
1145
}
1146
}
1189
}
1190
1191
proc do_rescan {} {
1185
- rescan {set ui_status_value {Ready.}}
1192
+ rescan ui_ready
1193
}
1194
1195
proc do_commit {} {
1224
update_indexinfo \
1225
"Unstaging [short_path $path] from commit" \
1226
[list $path] \
1220
- [concat $after {set ui_status_value {Ready.}}]
1227
+ [concat $after [list ui_ready]]
1228
} elseif {$w eq $ui_workdir} {
1229
update_index \
1230
"Adding [short_path $path]" \
1231
[list $path] \
1225
- [concat $after {set ui_status_value {Ready.}}]
1232
+ [concat $after [list ui_ready]]
1233
}
1234
} else {
1235
show_diff $path $w $lno
1647
#
1648
if {[is_Cygwin] && [file exists /usr/local/miga/lib/gui-miga]} {
1649
proc do_miga {} {
1643
- global ui_status_value
1650
if {![lock_index update]} return
1651
set cmd [list sh --login -c "/usr/local/miga/lib/gui-miga \"[pwd]\""]
1652
set miga_fd [open "|$cmd" r]
1653
fconfigure $miga_fd -blocking 0
1654
fileevent $miga_fd readable [list miga_done $miga_fd]
1649
- set ui_status_value {Running miga...}
1655
+ ui_status {Running miga...}
1656
}
1657
proc miga_done {fd} {
1658
read $fd 512
1659
if {[eof $fd]} {
1660
close $fd
1661
unlock_index
1656
- rescan [list set ui_status_value {Ready.}]
1662
+ rescan ui_ready
1663
}
1664
}
1665
.mbar add cascade -label Tools -menu .mbar.tools