summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-06-01 22:29:20 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-06-06 05:26:47 (GMT)
commit982cf98fa47b8db890b84febda325e461f8a407d (patch)
tree4ca8c12322f54a6b5f436fb60a72c1aaee26c000
parentd0b741dc08d1c036e0fbf68c72dda02545c39b85 (diff)
downloadgit-982cf98fa47b8db890b84febda325e461f8a407d.zip
git-982cf98fa47b8db890b84febda325e461f8a407d.tar.gz
git-982cf98fa47b8db890b84febda325e461f8a407d.tar.bz2
git-gui: Display a progress bar during blame annotation gathering
Computing the blame records for a large file with a long project history can take git a while to run; traditionally we have shown a little meter in the status area of our blame viewer that lets the user know how many lines have been finished, and how far we are through the process. Usually such progress indicators are drawn with a little progress bar in the window, where the bar shows how much has been completed and hides itself when the process is complete. I'm using a very simple hack to do that: draw a canvas with a filled rectangle. Of course the time remaining has absolutely no relationship to the progress meter. It could take very little time for git-blame to get the first 90% of the file, and then it could take many times that to get the remaining 10%. So the progress meter doesn't really have any sort of assurances that it relates to the true progress of the work. But in practice on some ugly history it does seem to hold a reasonable indicator to the completion status. Besides, its amusing to watch and that keeps the user from realizing git is being somewhat slow. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--lib/blame.tcl28
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/blame.tcl b/lib/blame.tcl
index f15e5a0..1223c56 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -136,13 +136,6 @@ constructor new {i_commit i_path} {
grid columnconfigure $w.file_pane.out 3 -weight 1
grid rowconfigure $w.file_pane.out 0 -weight 1
- label $w.status \
- -textvariable @status \
- -anchor w \
- -justify left \
- -borderwidth 1 \
- -relief sunken
-
set w_cmit $w.file_pane.cm.t
text $w_cmit \
-background white -borderwidth 0 \
@@ -171,6 +164,23 @@ constructor new {i_commit i_path} {
pack $w.file_pane.cm.sbx -side bottom -fill x
pack $w_cmit -expand 1 -fill both
+ frame $w.status \
+ -borderwidth 1 \
+ -relief sunken
+ label $w.status.l \
+ -textvariable @status \
+ -anchor w \
+ -justify left
+ canvas $w.status.c \
+ -width 100 \
+ -height [expr {int([winfo reqheight $w.status.l] * 0.6)}] \
+ -borderwidth 1 \
+ -relief groove \
+ -highlightt 0
+ $w.status.c create rectangle 0 0 0 20 -tags bar -fill navy
+ pack $w.status.l -side left
+ pack $w.status.c -side right
+
menu $w.ctxm -tearoff 0
$w.ctxm add command \
-label "Copy Commit" \
@@ -226,7 +236,7 @@ constructor new {i_commit i_path} {
bind $w_cmit <Button-1> [list focus $w_cmit]
bind $top <Visibility> [list focus $top]
- bind $top <Destroy> [list delete_this $this]
+ bind $w_file <Destroy> [list delete_this $this]
grid configure $w.path -sticky ew
grid configure $w.file_pane -sticky nsew
@@ -438,6 +448,7 @@ method _read_blame {fd} {
if {[eof $fd]} {
close $fd
set status {Annotation complete.}
+ destroy $w.status.c
} else {
_status $this
}
@@ -452,6 +463,7 @@ method _status {} {
set status [format \
"Loading annotations... %i of %i lines annotated (%2i%%)" \
$have $total $pdone]
+ $w.status.c coords bar 0 0 $pdone 20
}
method _click {cur_w pos} {