summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Paul Mackerras <paulus@samba.org>2008-05-12 10:18:38 +1000
committerLibravatar Paul Mackerras <paulus@samba.org>2008-05-12 10:18:38 +1000
commit08ba820fd7d82cd798d271a9ef6caaf83ffed387 (patch)
tree0895f081c1a0a34050a5207864493a68bdb4f3db
parentgitk: Show current row number and total number of rows (diff)
downloadtgif-08ba820fd7d82cd798d271a9ef6caaf83ffed387.tar.xz
gitk: Add a progress bar for checking out a head
Now that git checkout reports progress when checking out files, we can use that to provide a progress bar in gitk. We re-use the green progress bar (formerly used when reading stuff in) for that. Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk41
1 files changed, 31 insertions, 10 deletions
diff --git a/gitk b/gitk
index c352befe89..9ab6dbaa46 100755
--- a/gitk
+++ b/gitk
@@ -7612,7 +7612,7 @@ proc resethead {} {
tkwait window $w
if {!$confirm_ok} return
if {[catch {set fd [open \
- [list | sh -c "git reset --$resettype $rowmenuid 2>&1"] r]} err]} {
+ [list | git reset --$resettype $rowmenuid 2>@1] r]} err]} {
error_popup $err
} else {
dohidelocalchanges
@@ -7674,25 +7674,46 @@ proc cobranch {} {
global showlocalchanges mainheadid
# check the tree is clean first??
- set oldmainhead $mainhead
nowbusy checkout [mc "Checking out"]
update
dohidelocalchanges
if {[catch {
- exec git checkout -q $headmenuhead
+ set fd [open [list | git checkout $headmenuhead 2>@1] r]
} err]} {
notbusy checkout
error_popup $err
+ if {$showlocalchanges} {
+ dodiffindex
+ }
} else {
- notbusy checkout
- set mainhead $headmenuhead
- set mainheadid $headmenuid
- if {[info exists headids($oldmainhead)]} {
- redrawtags $headids($oldmainhead)
+ filerun $fd [list readcheckoutstat $fd $headmenuhead $headmenuid]
+ }
+}
+
+proc readcheckoutstat {fd newhead newheadid} {
+ global mainhead mainheadid headids showlocalchanges progresscoords
+
+ if {[gets $fd line] >= 0} {
+ if {[regexp {([0-9]+)% \(([0-9]+)/([0-9]+)\)} $line match p m n]} {
+ set progresscoords [list 0 [expr {1.0 * $m / $n}]]
+ adjustprogress
}
- redrawtags $headmenuid
- selbyid $headmenuid
+ return 1
+ }
+ set progresscoords {0 0}
+ adjustprogress
+ notbusy checkout
+ if {[catch {close $fd} err]} {
+ error_popup $err
+ }
+ set oldmainhead $mainhead
+ set mainhead $newhead
+ set mainheadid $newheadid
+ if {[info exists headids($oldmainhead)]} {
+ redrawtags $headids($oldmainhead)
}
+ redrawtags $newheadid
+ selbyid $newheadid
if {$showlocalchanges} {
dodiffindex
}