This commit is contained in:
133
gitk
133
gitk
@ -218,6 +218,8 @@ proc parsecommit {id contents listed olds} {
|
|||||||
set i [string first "\n" $comment]
|
set i [string first "\n" $comment]
|
||||||
if {$i >= 0} {
|
if {$i >= 0} {
|
||||||
set headline [string trim [string range $comment 0 $i]]
|
set headline [string trim [string range $comment 0 $i]]
|
||||||
|
} else {
|
||||||
|
set headline $comment
|
||||||
}
|
}
|
||||||
if {!$listed} {
|
if {!$listed} {
|
||||||
# git-rev-list indents the comment by 4 spaces;
|
# git-rev-list indents the comment by 4 spaces;
|
||||||
@ -226,6 +228,7 @@ proc parsecommit {id contents listed olds} {
|
|||||||
foreach line [split $comment "\n"] {
|
foreach line [split $comment "\n"] {
|
||||||
append newcomment " "
|
append newcomment " "
|
||||||
append newcomment $line
|
append newcomment $line
|
||||||
|
append newcomment "\n"
|
||||||
}
|
}
|
||||||
set comment $newcomment
|
set comment $newcomment
|
||||||
}
|
}
|
||||||
@ -238,77 +241,43 @@ proc parsecommit {id contents listed olds} {
|
|||||||
|
|
||||||
proc readrefs {} {
|
proc readrefs {} {
|
||||||
global tagids idtags headids idheads tagcontents
|
global tagids idtags headids idheads tagcontents
|
||||||
|
|
||||||
set tags [glob -nocomplain -types f [gitdir]/refs/tags/*]
|
|
||||||
foreach f $tags {
|
|
||||||
catch {
|
|
||||||
set fd [open $f r]
|
|
||||||
set line [read $fd]
|
|
||||||
if {[regexp {^[0-9a-f]{40}} $line id]} {
|
|
||||||
set direct [file tail $f]
|
|
||||||
set tagids($direct) $id
|
|
||||||
lappend idtags($id) $direct
|
|
||||||
set tagblob [exec git-cat-file tag $id]
|
|
||||||
set contents [split $tagblob "\n"]
|
|
||||||
set obj {}
|
|
||||||
set type {}
|
|
||||||
set tag {}
|
|
||||||
foreach l $contents {
|
|
||||||
if {$l == {}} break
|
|
||||||
switch -- [lindex $l 0] {
|
|
||||||
"object" {set obj [lindex $l 1]}
|
|
||||||
"type" {set type [lindex $l 1]}
|
|
||||||
"tag" {set tag [string range $l 4 end]}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if {$obj != {} && $type == "commit" && $tag != {}} {
|
|
||||||
set tagids($tag) $obj
|
|
||||||
lappend idtags($obj) $tag
|
|
||||||
set tagcontents($tag) $tagblob
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close $fd
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set heads [glob -nocomplain -types f [gitdir]/refs/heads/*]
|
|
||||||
foreach f $heads {
|
|
||||||
catch {
|
|
||||||
set fd [open $f r]
|
|
||||||
set line [read $fd 40]
|
|
||||||
if {[regexp {^[0-9a-f]{40}} $line id]} {
|
|
||||||
set head [file tail $f]
|
|
||||||
set headids($head) $line
|
|
||||||
lappend idheads($line) $head
|
|
||||||
}
|
|
||||||
close $fd
|
|
||||||
}
|
|
||||||
}
|
|
||||||
readotherrefs refs {} {tags heads}
|
|
||||||
}
|
|
||||||
|
|
||||||
proc readotherrefs {base dname excl} {
|
|
||||||
global otherrefids idotherrefs
|
global otherrefids idotherrefs
|
||||||
|
|
||||||
set git [gitdir]
|
set refd [open [list | git-ls-remote [gitdir]] r]
|
||||||
set files [glob -nocomplain -types f [file join $git $base *]]
|
while {0 <= [set n [gets $refd line]]} {
|
||||||
foreach f $files {
|
if {![regexp {^([0-9a-f]{40}) refs/([^^]*)$} $line \
|
||||||
catch {
|
match id path]} {
|
||||||
set fd [open $f r]
|
continue
|
||||||
set line [read $fd 40]
|
}
|
||||||
if {[regexp {^[0-9a-f]{40}} $line id]} {
|
if {![regexp {^(tags|heads)/(.*)$} $path match type name]} {
|
||||||
set name "$dname[file tail $f]"
|
set type others
|
||||||
set otherrefids($name) $id
|
set name $path
|
||||||
lappend idotherrefs($id) $name
|
}
|
||||||
|
if {$type == "tags"} {
|
||||||
|
set tagids($name) $id
|
||||||
|
lappend idtags($id) $name
|
||||||
|
set obj {}
|
||||||
|
set type {}
|
||||||
|
set tag {}
|
||||||
|
catch {
|
||||||
|
set commit [exec git-rev-parse "$id^0"]
|
||||||
|
if {"$commit" != "$id"} {
|
||||||
|
set tagids($name) $commit
|
||||||
|
lappend idtags($commit) $name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
set tagcontents($name) [exec git-cat-file tag "$id"]
|
||||||
}
|
}
|
||||||
close $fd
|
} elseif { $type == "heads" } {
|
||||||
|
set headids($name) $id
|
||||||
|
lappend idheads($id) $name
|
||||||
|
} else {
|
||||||
|
set otherrefids($name) $id
|
||||||
|
lappend idotherrefs($id) $name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set dirs [glob -nocomplain -types d [file join $git $base *]]
|
close $refd
|
||||||
foreach d $dirs {
|
|
||||||
set dir [file tail $d]
|
|
||||||
if {[lsearch -exact $excl $dir] >= 0} continue
|
|
||||||
readotherrefs [file join $base $dir] "$dname$dir/" {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proc error_popup msg {
|
proc error_popup msg {
|
||||||
@ -1537,17 +1506,15 @@ proc drawrest {} {
|
|||||||
global numcommits ncmupdate
|
global numcommits ncmupdate
|
||||||
global nextupdate startmsecs revlistorder
|
global nextupdate startmsecs revlistorder
|
||||||
|
|
||||||
if {!$revlistorder} {
|
set level [decidenext]
|
||||||
set level [decidenext]
|
if {$level >= 0} {
|
||||||
if {$level >= 0} {
|
set phase drawgraph
|
||||||
set phase drawgraph
|
while 1 {
|
||||||
while 1 {
|
lappend displayorder [lindex $todo $level]
|
||||||
lappend displayorder [lindex $todo $level]
|
set hard [updatetodo $level $datemode]
|
||||||
set hard [updatetodo $level $datemode]
|
if {$hard} {
|
||||||
if {$hard} {
|
set level [decidenext]
|
||||||
set level [decidenext]
|
if {$level < 0} break
|
||||||
if {$level < 0} break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2821,8 +2788,7 @@ proc gettreediffs {ids} {
|
|||||||
set treepending $ids
|
set treepending $ids
|
||||||
set treediff {}
|
set treediff {}
|
||||||
set id [lindex $ids 0]
|
set id [lindex $ids 0]
|
||||||
set p [lindex $ids 1]
|
if [catch {set gdtf [open "|git-diff-tree --no-commit-id -r $id" r]}] return
|
||||||
if [catch {set gdtf [open "|git-diff-tree -r $id" r]}] return
|
|
||||||
fconfigure $gdtf -blocking 0
|
fconfigure $gdtf -blocking 0
|
||||||
fileevent $gdtf readable [list gettreediffline $gdtf $ids]
|
fileevent $gdtf readable [list gettreediffline $gdtf $ids]
|
||||||
}
|
}
|
||||||
@ -2856,9 +2822,8 @@ proc getblobdiffs {ids} {
|
|||||||
global difffilestart nextupdate diffinhdr treediffs
|
global difffilestart nextupdate diffinhdr treediffs
|
||||||
|
|
||||||
set id [lindex $ids 0]
|
set id [lindex $ids 0]
|
||||||
set p [lindex $ids 1]
|
|
||||||
set env(GIT_DIFF_OPTS) $diffopts
|
set env(GIT_DIFF_OPTS) $diffopts
|
||||||
set cmd [list | git-diff-tree -r -p -C $id]
|
set cmd [list | git-diff-tree --no-commit-id -r -p -C $id]
|
||||||
if {[catch {set bdf [open $cmd r]} err]} {
|
if {[catch {set bdf [open $cmd r]} err]} {
|
||||||
puts "error getting diffs: $err"
|
puts "error getting diffs: $err"
|
||||||
return
|
return
|
||||||
@ -3159,7 +3124,7 @@ proc linehover {} {
|
|||||||
set t [$canv create rectangle $x0 $y0 $x1 $y1 \
|
set t [$canv create rectangle $x0 $y0 $x1 $y1 \
|
||||||
-fill \#ffff80 -outline black -width 1 -tags hover]
|
-fill \#ffff80 -outline black -width 1 -tags hover]
|
||||||
$canv raise $t
|
$canv raise $t
|
||||||
set t [$canv create text $x $y -anchor nw -text $text -tags hover]
|
set t [$canv create text $x $y -anchor nw -text $text -tags hover -font $mainfont]
|
||||||
$canv raise $t
|
$canv raise $t
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3194,7 +3159,7 @@ proc clickisonarrow {id y} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc arrowjump {id dirn y} {
|
proc arrowjump {id dirn y} {
|
||||||
global mainline sidelines canv
|
global mainline sidelines canv canv2 canv3
|
||||||
|
|
||||||
set yt {}
|
set yt {}
|
||||||
if {$dirn eq "down"} {
|
if {$dirn eq "down"} {
|
||||||
@ -3232,6 +3197,8 @@ proc arrowjump {id dirn y} {
|
|||||||
set yfrac 0
|
set yfrac 0
|
||||||
}
|
}
|
||||||
$canv yview moveto $yfrac
|
$canv yview moveto $yfrac
|
||||||
|
$canv2 yview moveto $yfrac
|
||||||
|
$canv3 yview moveto $yfrac
|
||||||
}
|
}
|
||||||
|
|
||||||
proc lineclick {x y id isnew} {
|
proc lineclick {x y id isnew} {
|
||||||
|
Reference in New Issue
Block a user