gitk: Add a progress bar to show progress while resetting
Since git reset now gets chatty while resetting, we were getting errors reported when a reset was done using the "reset branch to here" menu item. With this we now read the progress messages from git reset and update a progress bar. Because git reset outputs the progress messages to standard error, and Tcl treats messages to standard error as error messages, we have to invoke git reset via a shell and redirect standard error into standard output. This also fixes a bug in computing descendent heads when head ids are changed via a reset. Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
parent
9396cd385a
commit
706d6c3e76
48
gitk
48
gitk
@ -5851,19 +5851,54 @@ proc resethead {} {
|
|||||||
bind $w <Visibility> "grab $w; focus $w"
|
bind $w <Visibility> "grab $w; focus $w"
|
||||||
tkwait window $w
|
tkwait window $w
|
||||||
if {!$confirm_ok} return
|
if {!$confirm_ok} return
|
||||||
dohidelocalchanges
|
if {[catch {set fd [open \
|
||||||
if {[catch {exec git reset --$resettype $rowmenuid} err]} {
|
[list | sh -c "git reset --$resettype $rowmenuid 2>&1"] r]} err]} {
|
||||||
error_popup $err
|
error_popup $err
|
||||||
} else {
|
} else {
|
||||||
|
dohidelocalchanges
|
||||||
|
set w ".resetprogress"
|
||||||
|
filerun $fd [list readresetstat $fd $w]
|
||||||
|
toplevel $w
|
||||||
|
wm transient $w
|
||||||
|
wm title $w "Reset progress"
|
||||||
|
message $w.m -text "Reset in progress, please wait..." \
|
||||||
|
-justify center -aspect 1000
|
||||||
|
pack $w.m -side top -fill x -padx 20 -pady 5
|
||||||
|
canvas $w.c -width 150 -height 20 -bg white
|
||||||
|
$w.c create rect 0 0 0 20 -fill green -tags rect
|
||||||
|
pack $w.c -side top -fill x -padx 20 -pady 5 -expand 1
|
||||||
|
nowbusy reset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc readresetstat {fd w} {
|
||||||
|
global mainhead mainheadid showlocalchanges
|
||||||
|
|
||||||
|
if {[gets $fd line] >= 0} {
|
||||||
|
if {[regexp {([0-9]+)% \(([0-9]+)/([0-9]+)\)} $line match p m n]} {
|
||||||
|
set x [expr {($m * 150) / $n}]
|
||||||
|
$w.c coords rect 0 0 $x 20
|
||||||
|
}
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
destroy $w
|
||||||
|
notbusy reset
|
||||||
|
if {[catch {close $fd} err]} {
|
||||||
|
error_popup $err
|
||||||
|
}
|
||||||
set oldhead $mainheadid
|
set oldhead $mainheadid
|
||||||
movedhead $rowmenuid $mainhead
|
set newhead [exec git rev-parse HEAD]
|
||||||
set mainheadid $rowmenuid
|
if {$newhead ne $oldhead} {
|
||||||
|
movehead $newhead $mainhead
|
||||||
|
movedhead $newhead $mainhead
|
||||||
|
set mainheadid $newhead
|
||||||
redrawtags $oldhead
|
redrawtags $oldhead
|
||||||
redrawtags $rowmenuid
|
redrawtags $newhead
|
||||||
}
|
}
|
||||||
if {$showlocalchanges} {
|
if {$showlocalchanges} {
|
||||||
doshowlocalchanges
|
doshowlocalchanges
|
||||||
}
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# context menu for a head
|
# context menu for a head
|
||||||
@ -6741,9 +6776,12 @@ proc descheads {id} {
|
|||||||
lappend ret $id
|
lappend ret $id
|
||||||
}
|
}
|
||||||
foreach a $arcnos($id) {
|
foreach a $arcnos($id) {
|
||||||
|
if {$archeads($a) ne {}} {
|
||||||
|
validate_archeads $a
|
||||||
if {$archeads($a) ne {}} {
|
if {$archeads($a) ne {}} {
|
||||||
set ret [concat $ret $archeads($a)]
|
set ret [concat $ret $archeads($a)]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
set d $arcstart($a)
|
set d $arcstart($a)
|
||||||
if {![info exists seen($d)]} {
|
if {![info exists seen($d)]} {
|
||||||
lappend todo $d
|
lappend todo $d
|
||||||
|
Loading…
Reference in New Issue
Block a user