summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorJeff Epler <jepler@unpythonic.net>2009-12-07 18:22:43 -0600
committerShawn O. Pearce <spearce@spearce.org>2010-01-23 15:14:15 -0800
commitff07c3b6210fbebf07ce2820b5a9a95f0583ad8d (patch)
treeabdb64bd7b2f4e8ff18322f1922e559b235893eb /git-gui.sh
parent25476c63e7d3357f955b44dd6a7c825aba819987 (diff)
downloadgit-ff07c3b6210fbebf07ce2820b5a9a95f0583ad8d.tar.xz
git-gui: Support applying a range of changes at once
Multiple lines can be selected in the diff viewer and applied all at once, rather than selecting "Stage Line For Commit" on each individual line. Signed-off-by: Jeff Epler <jepler@unpythonic.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/git-gui.sh b/git-gui.sh
index c6b5badd1a..26d7566301 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3266,7 +3266,7 @@ set ui_diff_applyhunk [$ctxm index last]
lappend diff_actions [list $ctxm entryconf $ui_diff_applyhunk -state]
$ctxm add command \
-label [mc "Apply/Reverse Line"] \
- -command {apply_line $cursorX $cursorY; do_rescan}
+ -command {apply_range_or_line $cursorX $cursorY; do_rescan}
set ui_diff_applyline [$ctxm index last]
lappend diff_actions [list $ctxm entryconf $ui_diff_applyline -state]
$ctxm add separator
@@ -3348,12 +3348,21 @@ proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} {
} elseif {$::is_submodule_diff} {
tk_popup $ctxmsm $X $Y
} else {
+ set has_range [expr {[$::ui_diff tag nextrange sel 0.0] != {}}]
if {$::ui_index eq $::current_diff_side} {
set l [mc "Unstage Hunk From Commit"]
- set t [mc "Unstage Line From Commit"]
+ if {$has_range} {
+ set t [mc "Unstage Lines From Commit"]
+ } else {
+ set t [mc "Unstage Line From Commit"]
+ }
} else {
set l [mc "Stage Hunk For Commit"]
- set t [mc "Stage Line For Commit"]
+ if {$has_range} {
+ set t [mc "Stage Lines For Commit"]
+ } else {
+ set t [mc "Stage Line For Commit"]
+ }
}
if {$::is_3way_diff
|| $current_diff_path eq {}