summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a7f577)
raw | patch | inline | side by side (parent: 5a7f577)
author | Paul Mackerras <paulus@samba.org> | |
Wed, 13 Feb 2008 11:12:31 +0000 (22:12 +1100) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Wed, 13 Feb 2008 11:12:31 +0000 (22:12 +1100) |
The insertrow/removerow functions were really only suitable for
inserting/removing a fake row such as the ones used for showing
the local changes. When used to insert a real new row from a
cherry-pick, they left things in an inconsistent state which then
caused various strange layout errors.
This renames insertrow/removerow to insertfakerow/removefakerow
and adds a new insertrow that does actually go to all the trouble
of creating a new arc and setting it up. This is more work but
keeps things consistent.
This also fixes a bug where cherrypick was not setting mainheadid,
and one where selectline wasn't always resulting in targetrow/id
being set to the selected row/id. Also insert/removefakerow now
adjust numcommits and call setcanvscroll.
Signed-off-by: Paul Mackerras <paulus@samba.org>
inserting/removing a fake row such as the ones used for showing
the local changes. When used to insert a real new row from a
cherry-pick, they left things in an inconsistent state which then
caused various strange layout errors.
This renames insertrow/removerow to insertfakerow/removefakerow
and adds a new insertrow that does actually go to all the trouble
of creating a new arc and setting it up. This is more work but
keeps things consistent.
This also fixes a bug where cherrypick was not setting mainheadid,
and one where selectline wasn't always resulting in targetrow/id
being set to the selected row/id. Also insert/removefakerow now
adjust numcommits and call setcanvscroll.
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk | patch | blob | history |
index c060ce98cb2749179c7dd1fa92bd466fcbd303f2..36199e330517212b0ac2675dcf9509f6a5aa6188 100755 (executable)
--- a/gitk
+++ b/gitk
}
proc insertrow {id p v} {
+ global cmitlisted children parents varcid varctok vtokmod
+ global varccommits ordertok commitidx numcommits curview
+ global targetid targetrow
+
+ readcommit $id
+ set vid $v,$id
+ set cmitlisted($vid) 1
+ set children($vid) {}
+ set parents($vid) [list $p]
+ set a [newvarc $v $id]
+ set varcid($vid) $a
+ if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {
+ modify_arc $v $a
+ }
+ lappend varccommits($v,$a) $id
+ set vp $v,$p
+ if {[llength [lappend children($vp) $id]] > 1} {
+ set children($vp) [lsort -command [list vtokcmp $v] $children($vp)]
+ catch {unset ordertok}
+ }
+ fix_reversal $p $a $v
+ incr commitidx($v)
+ if {$v == $curview} {
+ set numcommits $commitidx($v)
+ setcanvscroll
+ if {[info exists targetid]} {
+ if {![comes_before $targetid $p]} {
+ incr targetrow
+ }
+ }
+ }
+}
+
+proc insertfakerow {id p} {
global varcid varccommits parents children cmitlisted
- global commitidx varctok vtokmod targetid targetrow
+ global commitidx varctok vtokmod targetid targetrow curview numcommits
+ set v $curview
set a $varcid($v,$p)
set i [lsearch -exact $varccommits($v,$a) $p]
if {$i < 0} {
- puts "oops: insertrow can't find [shortids $p] on arc $a"
+ puts "oops: insertfakerow can't find [shortids $p] on arc $a"
return
}
set children($v,$id) {}
set varcid($v,$id) $a
lappend children($v,$p) $id
set cmitlisted($v,$id) 1
- incr commitidx($v)
+ set numcommits [incr commitidx($v)]
# note we deliberately don't update varcstart($v) even if $i == 0
set varccommits($v,$a) [linsert $varccommits($v,$a) $i $id]
if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {
incr targetrow
}
}
+ setcanvscroll
drawvisible
}
-proc removerow {id v} {
+proc removefakerow {id} {
global varcid varccommits parents children commitidx
global varctok vtokmod cmitlisted currentid selectedline
- global targetid
+ global targetid curview numcommits
+ set v $curview
if {[llength $parents($v,$id)] != 1} {
- puts "oops: removerow [shortids $id] has [llength $parents($v,$id)] parents"
+ puts "oops: removefakerow [shortids $id] has [llength $parents($v,$id)] parents"
return
}
set p [lindex $parents($v,$id) 0]
set a $varcid($v,$id)
set i [lsearch -exact $varccommits($v,$a) $id]
if {$i < 0} {
- puts "oops: removerow can't find [shortids $id] on arc $a"
+ puts "oops: removefakerow can't find [shortids $id] on arc $a"
return
}
unset varcid($v,$id)
unset parents($v,$id)
unset children($v,$id)
unset cmitlisted($v,$id)
- incr commitidx($v) -1
+ set numcommits [incr commitidx($v) -1]
set j [lsearch -exact $children($v,$p) $id]
if {$j >= 0} {
set children($v,$p) [lreplace $children($v,$p) $j $j]
if {[info exists targetid] && $targetid eq $id} {
set targetid $p
}
+ setcanvscroll
drawvisible
}
global nullid nullid2 lserial curview
if {[commitinview $nullid $curview]} {
- removerow $nullid $curview
+ removefakerow $nullid
}
if {[commitinview $nullid2 $curview]} {
- removerow $nullid2 $curview
+ removefakerow $nullid2
}
incr lserial
}
set commitinfo($nullid2) [list $hl {} {} {} {} " $hl\n"]
set commitdata($nullid2) "\n $hl\n"
if {[commitinview $nullid $curview]} {
- removerow $nullid $curview
+ removefakerow $nullid
}
- insertrow $nullid2 $mainheadid $curview
+ insertfakerow $nullid2 $mainheadid
} elseif {!$isdiff && [commitinview $nullid2 $curview]} {
- removerow $nullid2 $curview
+ removefakerow $nullid2
}
return 0
}
} else {
set p $mainheadid
}
- insertrow $nullid $p $curview
+ insertfakerow $nullid $p
} elseif {!$isdiff && [commitinview $nullid $curview]} {
- removerow $nullid $curview
+ removefakerow $nullid
}
return 0
}
global commentend idtags linknum
global mergemax numcommits pending_select
global cmitmode showneartags allcommits
+ global targetrow targetid
catch {unset pending_select}
$canv delete hover
set selectedline $l
set currentid $id
+ set targetid $id
+ set targetrow $l
$sha1entry delete 0 end
$sha1entry insert 0 $id
$sha1entry selection from 0
proc cherrypick {} {
global rowmenuid curview
- global mainhead
+ global mainhead mainheadid
set oldhead [exec git rev-parse HEAD]
set dheads [descheads $rowmenuid]
if {$mainhead ne {}} {
movehead $newhead $mainhead
movedhead $newhead $mainhead
+ set mainheadid $newhead
}
redrawtags $oldhead
redrawtags $newhead
}
proc resethead {} {
- global mainheadid mainhead rowmenuid confirm_ok resettype
+ global mainhead rowmenuid confirm_ok resettype
set confirm_ok 0
set w ".confirmreset"