Merge branch 'maint'
authorShawn O. Pearce <spearce@spearce.org>
Fri, 1 Jun 2007 03:34:24 +0000 (23:34 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Fri, 1 Jun 2007 03:34:24 +0000 (23:34 -0400)
* maint:
git-gui: Allow as few as 0 lines of diff context

1  2 
git-gui.sh
lib/option.tcl
diff --combined git-gui.sh
index f87c12ea88a5a45a7a152afa462c690d454c51eb,d6472636c366b52552c70d259f3288758591d6c0..3bd12d20b5f787a2b5119b3a2f1eebbd310a50c1
@@@ -20,24 -20,6 +20,24 @@@ You should have received a copy of the 
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA}
  
 +######################################################################
 +##
 +## enable verbose loading?
 +
 +if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
 +      unset _verbose
 +      rename auto_load real__auto_load
 +      proc auto_load {name args} {
 +              puts stderr "auto_load $name"
 +              return [uplevel 1 real__auto_load $name $args]
 +      }
 +      rename source real__source
 +      proc source {name} {
 +              puts stderr "source    $name"
 +              uplevel 1 real__source $name
 +      }
 +}
 +
  ######################################################################
  ##
  ## configure our library
@@@ -50,33 -32,26 +50,33 @@@ if {$oguirel eq {1}} 
  } elseif {[string match @@* $oguirel]} {
        set oguilib [file join [file dirname [file normalize $argv0]] lib]
  }
 +
  set idx [file join $oguilib tclIndex]
 -catch {
 -      set fd [open $idx r]
 -      if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} {
 -              set idx [list]
 -              while {[gets $fd n] >= 0} {
 -                      if {$n ne {} && ![string match #* $n]} {
 -                              lappend idx $n
 -                      }
 +if {[catch {set fd [open $idx r]} err]} {
 +      catch {wm withdraw .}
 +      tk_messageBox \
 +              -icon error \
 +              -type ok \
 +              -title "git-gui: fatal error" \
 +              -message $err
 +      exit 1
 +}
 +if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} {
 +      set idx [list]
 +      while {[gets $fd n] >= 0} {
 +              if {$n ne {} && ![string match #* $n]} {
 +                      lappend idx $n
                }
 -      } else {
 -              set idx {}
        }
 -      close $fd
 +} else {
 +      set idx {}
  }
 +close $fd
 +
  if {$idx ne {}} {
        set loaded [list]
        foreach p $idx {
                if {[lsearch -exact $loaded $p] >= 0} continue
 -              puts $p
                source [file join $oguilib $p]
                lappend loaded $p
        }
  } else {
        set auto_path [concat [list $oguilib] $auto_path]
  }
 -unset -nocomplain oguilib oguirel idx fd
 -
 -if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
 -      unset _verbose
 -      rename auto_load real__auto_load
 -      proc auto_load {name args} {
 -              puts stderr "auto_load $name"
 -              return [uplevel 1 real__auto_load $name $args]
 -      }
 -      rename source real__source
 -      proc source {name} {
 -              puts stderr "source    $name"
 -              uplevel 1 real__source $name
 -      }
 -}
 +unset -nocomplain oguirel idx fd
  
  ######################################################################
  ##
@@@ -200,15 -189,6 +200,15 @@@ proc is_config_true {name} 
        }
  }
  
 +proc get_config {name} {
 +      global repo_config
 +      if {[catch {set v $repo_config($name)}]} {
 +              return {}
 +      } else {
 +              return $v
 +      }
 +}
 +
  proc load_config {include_global} {
        global repo_config global_config default_config
  
@@@ -1230,10 -1210,6 +1230,10 @@@ foreach class {Button Checkbutton Entr
  }
  unset class
  
 +if {[is_Windows] || [is_MacOSX]} {
 +      option add *Menu.tearOff 0
 +}
 +
  if {[is_MacOSX]} {
        set M1B M1
        set M1T Cmd
@@@ -1262,13 -1238,11 +1262,13 @@@ proc apply_config {} 
        }
  }
  
 +set default_config(merge.diffstat) true
  set default_config(merge.summary) false
  set default_config(merge.verbosity) 2
  set default_config(user.name) {}
  set default_config(user.email) {}
  
 +set default_config(gui.pruneduringfetch) false
  set default_config(gui.trustmtime) false
  set default_config(gui.diffcontext) 5
  set default_config(gui.newbranchtemplate) {}
@@@ -1430,11 -1404,6 +1430,11 @@@ if {[is_enabled branch]} 
        lappend disable_on_lock [list .mbar.branch entryconf \
                [.mbar.branch index last] -state]
  
 +      .mbar.branch add command -label {Rename...} \
 +              -command branch_rename::dialog
 +      lappend disable_on_lock [list .mbar.branch entryconf \
 +              [.mbar.branch index last] -state]
 +
        .mbar.branch add command -label {Delete...} \
                -command do_delete_branch
        lappend disable_on_lock [list .mbar.branch entryconf \
@@@ -1532,8 -1501,6 +1532,8 @@@ if {[is_enabled transport]} 
        menu .mbar.push
        .mbar.push add command -label {Push...} \
                -command do_push_anywhere
 +      .mbar.push add command -label {Delete...} \
 +              -command remote_branch_delete::dialog
  }
  
  if {[is_MacOSX]} {
@@@ -2071,17 -2038,17 +2071,17 @@@ lappend diff_actions [list $ctxm entryc
  $ctxm add separator
  $ctxm add command \
        -label {Show Less Context} \
-       -command {if {$repo_config(gui.diffcontext) >= 2} {
+       -command {if {$repo_config(gui.diffcontext) >= 1} {
                incr repo_config(gui.diffcontext) -1
                reshow_diff
        }}
  lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
  $ctxm add command \
        -label {Show More Context} \
-       -command {
+       -command {if {$repo_config(gui.diffcontext) < 99} {
                incr repo_config(gui.diffcontext)
                reshow_diff
-       }
+       }}
  lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
  $ctxm add separator
  $ctxm add command -label {Options...} \
diff --combined lib/option.tcl
index 4924b9aa56ce70c67331b515b8b508aeb241b6f8,11dd9be6b95c2a1fd0155e49c45b5946aabf5f9e..ba2a723fce1b1cef8f4fc166e60e842e63c9842d
@@@ -52,7 -52,7 +52,7 @@@ proc save_config {} 
  }
  
  proc do_about {} {
 -      global appvers copyright
 +      global appvers copyright oguilib
        global tcl_patchLevel tk_patchLevel
  
        set w .about_dialog
@@@ -91,10 -91,6 +91,10 @@@ $copyright" 
                append v ", Tk version $tk_patchLevel"
        }
  
 +      set d {}
 +      append d "git exec dir: [gitexec]\n"
 +      append d "git-gui lib: $oguilib"
 +
        label $w.vers \
                -text $v \
                -padx 5 -pady 5 \
                -relief solid
        pack $w.vers -side top -fill x -padx 5 -pady 5
  
 +      label $w.dirs \
 +              -text $d \
 +              -padx 5 -pady 5 \
 +              -justify left \
 +              -anchor w \
 +              -borderwidth 1 \
 +              -relief solid
 +      pack $w.dirs -side top -fill x -padx 5 -pady 5
 +
        menu $w.ctxm -tearoff 0
        $w.ctxm add command \
                -label {Copy} \
@@@ -184,11 -171,9 +184,11 @@@ proc do_options {} 
  
                {b merge.summary {Summarize Merge Commits}}
                {i-1..5 merge.verbosity {Merge Verbosity}}
 +              {b merge.diffstat {Show Diffstat After Merge}}
  
                {b gui.trustmtime  {Trust File Modification Timestamps}}
-               {i-1..99 gui.diffcontext {Number of Diff Context Lines}}
 +              {b gui.pruneduringfetch {Prune Tracking Branches During Fetch}}
+               {i-0..99 gui.diffcontext {Number of Diff Context Lines}}
                {t gui.newbranchtemplate {New Branch Name Template}}
                } {
                set type [lindex $option 0]