Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-10-08 05:12:31 +0400
committerShawn O. Pearce <spearce@spearce.org>2007-10-10 09:12:17 +0400
commit1cad232f92794834c8e70dfc0a1f35431d2c05cd (patch)
tree131b66c3727f36aad3b8786cd5d655707df6a817 /lib/index.tcl
parent51e1eadb7cd9c8b1943fdc62fe28535bfc032fc6 (diff)
git-gui: Use progress meter in the status bar during index updates
If we are updating the index to stage or unstage changes or reverting files in the working directory we can use the progress handling parts of our status bar to perform this display work, reducing the amount of code duplication we have in the index handling module. Unfortunately the status bar is still a strict approximation as it is unable to know when git-update-index has processed the data we fed to it. The progress bar is actually a progress of the pipe buffer filling up in the OS, not of the actual work done. Still, it tells the user we are working and that has some value. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/index.tcl')
-rw-r--r--lib/index.tcl54
1 files changed, 12 insertions, 42 deletions
diff --git a/lib/index.tcl b/lib/index.tcl
index 47255261d2..9e04f2b682 100644
--- a/lib/index.tcl
+++ b/lib/index.tcl
@@ -12,12 +12,7 @@ proc update_indexinfo {msg pathList after} {
set batch [expr {int($totalCnt * .01) + 1}]
if {$batch > 25} {set batch 25}
- ui_status [format \
- "%s... %i/%i files (%.2f%%)" \
- $msg \
- $update_index_cp \
- $totalCnt \
- 0.0]
+ $::main_status start $msg [mc "files"]
set fd [git_write update-index -z --index-info]
fconfigure $fd \
-blocking 0 \
@@ -31,18 +26,18 @@ proc update_indexinfo {msg pathList after} {
$pathList \
$totalCnt \
$batch \
- $msg \
$after \
]
}
-proc write_update_indexinfo {fd pathList totalCnt batch msg after} {
+proc write_update_indexinfo {fd pathList totalCnt batch after} {
global update_index_cp
global file_states current_diff_path
if {$update_index_cp >= $totalCnt} {
close $fd
unlock_index
+ $::main_status stop
uplevel #0 $after
return
}
@@ -68,12 +63,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch msg after} {
display_file $path $new
}
- ui_status [format \
- "%s... %i/%i files (%.2f%%)" \
- $msg \
- $update_index_cp \
- $totalCnt \
- [expr {100.0 * $update_index_cp / $totalCnt}]]
+ $::main_status update $update_index_cp $totalCnt
}
proc update_index {msg pathList after} {
@@ -87,12 +77,7 @@ proc update_index {msg pathList after} {
set batch [expr {int($totalCnt * .01) + 1}]
if {$batch > 25} {set batch 25}
- ui_status [format \
- "%s... %i/%i files (%.2f%%)" \
- $msg \
- $update_index_cp \
- $totalCnt \
- 0.0]
+ $::main_status start $msg [mc "files"]
set fd [git_write update-index --add --remove -z --stdin]
fconfigure $fd \
-blocking 0 \
@@ -106,18 +91,18 @@ proc update_index {msg pathList after} {
$pathList \
$totalCnt \
$batch \
- $msg \
$after \
]
}
-proc write_update_index {fd pathList totalCnt batch msg after} {
+proc write_update_index {fd pathList totalCnt batch after} {
global update_index_cp
global file_states current_diff_path
if {$update_index_cp >= $totalCnt} {
close $fd
unlock_index
+ $::main_status stop
uplevel #0 $after
return
}
@@ -147,12 +132,7 @@ proc write_update_index {fd pathList totalCnt batch msg after} {
display_file $path $new
}
- ui_status [format \
- "%s... %i/%i files (%.2f%%)" \
- $msg \
- $update_index_cp \
- $totalCnt \
- [expr {100.0 * $update_index_cp / $totalCnt}]]
+ $::main_status update $update_index_cp $totalCnt
}
proc checkout_index {msg pathList after} {
@@ -166,12 +146,7 @@ proc checkout_index {msg pathList after} {
set batch [expr {int($totalCnt * .01) + 1}]
if {$batch > 25} {set batch 25}
- ui_status [format \
- "%s... %i/%i files (%.2f%%)" \
- $msg \
- $update_index_cp \
- $totalCnt \
- 0.0]
+ $::main_status start $msg [mc "files"]
set fd [git_write checkout-index \
--index \
--quiet \
@@ -191,18 +166,18 @@ proc checkout_index {msg pathList after} {
$pathList \
$totalCnt \
$batch \
- $msg \
$after \
]
}
-proc write_checkout_index {fd pathList totalCnt batch msg after} {
+proc write_checkout_index {fd pathList totalCnt batch after} {
global update_index_cp
global file_states current_diff_path
if {$update_index_cp >= $totalCnt} {
close $fd
unlock_index
+ $::main_status stop
uplevel #0 $after
return
}
@@ -222,12 +197,7 @@ proc write_checkout_index {fd pathList totalCnt batch msg after} {
}
}
- ui_status [format \
- "%s... %i/%i files (%.2f%%)" \
- $msg \
- $update_index_cp \
- $totalCnt \
- [expr {100.0 * $update_index_cp / $totalCnt}]]
+ $::main_status update $update_index_cp $totalCnt
}
proc unstage_helper {txt paths} {