summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef5c971)
raw | patch | inline | side by side (parent: ef5c971)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 19 Nov 2006 01:59:49 +0000 (20:59 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 19 Nov 2006 03:46:07 +0000 (22:46 -0500) |
I was starting to find it annoying that once you entered the 'Amend Last'
mode there was no way to go back to the 'New Commit' mode without quitting
and restarting git-gui. Its just confusing for the end-user.
Now we can flip back and forth between a new commit and an amend commit
through a pair of radio buttons on the header of the commit buffer area
and through a pair of radio menu buttons in the Commit menu.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
mode there was no way to go back to the 'New Commit' mode without quitting
and restarting git-gui. Its just confusing for the end-user.
Now we can flip back and forth between a new commit and an amend commit
through a pair of radio buttons on the header of the commit buffer area
and through a pair of radio menu buttons in the Commit menu.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui | patch | blob | history |
index 4850e78ab0e4203d5f9a7a37e8f0287b3de2defc..5c6af8940ee15e0e68b89c0fadb131585d6ab3b1 100755 (executable)
--- a/git-gui
+++ b/git-gui
rescan {set ui_status_value {Ready.}}
}
+proc create_new_commit {} {
+ global commit_type ui_comm
+
+ set commit_type normal
+ $ui_comm delete 0.0 end
+ $ui_comm edit modified false
+ $ui_comm edit reset
+ rescan {set ui_status_value {Ready.}}
+}
+
proc commit_tree {} {
global HEAD commit_type file_states ui_comm repo_config
proc commit_committree {fd_wt curHEAD msg} {
global single_commit gitdir HEAD PARENT commit_type tcl_platform
- global ui_status_value ui_comm
+ global ui_status_value ui_comm selected_commit_type
global file_states selected_paths
gets $fd_wt tree_id
# -- Update status without invoking any git commands.
#
set commit_type normal
+ set selected_commit_type new
set HEAD $cmt_id
set PARENT $cmt_id
}
proc post_pull_remote {remote branch success} {
- global HEAD PARENT commit_type
+ global HEAD PARENT commit_type selected_commit_type
global ui_status_value
unlock_index
if {$success} {
repository_state HEAD commit_type
set PARENT $HEAD
+ set selected_commit_type new
set $ui_status_value "Pulling $branch from $remote complete."
} else {
set m "Conflicts detected while pulling $branch from $remote."
}
}
-proc do_amend_last {} {
- load_last_commit
+proc do_select_commit_type {} {
+ global commit_type selected_commit_type
+
+ if {$selected_commit_type eq {new}
+ && [string match amend* $commit_type]} {
+ create_new_commit
+ } elseif {$selected_commit_type eq {amend}
+ && ![string match amend* $commit_type]} {
+ load_last_commit
+
+ # The amend request was rejected...
+ #
+ if {![string match amend* $commit_type]} {
+ set commit_type new
+ }
+ }
}
proc do_commit {} {
# -- Commit Menu
#
menu .mbar.commit
-.mbar.commit add command -label Rescan \
- -command do_rescan \
- -accelerator F5 \
+
+.mbar.commit add radiobutton \
+ -label {New Commit} \
+ -command do_select_commit_type \
+ -variable selected_commit_type \
+ -value new \
+ -font font_ui
+lappend disable_on_lock \
+ [list .mbar.commit entryconf [.mbar.commit index last] -state]
+
+.mbar.commit add radiobutton \
+ -label {Amend Last Commit} \
+ -command do_select_commit_type \
+ -variable selected_commit_type \
+ -value amend \
-font font_ui
lappend disable_on_lock \
[list .mbar.commit entryconf [.mbar.commit index last] -state]
-.mbar.commit add command -label {Amend Last Commit} \
- -command do_amend_last \
+
+.mbar.commit add separator
+
+.mbar.commit add command -label Rescan \
+ -command do_rescan \
+ -accelerator F5 \
-font font_ui
lappend disable_on_lock \
[list .mbar.commit entryconf [.mbar.commit index last] -state]
+
.mbar.commit add command -label {Include Selected Files} \
-command do_include_selection \
-font font_ui
lappend disable_on_lock \
[list .mbar.commit entryconf [.mbar.commit index last] -state]
+
.mbar.commit add command -label {Include All Files} \
-command do_include_all \
-accelerator $M1T-I \
-font font_ui
lappend disable_on_lock \
[list .mbar.commit entryconf [.mbar.commit index last] -state]
+
.mbar.commit add command -label {Sign Off} \
-command do_signoff \
-accelerator $M1T-S \
-font font_ui
+
.mbar.commit add command -label Commit \
-command do_commit \
-accelerator $M1T-Return \
lappend disable_on_lock \
{.vpane.lower.commarea.buttons.rescan conf -state}
-button .vpane.lower.commarea.buttons.amend -text {Amend Last} \
- -command do_amend_last \
- -font font_ui
-pack .vpane.lower.commarea.buttons.amend -side top -fill x
-lappend disable_on_lock \
- {.vpane.lower.commarea.buttons.amend conf -state}
-
button .vpane.lower.commarea.buttons.incall -text {Include All} \
-command do_include_all \
-font font_ui
# -- Commit Message Buffer
#
frame .vpane.lower.commarea.buffer
+frame .vpane.lower.commarea.buffer.header
set ui_comm .vpane.lower.commarea.buffer.t
-set ui_coml .vpane.lower.commarea.buffer.l
+set ui_coml .vpane.lower.commarea.buffer.header.l
+radiobutton .vpane.lower.commarea.buffer.header.new \
+ -text {New Commit} \
+ -command do_select_commit_type \
+ -variable selected_commit_type \
+ -value new \
+ -font font_ui
+lappend disable_on_lock \
+ [list .vpane.lower.commarea.buffer.header.new conf -state]
+radiobutton .vpane.lower.commarea.buffer.header.amend \
+ -text {Amend Last Commit} \
+ -command do_select_commit_type \
+ -variable selected_commit_type \
+ -value amend \
+ -font font_ui
+lappend disable_on_lock \
+ [list .vpane.lower.commarea.buffer.header.amend conf -state]
label $ui_coml \
-anchor w \
-justify left \
$ui_coml conf -text $txt
}
trace add variable commit_type write trace_commit_type
+pack $ui_coml -side left -fill x
+pack .vpane.lower.commarea.buffer.header.amend -side right
+pack .vpane.lower.commarea.buffer.header.new -side right
+
text $ui_comm -background white -borderwidth 1 \
-undo true \
-maxundo 20 \
-yscrollcommand {.vpane.lower.commarea.buffer.sby set}
scrollbar .vpane.lower.commarea.buffer.sby \
-command [list $ui_comm yview]
-pack $ui_coml -side top -fill x
+pack .vpane.lower.commarea.buffer.header -side top -fill x
pack .vpane.lower.commarea.buffer.sby -side right -fill y
pack $ui_comm -side left -fill y
pack .vpane.lower.commarea.buffer -side left -fill y
set commit_type {}
set empty_tree {}
set current_diff {}
+set selected_commit_type new
wm title . "$appname ([file normalize [file dirname $gitdir]])"
focus -force $ui_comm