summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b972ea5)
raw | patch | inline | side by side (parent: b972ea5)
author | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 26 Jan 2007 06:29:00 +0000 (01:29 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 26 Jan 2007 06:29:00 +0000 (01:29 -0500) |
Because I want to be able to run multiple output-producing commands
in a single 'console' window within git-gui I'm refactoring the
console handling routines to require the "after" argument of console_exec.
This should specify a procedure to execute which will receive two args,
the first is the console window handle and the second is the status of
the last command (0 on failure, 1 on success).
A new procedure console_done can be passed to the last console_exec
command to forward perform all cleanup and enable the Close button.
Its status argument is used to update the final status bar on the
bottom of the console window.
This isn't any real logic changing, and no new functionality is in
this patch.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
in a single 'console' window within git-gui I'm refactoring the
console handling routines to require the "after" argument of console_exec.
This should specify a procedure to execute which will receive two args,
the first is the console window handle and the second is the status of
the last command (0 on failure, 1 on success).
A new procedure console_done can be passed to the last console_exec
command to forward perform all cleanup and enable the Close button.
Its status argument is used to update the final status bar on the
bottom of the console window.
This isn't any real logic changing, and no new functionality is in
this patch.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index 48e1f821deccbc80d05aeec88ebfe1b5f09cbc14..d2645580769c02d285314551842e0aed6fd4f824 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
"Fetching new changes from $remote"]
set cmd [list git fetch]
lappend cmd $remote
- console_exec $w $cmd
+ console_exec $w $cmd console_done
}
proc push_to {remote} {
set cmd [list git push]
lappend cmd -v
lappend cmd $remote
- console_exec $w $cmd
+ console_exec $w $cmd console_done
}
######################################################################
}
set cons [new_console "push $r_url" "Pushing $cnt $unit to $r_url"]
- console_exec $cons $cmd
+ console_exec $cons $cmd console_done
destroy $w
}
return $w
}
-proc console_exec {w cmd {after {}}} {
+proc console_exec {w cmd after} {
# -- Windows tosses the enviroment when we exec our child.
# But most users need that so we have to relogin. :-(
#
}
proc console_read {w fd after} {
- global console_cr console_data
+ global console_cr
set buf [read $fd]
if {$buf ne {}} {
fconfigure $fd -blocking 1
if {[eof $fd]} {
if {[catch {close $fd}]} {
- if {![winfo exists $w]} {console_init $w}
- $w.m.s conf -background red -text {Error: Command Failed}
- $w.ok conf -state normal
set ok 0
- } elseif {[winfo exists $w]} {
- $w.m.s conf -background green -text {Success}
- $w.ok conf -state normal
+ } else {
set ok 1
}
- array unset console_cr $w
- array unset console_data $w
- if {$after ne {}} {
- uplevel #0 $after $ok
- }
+ uplevel #0 $after $w $ok
return
}
fconfigure $fd -blocking 0
}
+proc console_done {w ok} {
+ global console_cr console_data
+
+ if {$ok} {
+ if {[winfo exists $w]} {
+ $w.m.s conf -background green -text {Success}
+ $w.ok conf -state normal
+ }
+ } else {
+ if {![winfo exists $w]} {
+ console_init $w
+ }
+ $w.m.s conf -background red -text {Error: Command Failed}
+ $w.ok conf -state normal
+ }
+
+ array unset console_cr $w
+ array unset console_data $w
+}
+
######################################################################
##
## ui commands
proc do_gc {} {
set w [new_console {gc} {Compressing the object database}]
- console_exec $w {git gc}
+ console_exec $w {git gc} console_done
}
proc do_fsck_objects {} {
lappend cmd --full
lappend cmd --cache
lappend cmd --strict
- console_exec $w $cmd
+ console_exec $w $cmd console_done
}
set is_quitting 0