diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-07-08 22:48:19 -0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-07-08 22:48:19 -0400 |
commit | b79223064e163aa0ce7f5b63d12158e87f8729e4 (patch) | |
tree | 7c8050f7e57696dd52d2780e48f3ddf81a9b1e9e /lib/status_bar.tcl | |
parent | 51530d1722b0a4cccc630043fc4b46d075bf8558 (diff) | |
download | git-b79223064e163aa0ce7f5b63d12158e87f8729e4.tar.gz git-b79223064e163aa0ce7f5b63d12158e87f8729e4.tar.xz |
git-gui: Show a progress meter for checking out files
Sometimes switching between branches can take more than a second or
two, in which case `git checkout` would normally have shown a small
progress meter to the user on the terminal to let them know that we
are in fact working, and give them a reasonable idea of when we may
finish.
We now do obtain that progress meter from read-tree -v and include
it in our main window's status bar. This allows users to see how
many files we have checked out, how many remain, and what percentage
of the operation is completed. It should help to keep users from
getting bored during a large checkout operation.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/status_bar.tcl')
-rw-r--r-- | lib/status_bar.tcl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/status_bar.tcl b/lib/status_bar.tcl index 0e2ac07a5..72a8fe1fd 100644 --- a/lib/status_bar.tcl +++ b/lib/status_bar.tcl @@ -9,6 +9,7 @@ field w_c ; # canvas we draw a progress bar into field status {}; # single line of text we show field prefix {}; # text we format into status field units {}; # unit of progress +field meter {}; # current core git progress meter (if active) constructor new {path} { set w $path @@ -45,6 +46,7 @@ method start {msg uds} { set status $msg set prefix $msg set units $uds + set meter {} } method update {have total} { @@ -58,9 +60,25 @@ method update {have total} { $w_c coords bar 0 0 $pdone 20 } -method stop {msg} { +method update_meter {buf} { + append meter $buf + set r [string last "\r" $meter] + if {$r == -1} { + return + } + + set prior [string range $meter 0 $r] + set meter [string range $meter [expr {$r + 1}] end] + if {[regexp "\\((\\d+)/(\\d+)\\)\\s+done\r\$" $prior _j a b]} { + update $this $a $b + } +} + +method stop {{msg {}}} { destroy $w_c - set status $msg + if {$msg ne {}} { + set status $msg + } } method show {msg {test {}}} { |