Merge branch 'maint'
authorShawn O. Pearce <spearce@spearce.org>
Mon, 11 Jun 2007 06:14:21 +0000 (02:14 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 11 Jun 2007 06:14:21 +0000 (02:14 -0400)
* maint: (38 commits)
git-gui: Changed blame header bar background to match main window
git-gui: Favor the original annotations over the recent ones
git-gui: Improve our labeling of blame annotation types
git-gui: Use three colors for the blame viewer background
git-gui: Jump to original line in blame viewer
git-gui: Display both commits in our tooltips
git-gui: Run blame twice on the same file and display both outputs
git-gui: Display the "Loading annotation..." message in italic
git-gui: Rename fields in blame viewer to better descriptions
git-gui: Label the uncommitted blame history entry
git-gui: Switch internal blame structure to Tcl lists
git-gui: Cleanup redundant column management in blame viewer
git-gui: Better document our blame variables
git-gui: Remove unused commit_list from blame viewer
git-gui: Automatically expand the line number column as needed
git-gui: Make the line number column slightly wider in blame
git-gui: Use lighter colors in blame view
git-gui: Remove unnecessary space between columns in blame viewer
git-gui: Remove the loaded column from the blame viewer
git-gui: Clip the commit summaries in the blame history menu
...

1  2 
git-gui.sh
lib/option.tcl
diff --combined git-gui.sh
index c76622e4e9c685e9999a6444048d00d1f433d8d7,dfb4b955eb1d33fdd90b25e1e575ed86949bbd9f..e33ee03bc0b1881596115da73c875ef784cd0a93
@@@ -36,24 -36,6 +36,24 @@@ if {[catch {package require Tcl 8.4} er
        exit 1
  }
  
 +######################################################################
 +##
 +## 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
@@@ -66,33 -48,26 +66,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
  
  ######################################################################
  ##
@@@ -216,15 -205,6 +216,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
  
@@@ -278,17 -258,6 +278,17 @@@ proc git {args} 
        return [eval exec git $args]
  }
  
 +proc current-branch {} {
 +      set ref {}
 +      set fd [open [gitdir HEAD] r]
 +      if {[gets $fd ref] <16
 +       || ![regsub {^ref: refs/heads/} $ref {} ref]} {
 +              set ref {}
 +      }
 +      close $fd
 +      return $ref
 +}
 +
  auto_load tk_optionMenu
  rename tk_optionMenu real__tkOptionMenu
  proc tk_optionMenu {w varName args} {
@@@ -437,7 -406,15 +437,7 @@@ proc repository_state {ctvar hdvar mhva
  
        set mh [list]
  
 -      if {[catch {set current_branch [git symbolic-ref HEAD]}]} {
 -              set current_branch {}
 -      } else {
 -              regsub ^refs/((heads|tags|remotes)/)? \
 -                      $current_branch \
 -                      {} \
 -                      current_branch
 -      }
 -
 +      set current_branch [current-branch]
        if {[catch {set hd [git rev-parse --verify HEAD]}]} {
                set hd {}
                set ct initial
@@@ -1047,6 -1024,7 +1047,7 @@@ proc incr_font_size {font {amt 1}} 
        incr sz $amt
        font configure $font -size $sz
        font configure ${font}bold -size $sz
+       font configure ${font}italic -size $sz
  }
  
  ######################################################################
@@@ -1239,8 -1217,10 +1240,10 @@@ catch 
        destroy .dummy
  }
  
+ font create font_uiitalic
  font create font_uibold
  font create font_diffbold
+ font create font_diffitalic
  
  foreach class {Button Checkbutton Entry Label
                Labelframe Listbox Menu Message
  }
  unset class
  
 +if {[is_Windows] || [is_MacOSX]} {
 +      option add *Menu.tearOff 0
 +}
 +
  if {[is_MacOSX]} {
        set M1B M1
        set M1T Cmd
@@@ -1276,18 -1252,18 +1279,20 @@@ proc apply_config {} 
                }
                foreach {cn cv} [font configure $font] {
                        font configure ${font}bold $cn $cv
+                       font configure ${font}italic $cn $cv
                }
                font configure ${font}bold -weight bold
+               font configure ${font}italic -slant italic
        }
  }
  
 +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) {}
@@@ -1449,11 -1425,6 +1454,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 \
@@@ -1551,8 -1522,6 +1556,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]} {
@@@ -1670,8 -1639,14 +1675,8 @@@ switch -- $subcommand 
  browser {
        set subcommand_args {rev?}
        switch [llength $argv] {
 -      0 {
 -              set current_branch [git symbolic-ref HEAD]
 -              regsub ^refs/((heads|tags|remotes)/)? \
 -                      $current_branch {} current_branch
 -      }
 -      1 {
 -              set current_branch [lindex $argv 0]
 -      }
 +      0 { set current_branch [current-branch] }
 +      1 { set current_branch [lindex $argv 0] }
        default usage
        }
        browser::new $current_branch
@@@ -1704,7 -1679,9 +1709,7 @@@ blame 
        unset is_path
  
        if {$head eq {}} {
 -              set current_branch [git symbolic-ref HEAD]
 -              regsub ^refs/((heads|tags|remotes)/)? \
 -                      $current_branch {} current_branch
 +              set current_branch [current-branch]
        } else {
                set current_branch $head
        }
diff --combined lib/option.tcl
index ba2a723fce1b1cef8f4fc166e60e842e63c9842d,b29e14e64dd305922f82556e8e445be42a9fbb38..ae19a8f9cf3901a808c85f0c028fbf44813d30b5
@@@ -15,6 -15,9 +15,9 @@@ proc save_config {} 
                font configure ${font}bold \
                        -family $global_config_new(gui.$font^^family) \
                        -size $global_config_new(gui.$font^^size)
+               font configure ${font}italic \
+                       -family $global_config_new(gui.$font^^family) \
+                       -size $global_config_new(gui.$font^^size)
                set global_config_new(gui.$name) [font configure $font]
                unset global_config_new(gui.$font^^family)
                unset global_config_new(gui.$font^^size)
@@@ -52,7 -55,7 +55,7 @@@
  }
  
  proc do_about {} {
 -      global appvers copyright
 +      global appvers copyright oguilib
        global tcl_patchLevel tk_patchLevel
  
        set w .about_dialog
@@@ -91,10 -94,6 +94,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,10 -174,8 +187,10 @@@ 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}}
 +              {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}}
                } {