summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-29 08:06:51 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-07-29 08:07:13 (GMT)
commit0fe055cd2480763393b20676a10fd0bea56b2fc2 (patch)
tree2b0eff2b01502668d79843947caf8691c4b83618
parent94a4dd9bfda79a226f8dd57fd20c39c6603ec194 (diff)
downloadgit-0fe055cd2480763393b20676a10fd0bea56b2fc2.zip
git-0fe055cd2480763393b20676a10fd0bea56b2fc2.tar.gz
git-0fe055cd2480763393b20676a10fd0bea56b2fc2.tar.bz2
git-gui: Use progress bar while resetting/aborting files
Resetting a large number of files on a slow filesystem can take considerable time, just as switching branches in such a case can take more than two seconds. We now take advantage of the progress meter output by read-tree and show it in the main window status bar, just like we do during checkout (branch switch). Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--lib/merge.tcl16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/merge.tcl b/lib/merge.tcl
index f6a2df3..66d1bcd 100644
--- a/lib/merge.tcl
+++ b/lib/merge.tcl
@@ -233,10 +233,10 @@ Continue with resetting the current changes?"
}
if {[ask_popup $op_question] eq {yes}} {
- set fd [git_read read-tree --reset -u HEAD]
+ set fd [git_read --stderr read-tree --reset -u -v HEAD]
fconfigure $fd -blocking 0 -translation binary
fileevent $fd readable [namespace code [list _reset_wait $fd]]
- ui_status {Aborting... please wait...}
+ $::main_status start {Aborting} {files reset}
} else {
unlock_index
}
@@ -245,9 +245,12 @@ Continue with resetting the current changes?"
proc _reset_wait {fd} {
global ui_comm
- read $fd
+ $::main_status update_meter [read $fd]
+
+ fconfigure $fd -blocking 1
if {[eof $fd]} {
- close $fd
+ set fail [catch {close $fd} err]
+ $::main_status stop
unlock_index
$ui_comm delete 0.0 end
@@ -259,7 +262,12 @@ proc _reset_wait {fd} {
catch {file delete [gitdir MERGE_MSG]}
catch {file delete [gitdir GITGUI_MSG]}
+ if {$fail} {
+ warn_popup "Abort failed.\n\n$err"
+ }
rescan {ui_status {Abort completed. Ready.}}
+ } else {
+ fconfigure $fd -blocking 0
}
}