]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Merge git://repo.or.cz/git-gui
authorJunio C Hamano <gitster@pobox.com>
Wed, 2 Apr 2008 17:29:10 +0000 (10:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Apr 2008 17:29:10 +0000 (10:29 -0700)
* git://repo.or.cz/git-gui:
  git-gui 0.10
  git-gui: Add shortcut keys for Show More/Less Context

1  2 
git-gui/GIT-VERSION-GEN
git-gui/git-gui.sh

diff --combined git-gui/GIT-VERSION-GEN
index cfe46a857e5fd319fa6eb49474ddbb37bd47c537,0000000000000000000000000000000000000000..0ab478ef90aba9048a2de785d538da16e1bae431
mode 100755,000000..100755
--- /dev/null
@@@ -1,80 -1,0 +1,80 @@@
- DEF_VER=0.9.GITGUI
 +#!/bin/sh
 +
 +GVF=GIT-VERSION-FILE
++DEF_VER=0.10.GITGUI
 +
 +LF='
 +'
 +
 +tree_search ()
 +{
 +      head=$1
 +      tree=$2
 +      for p in $(git rev-list --parents --max-count=1 $head 2>/dev/null)
 +      do
 +              test $tree = $(git rev-parse $p^{tree} 2>/dev/null) &&
 +              vn=$(git describe --abbrev=4 $p 2>/dev/null) &&
 +              case "$vn" in
 +              gitgui-[0-9]*) echo $vn; break;;
 +              esac
 +      done
 +}
 +
 +# Always use the tarball version file if found, just
 +# in case we are somehow contained in a larger git
 +# repository that doesn't actually track our state.
 +# (At least one package manager is doing this.)
 +#
 +# We may be a subproject, so try looking for the merge
 +# commit that supplied this directory content if we are
 +# not at the toplevel.  We probably will always be the
 +# second parent in the commit, but we shouldn't rely on
 +# that fact.
 +#
 +# If we are at the toplevel or the merge assumption fails
 +# try looking for a gitgui-* tag.
 +
 +if test -f version &&
 +   VN=$(cat version)
 +then
 +      : happy
 +elif prefix="$(git rev-parse --show-prefix 2>/dev/null)"
 +   test -n "$prefix" &&
 +   head=$(git rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
 +   tree=$(git rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
 +   VN=$(tree_search $head $tree)
 +   case "$VN" in
 +   gitgui-[0-9]*) : happy ;;
 +   *) (exit 1) ;;
 +   esac
 +then
 +      VN=$(echo "$VN" | sed -e 's/^gitgui-//;s/-/./g');
 +elif VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
 +   case "$VN" in
 +   gitgui-[0-9]*) : happy ;;
 +   *) (exit 1) ;;
 +   esac
 +then
 +      VN=$(echo "$VN" | sed -e 's/^gitgui-//;s/-/./g');
 +else
 +      VN="$DEF_VER"
 +fi
 +
 +dirty=$(sh -c 'git diff-index --name-only HEAD' 2>/dev/null) || dirty=
 +case "$dirty" in
 +'')
 +      ;;
 +*)
 +      VN="$VN-dirty" ;;
 +esac
 +
 +if test -r $GVF
 +then
 +      VC=$(sed -e 's/^GITGUI_VERSION = //' <$GVF)
 +else
 +      VC=unset
 +fi
 +test "$VN" = "$VC" || {
 +      echo >&2 "GITGUI_VERSION = $VN"
 +      echo "GITGUI_VERSION = $VN" >$GVF
 +}
diff --combined git-gui/git-gui.sh
index 5e97fbf03e3f79fd3be52c332e2b13f68673b39e,8225cec50552bf08f09157ac4500e7f4aefaba26..8225cec50552bf08f09157ac4500e7f4aefaba26
@@@ -1846,6 -1846,22 +1846,22 @@@ proc add_range_to_selection {w x y} 
        $w tag add in_sel $begin.0 [expr {$end + 1}].0
  }
  
+ proc show_more_context {} {
+       global repo_config
+       if {$repo_config(gui.diffcontext) < 99} {
+               incr repo_config(gui.diffcontext)
+               reshow_diff
+       }
+ }
+ proc show_less_context {} {
+       global repo_config
+       if {$repo_config(gui.diffcontext) >= 1} {
+               incr repo_config(gui.diffcontext) -1
+               reshow_diff
+       }
+ }
  ######################################################################
  ##
  ## ui construction
@@@ -2046,6 -2062,16 +2062,16 @@@ if {[is_enabled multicommit] || [is_ena
  
        .mbar.commit add separator
  
+       .mbar.commit add command -label [mc "Show Less Context"] \
+               -command show_less_context \
+               -accelerator $M1T-\[
+       .mbar.commit add command -label [mc "Show More Context"] \
+               -command show_more_context \
+               -accelerator $M1T-\]
+       .mbar.commit add separator
        .mbar.commit add command -label [mc "Sign Off"] \
                -command do_signoff \
                -accelerator $M1T-S
@@@ -2593,17 -2619,11 +2619,11 @@@ lappend diff_actions [list $ctxm entryc
  $ctxm add separator
  $ctxm add command \
        -label [mc "Show Less Context"] \
-       -command {if {$repo_config(gui.diffcontext) >= 1} {
-               incr repo_config(gui.diffcontext) -1
-               reshow_diff
-       }}
+       -command show_less_context
  lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
  $ctxm add command \
        -label [mc "Show More Context"] \
-       -command {if {$repo_config(gui.diffcontext) < 99} {
-               incr repo_config(gui.diffcontext)
-               reshow_diff
-       }}
+       -command show_more_context
  lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
  $ctxm add separator
  $ctxm add command \
@@@ -2695,6 -2715,8 +2715,8 @@@ bind $ui_comm <$M1B-Key-v> {tk_textPast
  bind $ui_comm <$M1B-Key-V> {tk_textPaste %W; %W see insert; break}
  bind $ui_comm <$M1B-Key-a> {%W tag add sel 0.0 end;break}
  bind $ui_comm <$M1B-Key-A> {%W tag add sel 0.0 end;break}
+ bind $ui_comm <$M1B-Key-\[> {show_less_context;break}
+ bind $ui_comm <$M1B-Key-\]> {show_more_context;break}
  
  bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break}
  bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break}
@@@ -2738,6 -2760,8 +2760,8 @@@ bind .   <$M1B-Key-t> do_add_selectio
  bind .   <$M1B-Key-T> do_add_selection
  bind .   <$M1B-Key-i> do_add_all
  bind .   <$M1B-Key-I> do_add_all
+ bind .   <$M1B-Key-\[> {show_less_context;break}
+ bind .   <$M1B-Key-\]> {show_more_context;break}
  bind .   <$M1B-Key-Return> do_commit
  foreach i [list $ui_index $ui_workdir] {
        bind $i <Button-1>       "toggle_or_diff         $i %x %y; break"