+method _confirm_reset {newbranch cur new} {
+ set reset_ok 0
+ set gitk [list do_gitk [list $cur ^$new]]
+
+ set c $w.confirm_reset
+ toplevel $c
+ wm title $c "Confirm Branch Reset"
+ wm geometry $c "+[winfo rootx $w]+[winfo rooty $w]"
+
+ pack [label $c.msg1 \
+ -anchor w \
+ -justify left \
+ -text "Resetting '$newbranch' to [$w_rev get] will lose the following commits:" \
+ ] -anchor w
+
+ set list $c.list.l
+ frame $c.list
+ text $list \
+ -font font_diff \
+ -width 80 \
+ -height 10 \
+ -wrap none \
+ -xscrollcommand [list $c.list.sbx set] \
+ -yscrollcommand [list $c.list.sby set]
+ scrollbar $c.list.sbx -orient h -command [list $list xview]
+ scrollbar $c.list.sby -orient v -command [list $list yview]
+ pack $c.list.sbx -fill x -side bottom
+ pack $c.list.sby -fill y -side right
+ pack $list -fill both -expand 1
+ pack $c.list -fill both -expand 1 -padx 5 -pady 5
+
+ pack [label $c.msg2 \
+ -anchor w \
+ -justify left \
+ -text "Recovering lost commits may not be easy." \
+ ]
+ pack [label $c.msg3 \
+ -anchor w \
+ -justify left \
+ -text "Reset '$newbranch'?" \
+ ]
+
+ frame $c.buttons
+ button $c.buttons.visualize \
+ -text Visualize \
+ -command $gitk
+ pack $c.buttons.visualize -side left
+ button $c.buttons.reset \
+ -text Reset \
+ -command "
+ set @reset_ok 1
+ destroy $c
+ "
+ pack $c.buttons.reset -side right
+ button $c.buttons.cancel \
+ -default active \
+ -text Cancel \
+ -command [list destroy $c]
+ pack $c.buttons.cancel -side right -padx 5
+ pack $c.buttons -side bottom -fill x -pady 10 -padx 10
+
+ set fd [open "| git rev-list --pretty=oneline $cur ^$new" r]
+ while {[gets $fd line] > 0} {
+ set abbr [string range $line 0 7]
+ set subj [string range $line 41 end]
+ $list insert end "$abbr $subj\n"
+ }
+ close $fd
+ $list configure -state disabled
+
+ bind $c <Key-v> $gitk
+
+ bind $c <Visibility> "
+ grab $c
+ focus $c.buttons.cancel
+ "
+ bind $c <Key-Return> [list destroy $c]
+ bind $c <Key-Escape> [list destroy $c]
+ tkwait window $c
+ return $reset_ok
+}
+