1277
"Fetching new changes from $remote"]
1278
set cmd [list git fetch]
1279
lappend cmd $remote
1280
- console_exec $w $cmd
1280
+ console_exec $w $cmd console_done
1281
}
1282
1283
proc push_to {remote} {
1287
set cmd [list git push]
1288
lappend cmd -v
1289
lappend cmd $remote
1290
- console_exec $w $cmd
1290
+ console_exec $w $cmd console_done
1291
}
1292
1293
######################################################################
2476
}
2477
2478
set cons [new_console "push $r_url" "Pushing $cnt $unit to $r_url"]
2479
- console_exec $cons $cmd
2479
+ console_exec $cons $cmd console_done
2480
destroy $w
2481
}
2482
2854
return $w
2855
}
2856
2857
-proc console_exec {w cmd {after {}}} {
2857
+proc console_exec {w cmd after} {
2858
# -- Windows tosses the enviroment when we exec our child.
2859
# But most users need that so we have to relogin. :-(
2860
#
2873
}
2874
2875
proc console_read {w fd after} {
2876
- global console_cr console_data
2876
+ global console_cr
2877
2878
set buf [read $fd]
2879
if {$buf ne {}} {
2907
fconfigure $fd -blocking 1
2908
if {[eof $fd]} {
2909
if {[catch {close $fd}]} {
2910
- if {![winfo exists $w]} {console_init $w}
2911
- $w.m.s conf -background red -text {Error: Command Failed}
2912
- $w.ok conf -state normal
2910
set ok 0
2914
- } elseif {[winfo exists $w]} {
2915
- $w.m.s conf -background green -text {Success}
2916
- $w.ok conf -state normal
2911
+ } else {
2912
set ok 1
2913
}
2919
- array unset console_cr $w
2920
- array unset console_data $w
2921
- if {$after ne {}} {
2922
- uplevel #0 $after $ok
2923
- }
2914
+ uplevel #0 $after $w $ok
2915
return
2916
}
2917
fconfigure $fd -blocking 0
2918
}
2919
2920
+proc console_done {w ok} {
2921
+ global console_cr console_data
2922
+
2923
+ if {$ok} {
2924
+ if {[winfo exists $w]} {
2925
+ $w.m.s conf -background green -text {Success}
2926
+ $w.ok conf -state normal
2927
+ }
2928
+ } else {
2929
+ if {![winfo exists $w]} {
2930
+ console_init $w
2931
+ }
2932
+ $w.m.s conf -background red -text {Error: Command Failed}
2933
+ $w.ok conf -state normal
2934
+ }
2935
+
2936
+ array unset console_cr $w
2937
+ array unset console_data $w
2938
+}
2939
+
2940
######################################################################
2941
##
2942
## ui commands
3038
3039
proc do_gc {} {
3040
set w [new_console {gc} {Compressing the object database}]
3030
- console_exec $w {git gc}
3041
+ console_exec $w {git gc} console_done
3042
}
3043
3044
proc do_fsck_objects {} {
3048
lappend cmd --full
3049
lappend cmd --cache
3050
lappend cmd --strict
3040
- console_exec $w $cmd
3051
+ console_exec $w $cmd console_done
3052
}
3053
3054
set is_quitting 0