1
0
mirror of https://github.com/git/git.git synced 2024-11-19 02:23:54 +01:00
* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Parse arbitrary commit-ish in SHA1 field
  gitk: Fix direction of symmetric difference in optimized mode
  gitk: New option to hide remote refs
  gitk: Do not hard-code "encoding" in attribute lookup functions
This commit is contained in:
Junio C Hamano 2009-08-16 03:46:51 -07:00
commit 1d7d6ad539

@ -288,7 +288,7 @@ proc parseviewrevs {view revs} {
if {$sdm != 2} { if {$sdm != 2} {
lappend ret $id lappend ret $id
} else { } else {
lset ret end [lindex $ret end]...$id lset ret end $id...[lindex $ret end]
} }
lappend pos $id lappend pos $id
} }
@ -1677,6 +1677,7 @@ proc readrefs {} {
global tagids idtags headids idheads tagobjid global tagids idtags headids idheads tagobjid
global otherrefids idotherrefs mainhead mainheadid global otherrefids idotherrefs mainhead mainheadid
global selecthead selectheadid global selecthead selectheadid
global hideremotes
foreach v {tagids idtags headids idheads otherrefids idotherrefs} { foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
catch {unset $v} catch {unset $v}
@ -1689,7 +1690,7 @@ proc readrefs {} {
if {![string match "refs/*" $ref]} continue if {![string match "refs/*" $ref]} continue
set name [string range $ref 5 end] set name [string range $ref 5 end]
if {[string match "remotes/*" $name]} { if {[string match "remotes/*" $name]} {
if {![string match "*/HEAD" $name]} { if {![string match "*/HEAD" $name] && !$hideremotes} {
set headids($name) $id set headids($name) $id
lappend idheads($id) $name lappend idheads($id) $name
} }
@ -2520,6 +2521,7 @@ proc savestuff {w} {
global cmitmode wrapcomment datetimeformat limitdiffs global cmitmode wrapcomment datetimeformat limitdiffs
global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
global autoselect extdifftool perfile_attrs markbgcolor global autoselect extdifftool perfile_attrs markbgcolor
global hideremotes
if {$stuffsaved} return if {$stuffsaved} return
if {![winfo viewable .]} return if {![winfo viewable .]} return
@ -2539,6 +2541,7 @@ proc savestuff {w} {
puts $f [list set wrapcomment $wrapcomment] puts $f [list set wrapcomment $wrapcomment]
puts $f [list set autoselect $autoselect] puts $f [list set autoselect $autoselect]
puts $f [list set showneartags $showneartags] puts $f [list set showneartags $showneartags]
puts $f [list set hideremotes $hideremotes]
puts $f [list set showlocalchanges $showlocalchanges] puts $f [list set showlocalchanges $showlocalchanges]
puts $f [list set datetimeformat $datetimeformat] puts $f [list set datetimeformat $datetimeformat]
puts $f [list set limitdiffs $limitdiffs] puts $f [list set limitdiffs $limitdiffs]
@ -7906,6 +7909,11 @@ proc gotocommit {} {
} }
set id [lindex $matches 0] set id [lindex $matches 0]
} }
} else {
if {[catch {set id [exec git rev-parse --verify $sha1string]}]} {
error_popup [mc "Revision %s is not known" $sha1string]
return
}
} }
} }
if {[commitinview $id $curview]} { if {[commitinview $id $curview]} {
@ -7915,7 +7923,7 @@ proc gotocommit {} {
if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} { if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} {
set msg [mc "SHA1 id %s is not known" $sha1string] set msg [mc "SHA1 id %s is not known" $sha1string]
} else { } else {
set msg [mc "Tag/Head %s is not known" $sha1string] set msg [mc "Revision %s is not in the current view" $sha1string]
} }
error_popup $msg error_popup $msg
} }
@ -10383,6 +10391,7 @@ proc doprefs {} {
global oldprefs prefstop showneartags showlocalchanges global oldprefs prefstop showneartags showlocalchanges
global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
global tabstop limitdiffs autoselect extdifftool perfile_attrs global tabstop limitdiffs autoselect extdifftool perfile_attrs
global hideremotes
set top .gitkprefs set top .gitkprefs
set prefstop $top set prefstop $top
@ -10391,7 +10400,7 @@ proc doprefs {} {
return return
} }
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
limitdiffs tabstop perfile_attrs} { limitdiffs tabstop perfile_attrs hideremotes} {
set oldprefs($v) [set $v] set oldprefs($v) [set $v]
} }
toplevel $top toplevel $top
@ -10423,6 +10432,9 @@ proc doprefs {} {
checkbutton $top.ntag -text [mc "Display nearby tags"] \ checkbutton $top.ntag -text [mc "Display nearby tags"] \
-font optionfont -variable showneartags -font optionfont -variable showneartags
grid x $top.ntag -sticky w grid x $top.ntag -sticky w
checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
-font optionfont -variable hideremotes
grid x $top.hideremotes -sticky w
checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \ checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
-font optionfont -variable limitdiffs -font optionfont -variable limitdiffs
grid x $top.ldiff -sticky w grid x $top.ldiff -sticky w
@ -10547,7 +10559,7 @@ proc prefscan {} {
global oldprefs prefstop global oldprefs prefstop
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
limitdiffs tabstop perfile_attrs} { limitdiffs tabstop perfile_attrs hideremotes} {
global $v global $v
set $v $oldprefs($v) set $v $oldprefs($v)
} }
@ -10561,6 +10573,7 @@ proc prefsok {} {
global oldprefs prefstop showneartags showlocalchanges global oldprefs prefstop showneartags showlocalchanges
global fontpref mainfont textfont uifont global fontpref mainfont textfont uifont
global limitdiffs treediffs perfile_attrs global limitdiffs treediffs perfile_attrs
global hideremotes
catch {destroy $prefstop} catch {destroy $prefstop}
unset prefstop unset prefstop
@ -10606,6 +10619,9 @@ proc prefsok {} {
$limitdiffs != $oldprefs(limitdiffs)} { $limitdiffs != $oldprefs(limitdiffs)} {
reselectline reselectline
} }
if {$hideremotes != $oldprefs(hideremotes)} {
rereadrefs
}
} }
proc formatdate {d} { proc formatdate {d} {
@ -10901,7 +10917,7 @@ proc gitattr {path attr default} {
} else { } else {
set r "unspecified" set r "unspecified"
if {![catch {set line [exec git check-attr $attr -- $path]}]} { if {![catch {set line [exec git check-attr $attr -- $path]}]} {
regexp "(.*): encoding: (.*)" $line m f r regexp "(.*): $attr: (.*)" $line m f r
} }
set path_attr_cache($attr,$path) $r set path_attr_cache($attr,$path) $r
} }
@ -10929,7 +10945,7 @@ proc cache_gitattr {attr pathlist} {
set newlist [lrange $newlist $lim end] set newlist [lrange $newlist $lim end]
if {![catch {set rlist [eval exec git check-attr $attr -- $head]}]} { if {![catch {set rlist [eval exec git check-attr $attr -- $head]}]} {
foreach row [split $rlist "\n"] { foreach row [split $rlist "\n"] {
if {[regexp "(.*): encoding: (.*)" $row m path value]} { if {[regexp "(.*): $attr: (.*)" $row m path value]} {
if {[string index $path 0] eq "\""} { if {[string index $path 0] eq "\""} {
set path [encoding convertfrom [lindex $path 0]] set path [encoding convertfrom [lindex $path 0]]
} }
@ -11011,6 +11027,7 @@ set mingaplen 100
set cmitmode "patch" set cmitmode "patch"
set wrapcomment "none" set wrapcomment "none"
set showneartags 1 set showneartags 1
set hideremotes 0
set maxrefs 20 set maxrefs 20
set maxlinelen 200 set maxlinelen 200
set showlocalchanges 1 set showlocalchanges 1